Skip to content

fix: stop sending temperature to Anthropic models that reject it#19

Merged
msitarzewski merged 1 commit into
mainfrom
fix/anthropic-temperature-deprecated
Jun 22, 2026
Merged

fix: stop sending temperature to Anthropic models that reject it#19
msitarzewski merged 1 commit into
mainfrom
fix/anthropic-temperature-deprecated

Conversation

@msitarzewski

Copy link
Copy Markdown
Owner

The bug

Consensus runs using Opus 4.8 / 4.7 400'd with:

[anthropic] Error code: 400 — 'temperature' is deprecated for this model.

Anthropic's newest thinking models deprecated temperature; AnthropicProvider sent it unconditionally. (Older models — Opus 4.6, Sonnet, Haiku — still accept it.)

Root cause

When Opus 4.8/4.7 were added to the catalog, I probed OpenAI temperature support but not Anthropic — even though the truefoundry data showed removeParams: temperature for them. So it slipped through.

Fix

  • New ANTHROPIC_NO_TEMPERATURE_MODELS set (verified empirically against the live API) gates temperature in both send() and stream() — mirrors the existing OpenAI NO_TEMPERATURE_MODELS pattern.
  • scripts/refresh_catalog.py now also probes Anthropic temperature, so the set stays maintained and this can't recur silently.
  • Fixes a test-isolation bug in the Cloudflare config tests (now that CLOUDFLARE_* are in .env, load_dotenv repopulates deleted vars — use empty strings instead).

Empirical results (live API)

Model temperature
Opus 4.8, 4.7 rejects
Opus 4.6, Sonnet 4.6/4.5, Haiku 4.5 accepts

Validation

  • Live: AnthropicProvider.send to Opus 4.8 now succeeds (both send + stream paths covered by tests).
  • 1675 tests pass (3 new), mypy clean (63 files), ruff clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EkrekgzMAQko92UkjnXhHL

Anthropic's newest thinking models (Opus 4.8, 4.7) deprecated the
`temperature` param and return a 400 ("`temperature` is deprecated for
this model"). The provider sent it unconditionally, breaking any consensus
run that used those models. Older models (Opus 4.6, Sonnet, Haiku) still
accept temperature.

Mirrors the existing OpenAI NO_TEMPERATURE_MODELS approach: a new
ANTHROPIC_NO_TEMPERATURE_MODELS set (verified empirically against the live
API) gates the param in both send() and stream().

Also extends scripts/refresh_catalog.py to probe Anthropic temperature
support (it only probed OpenAI before — which is why this slipped when
Opus 4.8/4.7 were added), so the set stays maintained.

Fixes a test-isolation issue in the Cloudflare config tests exposed once
CLOUDFLARE_* vars are present in .env (load_dotenv repopulates deleted
vars; use empty strings instead).

Verified live: Opus 4.8 send/stream now succeed. 1675 tests pass,
mypy + ruff clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EkrekgzMAQko92UkjnXhHL
@msitarzewski msitarzewski merged commit 537d0a0 into main Jun 22, 2026
3 checks passed
@msitarzewski msitarzewski deleted the fix/anthropic-temperature-deprecated branch June 22, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant