Skip to content

feat(plugin): surface reasoning-effort variants from /v1/model/info reported by LiteLLM - #14

Merged
yuseferi merged 1 commit into
yuseferi:mainfrom
JCHacking:variants
Aug 4, 2026
Merged

feat(plugin): surface reasoning-effort variants from /v1/model/info reported by LiteLLM#14
yuseferi merged 1 commit into
yuseferi:mainfrom
JCHacking:variants

Conversation

@JCHacking

@JCHacking JCHacking commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Read per-model reasoning effort support from LiteLLM's /v1/model/info and expose each supported level as an OpenCode variant with reasoningEffort set.

Type of change

  • 🐛 Bug fix (non-breaking)
  • ✨ New feature (non-breaking)
  • 💥 Breaking change
  • 📝 Documentation only
  • 🔧 Internal / refactor

Checklist

  • npm run typecheck passes
  • No new runtime dependencies (or justified in this PR description)
  • README updated if public API or behavior changed
  • CHANGELOG.md updated under ## [Unreleased]
  • Commit messages follow Conventional Commits

How was this tested?

I tested a model that had other variants that didn't include OpenCode by default, and with this change, it now reads them correctly.

Screenshots / logs (optional)

Summary by CodeRabbit

  • New Features

    • Added support for exposing LiteLLM-reported reasoning-effort model variants.
    • Models supporting low, medium, or high reasoning effort can now be selected with the corresponding setting.
    • Reasoning-effort capabilities are automatically detected from LiteLLM model metadata.
  • Documentation

    • Updated the changelog and model documentation with details about reasoning-effort variants.

…eported by LiteLLM

Read per-model reasoning effort support from LiteLLM's /v1/model/info and expose each supported level as an OpenCode variant with reasoningEffort set.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The plugin now fetches LiteLLM model metadata, detects supported reasoning-effort levels, and exposes corresponding OpenCode model variants with reasoningEffort settings. Documentation and the changelog describe the new behavior.

Changes

Reasoning-effort model variants

Layer / File(s) Summary
Capability metadata detection
src/types/index.ts, src/utils/litellm-api.ts
LiteLLMModelInfo stores supported reasoning efforts. Discovery detects supports_<name>_reasoning_effort flags from model metadata and LiteLLM parameters.
Model metadata discovery
src/plugin/discover.ts
Model listing and /v1/model/info retrieval run concurrently. Model-list failures stop discovery. Metadata failures are logged, and models continue without metadata.
Variant generation and documentation
src/plugin/build-model.ts, src/plugin/index.ts, README.md, CHANGELOG.md
Model conversion creates variants for each supported reasoning effort and assigns the matching reasoningEffort value. Documentation describes the generated variants.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ModelDiscovery
  participant LiteLLM
  participant ModelConverter
  participant OpenCodeConfig
  ModelDiscovery->>LiteLLM: Fetch model list and /v1/model/info
  LiteLLM-->>ModelDiscovery: Return models and optional metadata
  ModelDiscovery->>ModelConverter: Pass matched model metadata
  ModelConverter->>OpenCodeConfig: Create reasoning-effort variants
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: yuseferi, overbit

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes exposing LiteLLM-reported reasoning-effort variants from the /v1/model/info endpoint.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Warning

⚠️ This pull request shows signs of AI-generated slop (redundant_comments). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/plugin/discover.ts`:
- Around line 193-194: Update the model construction flow around buildModelV2 to
merge the /v1/model/info metadata from infoByName into each /v1/models record
before building it, using the same field-precedence merge established in
src/plugin/index.ts. Pass the merged model so capabilities, limits, mode, and
reasoning-effort flags are reflected correctly while preserving the existing
resolvedApi, perModelApi, and model identity inputs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b9ed210-d541-48f2-b86c-23a5932ef8e0

📥 Commits

Reviewing files that changed from the base of the PR and between baa8874 and 938f239.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • README.md
  • src/plugin/build-model.ts
  • src/plugin/discover.ts
  • src/plugin/index.ts
  • src/types/index.ts
  • src/utils/litellm-api.ts

Comment thread src/plugin/discover.ts
@yuseferi
yuseferi merged commit 34db713 into yuseferi:main Aug 4, 2026
4 checks passed
github-actions Bot pushed a commit that referenced this pull request Aug 4, 2026
# [0.8.0](v0.7.1...v0.8.0) (2026-08-04)

### Features

* **plugin:** surface reasoning-effort variants from /v1/model/info reported by LiteLLM ([#14](#14)) ([34db713](34db713))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants