Repository navigation
feat: declare temperature support for models that list it - #47
Conversation
OpenCode sends a sampling temperature (its own per-model default, or one set on the agent) only for models flagged as supporting it. The plugin never set the flag, so every discovered model ended up unflagged and the user's temperature was silently ignored, even for models whose /v1/model/info lists `temperature` in `supported_openai_params`. Declare `temperature` when `supported_openai_params` lists it, on both the OpenCode 1 config entry and the OpenCode 2 `capabilities`. When the parameter is not listed, or /v1/model/info is unavailable, the field is left unset so behavior is unchanged (some deployments, such as reasoning-only endpoints or guardrail classifiers, reject it). The cached entry shape gains a field, so CACHE_VERSION moves to 6 and older caches are rediscovered.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
yuseferi
left a comment
There was a problem hiding this comment.
Looks good, thanks for the clear write-up and the before/after checks on both OpenCode 1 and 2.
Checked:
temperatureis set only whensupported_openai_paramslists it, and is left unset (neverfalse) otherwise. This holds on both the OpenCode 1 config entry andcapabilities.temperatureon OpenCode 2.- The
CACHE_VERSIONbump to 6 is needed, since the cache stores the built config entries. - The tests cover the listed / not-listed /
null/ missing-/v1/model/infocases.
Notes for the release, no changes needed:
- Users will notice this. LiteLLM lists
temperaturefor nearly every model, so OpenCode's per-family defaults (Gemini/GLM/MiniMax 1.0, Kimi 0.6, Qwen 0.55) and any agent-leveltemperaturewill now reach most models. The release notes should say so. - Possible follow-up: a way to opt a single model out (e.g. through
modelCapabilities) for proxies whosesupported_openai_paramsliststemperaturefor a deployment that actually rejects it.
# [1.8.0](v1.7.1...v1.8.0) (2026-10-26) ### Features * declare temperature support for models that list it ([#47](#47)) ([f68252f](f68252f))
Summary
OpenCode sends a sampling temperature (its own per-model default, or one set on the agent) only for models flagged as supporting it. The plugin never set the flag, so every discovered model ended up unflagged and the user's temperature was silently ignored, even for models whose
/v1/model/infoliststemperatureinsupported_openai_params. This declarestemperaturefor exactly those models, on both OpenCode 1 (config entry) and OpenCode 2 (capabilities.temperature). When the parameter is not listed, or/v1/model/infois unavailable, the field stays unset, so behavior is unchanged for everything else (some deployments, such as reasoning-only endpoints or guardrail classifiers, reject the parameter outright).Type of change
Checklist
npm run typecheckpassesCHANGELOG.mdupdated under## [Unreleased](not touched: the file is generated by semantic-release from the commit message)Notes for review
/v1/model/infoliststemperatureinsupported_openai_params: the agent's temperature (if set) and OpenCode's per-family defaults (for example gemini 1, glm 1, kimi 0.6, minimax 1) now reach the model. Before, OpenCode never sent a temperature for these models, because the flag was never set. Models that do not list the parameter are unchanged.CACHE_VERSIONmoves from 5 to 6: cached entries gain a field, so older caches are rediscovered instead of serving models without the flag. Each user rediscovers once after upgrading.true; it is never set tofalse, so "unknown" stays unknown.false/unset, OpenCode never sendstemperature, even when the agent config sets one (0.3 in the probe); withtrue, it sends it. This was checked by capturing the request body against a local OpenAI-compatible server.How was this tested?
npm test: 161 passed (157 before; 4 new). Two of the new tests fail when the source change is reverted:toConfigModeldeclarestemperatureonly when listed (and leaves it unset when not listed or when/v1/model/infois unavailable), and the OpenCode 2 provider transform registerscapabilities.temperature: trueonly for models that list it.temperature: before,capabilities.temperaturewasfalseon all 6 on OpenCode 1.19.3 and unset on OpenCode 2.1.0; after, it istrueon all 6 on both (checked withopencode models --verboseon OpenCode 1 and/api/modelon OpenCode 2).Summary by CodeRabbit
New Features
temperatureparameter.Bug Fixes
Documentation