The words “Claude API” beside diagonal rows of cobalt-blue posts on sunlit limestone. Three empty sockets interrupt one row.
All posts

Claude API: "temperature is deprecated for this model"

Fix the Claude API 400 by omitting temperature, top_p, and top_k. The Anthropic API version determines whether even default values are rejected.

Your Claude call returns HTTP 400: `temperature` is deprecated for this model. You remove temperature from the call site and get the same error. Look at the JSON the client sends. A shared configuration can still add "temperature": 1 when it builds the request, and on Anthropic's newer API version even that default value is enough to reject it.

The API version determines whether defaults are accepted

On 2023-06-01, Claude Sonnet 4.6 can use temperature: 0.2. Claude 4.7 and later models, as well as Claude Mythos Preview, reject non-default sampling values on earlier API versions. Starting with 2026-10-21, Anthropic removed temperature, top_p, and top_k from Messages and Message Batches. Even Sonnet 4.6 rejects temperature: 1 on that version.

Check the version header before changing the model. Anthropic's SDKs set the header for you, so an SDK upgrade can change which fields the API accepts without any change to your model ID. Pinning a model ID controls which model you request; it does not pin the API version.

The similarly worded OpenAI temperature error can depend on the model's reasoning setting. That troubleshooting advice does not carry over to Anthropic's 2026-10-21 API: the sampling fields were removed from the request format.

The Claude request builder should leave the fields out

On 2026-10-21, delete the keys from the outgoing JSON. Here's a request for the same Sonnet 4.6 model without the three fields. Set ANTHROPIC_API_KEY in your environment before running it.

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2026-10-21" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Summarize: The billing export runs every Friday."}]
  }'

If your client builds the JSON by merging shared defaults with per-call settings, strip the fields after the merge. For Message Batches, inspect each requests[].params object: deleting a key from the outer body won't remove it from a batch item. If several providers share the same defaults, make the change in the Anthropic request builder, where you know the version and model being called.

Older models can lose a sampling setting they actually used

On a model that already accepted only the defaults, omission leaves sampling behavior as it was. A Sonnet 4.6 request that relied on temperature: 0.2 goes back to 1.0 after the migration. Anthropic documents staying on 2023-06-01 as an option for a request that still relies on a supported non-default value. That won't restore the control on a model that already rejects it.

If you move that workload to the new version, Anthropic recommends using instructions and examples to guide the reply. For a support bot, a prompt can spell out when to hand an ambiguous ticket to a person and show one ticket that merits a hand-off.

I'd replay the ambiguous tickets before switching traffic. If the bot runs on an AIVAX AI Gateway, one Agentic Test can walk through a ticket with no account ID and check that the bot asks for it before trying to route the ticket.