Skip to content

fix: allow custom providers to switch reasoning effort for proxied models#148

Closed
weiconghe wants to merge 6 commits into
XiaomiMiMo:mainfrom
weiconghe:fix/custom-provider-variants
Closed

fix: allow custom providers to switch reasoning effort for proxied models#148
weiconghe wants to merge 6 commits into
XiaomiMiMo:mainfrom
weiconghe:fix/custom-provider-variants

Conversation

@weiconghe

Copy link
Copy Markdown

Issue for this PR

Closes #68

Type of change

  • Bug fix

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 return WIDELY_SUPPORTED_EFFORTS variants, but it is never reached because the id check returns early.

Impact

When a user configures a custom provider in mimocode.json with a model like deepseek-v4-pro and sets reasoning: 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., deepseek provider with deepseek model). Custom providers with different providerIDs (like my-provider/deepseek-v4-pro) are no longer excluded and correctly get WIDELY_SUPPORTED_EFFORTS variants.

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?

  • Ran bun test test/provider/transform.test.ts — 153 pass, 0 fail
  • Verified existing tests for built-in deepseek/minimax/glm providers still return {} (providerID matches model family)
  • Verified new tests for custom providers return ["low", "medium", "high"] variants

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

qiaozongming and others added 6 commits June 11, 2026 01:23
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
@qiaozongming

Copy link
Copy Markdown
Collaborator

#951

@qiaozongming

Copy link
Copy Markdown
Collaborator

#1110

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.

使用mimocode.json配置自定义的provider后,无法切换该模型的variant

5 participants