-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Bug Description
When configuring an agent with a specific variant (e.g., xhigh for reasoning effort), the variant is incorrectly applied to all models used by that agent, not just the model it was configured for. This causes API errors when switching to models that don't support the variant parameter.
Steps to Reproduce
- Configure an agent with a model and variant:
{ "agent": { "plan": { "model": "openai/gpt-5.2", "variant": "xhigh" } } } - Use the agent with its configured model (works fine)
- Switch to a different model (e.g.,
opencode/kimi-k2.5-free) while still using the same agent - The variant
xhighis still sent to the API, causing:Extra inputs are not permitted, field: 'variant', value: 'xhigh'
Expected Behavior
The variant should only be applied when using the specific model it was configured for. When switching to a different model, the variant should not be sent.
Root Cause
The variant field is currently treated as an unknown key and gets merged into agent.options, which is then passed to all API calls regardless of which model is actually being used.
Environment
- OpenCode version: latest
- Provider: OpenAI-compatible (opencode/zen)
- Model: kimi-k2.5-free (and other non-OpenAI models)
Related
This issue affects any OpenAI-compatible provider that doesn't support the variant parameter, including Kimi, GLM, and other models accessed through the opencode provider.