Bug summary
When a custom (BYOK) provider is configured in ~/.commandcode/providers.json with reasoningEfforts on a model, selecting a reasoning effort (via /model, or --effort) never sends reasoning_effort in the request body. Upstream logs show no effort parameter. The same model + effort configured in opencode sends reasoning_effort correctly.
Environment
Reproduction
providers.json:
{
"provider": {
"effcap": {
"baseURL": "http://127.0.0.1:18999/v1",
"apiKey": false,
"models": {
"gpt-6-astra": {
"contextWindow": 272000,
"reasoningEfforts": ["low", "medium", "high", "xhigh", "max"]
}
}
}
}
}
command-code -p "hi" --model effcap/gpt-6-astra --effort high --local-only --max-turns 1 -t
- Output prints
Reasoning effort set to high for effcap/gpt-6-astra. but the captured request body does not contain reasoning_effort:
{"model": "gpt-6-astra", "max_tokens": 32000, "stream": true, ...}
Root cause (from dist/cli.mjs)
For BYOK providers the thinking hook is:
function thinkingHook(e){return({model,effort})=>{
if(!effort||"off"===effort)return;
const spec=e.specs.find(s=>s.id===model);
return (spec?.reasoningEfforts??[]).includes(effort)
? "anthropic"===e.wire?{anthropic:{effort}}
: "openai"===e.wire?{openai:{reasoningEffort}}
: {[e.providerId]:{reasoning_effort:effort}}
: void 0
}}
toModelSpec builds specs with bare model ids (id: r.id, e.g. gpt-6-astra).
- The model passed to the hook is provider-qualified (
effcap/gpt-6-astra / zehua/gpt-6-astra).
specs.find(s => s.id === model) never matches → hook returns undefined → no providerOptions → reasoning_effort absent.
Workaround found
Adding model-level "options": {"reasoning_effort": "xhigh"} in providers.json works — it is merged into every request body. But it fixes the effort per model and ignores the session effort selection.
Expected
The declared reasoningEfforts + selected session effort should be transmitted (as reasoning_effort) for openai-compatible BYOK providers, e.g. by matching the provider-qualified model id (strip ${providerId}/ before the spec lookup).
Bug summary
When a custom (BYOK) provider is configured in
~/.commandcode/providers.jsonwithreasoningEffortson a model, selecting a reasoning effort (via/model, or--effort) never sendsreasoning_effortin the request body. Upstream logs show no effort parameter. The same model + effort configured in opencode sendsreasoning_effortcorrectly.Environment
Reproduction
providers.json:{ "provider": { "effcap": { "baseURL": "http://127.0.0.1:18999/v1", "apiKey": false, "models": { "gpt-6-astra": { "contextWindow": 272000, "reasoningEfforts": ["low", "medium", "high", "xhigh", "max"] } } } } }command-code -p "hi" --model effcap/gpt-6-astra --effort high --local-only --max-turns 1 -tReasoning effort set to high for effcap/gpt-6-astra.but the captured request body does not containreasoning_effort:{"model": "gpt-6-astra", "max_tokens": 32000, "stream": true, ...}Root cause (from dist/cli.mjs)
For BYOK providers the thinking hook is:
toModelSpecbuilds specs with bare model ids (id: r.id, e.g.gpt-6-astra).effcap/gpt-6-astra/zehua/gpt-6-astra).specs.find(s => s.id === model)never matches → hook returnsundefined→ noproviderOptions→reasoning_effortabsent.Workaround found
Adding model-level
"options": {"reasoning_effort": "xhigh"}inproviders.jsonworks — it is merged into every request body. But it fixes the effort per model and ignores the session effort selection.Expected
The declared
reasoningEfforts+ selected session effort should be transmitted (asreasoning_effort) for openai-compatible BYOK providers, e.g. by matching the provider-qualified model id (strip${providerId}/before the spec lookup).