fix(providers): omit temperature for Claude Opus/Sonnet 4.6+#1180
Open
ojusave wants to merge 1 commit into
Open
fix(providers): omit temperature for Claude Opus/Sonnet 4.6+#1180ojusave wants to merge 1 commit into
ojusave wants to merge 1 commit into
Conversation
Anthropic returns HTTP 400 when temperature is sent to claude-opus-4-6, claude-sonnet-4-6, and newer 4.x models. Agent summoning and chat both hardcode temperature; skip the field for affected model IDs.
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.
Anthropic returns HTTP 400 when
temperatureis sent toclaude-opus-4-6,claude-sonnet-4-6, and newer 4.x models. Agent summoning and chat both hardcode temperature; skip the field for affected model IDs.Summary
Omit
temperaturefrom Anthropic Messages API request bodies when the model is Claude Opus/Sonnet 4.6 or newer. Summoning (temperature: 0.7insummoner_regenerate.go) and chat paths both flow throughbuildRequestBody; filtering at the provider adapter fixes both without changing every call site.Type
main)Target Branch
devChecklist
go build ./...passesgo build -tags sqliteonly ./...passes (if Go changes)go vet ./...passesgo test -race ./...cd ui/web && pnpm build(if UI changes) — N/A, no UI changes$1,$2(no string concat) — N/A, no SQL changesinternal/upgrade/version.go(if new migration) — N/A, no migrationTest Plan
TestAnthropicAdapterToRequest_SkipsTemperatureForClaude46: assertstemperatureis omitted forclaude-opus-4-6,claude-sonnet-4-6, andclaude-opus-4-7-*, and still sent forclaude-sonnet-4-5-20250929.go build ./...,go build -tags sqliteonly ./...,go vet ./..., andgo test -race ./...locally; all pass.claude-opus-4-6returned Anthropic 400 (temperature is deprecated for this model). Post-fix: request omitstemperatureand summoning succeeds.