fix: respect supportsTemperature flag in OpenAI-compatible providers#12164
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: respect supportsTemperature flag in OpenAI-compatible providers#12164roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
When models like Claude Opus 4.7 are proxied through OpenAI-compatible gateways, sending the temperature parameter causes a 400 error because the model has deprecated it. This change: - Uses the existing supportsTemperature ModelInfo field in model-params.ts to omit temperature when supportsTemperature === false - Adds the same guard in OpenAiHandler, BaseOpenAiCompatibleProvider, and OpenAICompatibleHandler - Adds a "Supports Temperature" checkbox in the OpenAI Compatible settings UI so users can toggle it off for models that need it - Adds test coverage for the new behavior Closes #12162
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.
Related GitHub Issue
Closes: #12162
Description
This PR attempts to address Issue #12162. When models like Claude Opus 4.7 are proxied through OpenAI-compatible gateways (e.g. LiteLLM/Bedrock), sending the
temperatureparameter causes a400 BadRequestErrorbecause the model has deprecated it.Changes:
src/api/transform/model-params.ts: Uses the existingsupportsTemperaturefield fromModelInfoto omit temperature whensupportsTemperature === falsein both theopenaiandopenrouterformat branches. This replaces the TODO comments that were there before.src/api/providers/openai.ts(OpenAiHandler): Guards the temperature parameter increateMessage()streaming path withsupportsTemperature !== false.src/api/providers/base-openai-compatible-provider.ts(BaseOpenAiCompatibleProvider): Guards temperature increateStream()with the same check.src/api/providers/openai-compatible.ts(OpenAICompatibleHandler): Guards temperature in bothcreateMessage()andcompletePrompt().webview-ui/src/components/settings/providers/OpenAICompatible.tsx: Adds a "Supports Temperature" checkbox so users can explicitly mark models that do not support temperature.webview-ui/src/i18n/locales/en/settings.json: Adds translation keys for the new checkbox.src/api/transform/__tests__/model-params.spec.ts: Adds 6 new tests covering thesupportsTemperaturebehavior for openai, openrouter formats, and backwards compatibility with existing o1/o3-mini hardcoded checks.Test Procedure
model-params.spec.tspass (including 6 new ones)base-openai-compatible-provider.spec.tspassOpenAICompatible.spec.tsxpassTo manually verify:
claude-opus-4-7temperaturein the requestPre-Submission Checklist
Feedback and guidance are welcome.
Interactively review PR in Roo Code Cloud