fix: allow custom providers to switch reasoning effort for proxied models#148
Closed
weiconghe wants to merge 6 commits into
Closed
fix: allow custom providers to switch reasoning effort for proxied models#148weiconghe wants to merge 6 commits into
weiconghe wants to merge 6 commits into
Conversation
docs: correct OpenCode repository URL in README files
…dels The hardcoded model-id exclusion list in ProviderTransform.variants() was matching any model whose id contained 'deepseek', 'minimax', 'glm', etc., regardless of provider. This prevented custom/self-hosted providers (using @ai-sdk/openai-compatible) from getting variant options even when the user explicitly set reasoning: true. Now the exclusion only applies when the providerID matches the model family (e.g. deepseek provider + deepseek model), so custom providers that proxy these models still get proper reasoning effort variants. Closes XiaomiMiMo#68
97aefc0 to
ab53d06
Compare
Collaborator
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #68
Type of change
What does this PR do?
Problem
In
packages/opencode/src/provider/transform.ts(lines 509-519),ProviderTransform.variants()has a hardcoded model-id exclusion list that returns{}for any model whose id contains"deepseek","minimax","glm","mistral","kimi","k2p5","qwen", or"big-pickle".This exclusion runs before the npm-based switch statement. For custom providers using
@ai-sdk/openai-compatible, the switch case at line 636 would normally returnWIDELY_SUPPORTED_EFFORTSvariants, but it is never reached because the id check returns early.Impact
When a user configures a custom provider in
mimocode.jsonwith a model likedeepseek-v4-proand setsreasoning: true, the variant list is empty. This means the model variant switching UI (DialogVariant) is completely hidden, and the user cannot change reasoning effort levels — a core feature for reasoning models.Fix
Changed the exclusion logic to also check
providerID. The exclusion now only applies when the providerID matches the model family (e.g.,deepseekprovider withdeepseekmodel). Custom providers with different providerIDs (likemy-provider/deepseek-v4-pro) are no longer excluded and correctly getWIDELY_SUPPORTED_EFFORTSvariants.Tests
Added 5 new test cases covering custom providers with deepseek, minimax, glm, qwen, and kimi model IDs. All 153 tests pass (150 existing + 3 new variant tests).
How did you verify your code works?
bun test test/provider/transform.test.ts— 153 pass, 0 fail{}(providerID matches model family)["low", "medium", "high"]variantsScreenshots / recordings
N/A
Checklist