AI

Claude Opus 5 returns 400 on temperature. What to do

By · Fri Aug 21 2026 · 6 min read · 0 views

View as a Web Story

AI#anthropic#llm#migration#claude#api

Claude Opus 5 API request parameters that now return a 400 error

Claude Opus 5 returns 400 on temperature. What to do

Set temperature=0.7 on Claude Opus 5 and the request fails. The API returns a 400 error, not a warning and not a silently ignored parameter. The same happens with top_p, top_k, and with the manual thinking budget that older code sets on every call.

This is not a bug in your SDK. Anthropic's model migration guide states that setting temperature, top_p or top_k to any non-default value on Claude Opus 4.7 or later returns a 400 error. Later includes Opus 4.8, Opus 5, Fable 5 and Mythos 5.

What exactly returns a 400

Claude Opus 5 is Anthropic's current flagship model in the Claude family, and it inherits the parameter rules introduced with Claude Opus 4.7. Four request fields now fail outright, according to Anthropic's parameter rules.

Field Old behaviour (Opus 4.6 and earlier) On Opus 4.7 and later
temperature Accepted, 0.0 to 1.0 400 error on any non-default value
top_p Accepted 400 error on any non-default value
top_k Accepted 400 error on any non-default value
thinking.budget_tokens Set the extended thinking budget 400 error, adaptive thinking is always on

The failure is loud. That is the good news. A 400 in staging is cheaper than a silent change in production. The bad news is where these fields hide. They live in a shared client wrapper, in a config file, or in a framework default nobody has read in a year.

The migration, field by field

Delete the sampling parameters. There is no replacement value to pass. Passing the documented default is still the wrong instinct. Anthropic's sampling guidance says to omit all three fields and steer the model with the prompt instead.

Failing call:

client.messages.create(
    model="claude-opus-5",
    temperature=0.7,
    messages=[{"role": "user", "content": "..."}],
)

Working call:

client.messages.create(
    model="claude-opus-5",
    messages=[{"role": "user", "content": "..."}],
)

Manual thinking budgets need a real translation, not a deletion. Adaptive thinking is Anthropic's replacement: the model decides how long to think on each request. Depth is set by effort, which takes low, medium, high, xhigh or max.

Old shape, a token budget:

thinking={"type": "enabled", "budget_tokens": 10000}

New shape, an effort level:

Advertisement

thinking={"type": "adaptive"}
output_config={"effort": "high"}

budget_tokens has no numeric equivalent. Anyone whose cost model assumed a hard thinking ceiling is now estimating rather than capping. That is a planning change, not just a code change.

The tokenizer change nobody gets a 400 for

A tokenizer is the component that splits text into the units an API bills for. Claude Opus 4.7 shipped a new one, and Opus 4.8, Opus 5, Fable 5 and Mythos 5 all use it. The same content can produce roughly 30% more tokens than on earlier models, varying by workload, according to Anthropic's tokenizer note. Images move further: up to 4,784 tokens each, against roughly 1,600 before.

Two consequences follow, and neither raises an error.

  • Cost. A prompt costs about a third more per call on Opus 5 than on Opus 4.6, at the same per-token price. Nothing changed but the counting.
  • Truncation. A max_tokens value tuned on the old tokenizer now leaves less headroom. Long outputs get cut off, and that reads like a model regression.

The methodology for re-budgeting takes an afternoon. Run your ten most common prompts through the token counting endpoint on the new model. Compare each against the old count. Reset max_tokens from your measured ratio, not from the headline 30%.

Why this breaks on Bedrock even when your code is clean

Wrapper libraries are where this migration goes wrong. A wrapper that injects a default temperature for every provider will 400 on Claude Opus 5 no matter how careful your own call site is.

That is not hypothetical. An open issue filed in August 2026 reports Opus 4.7 and 4.8 returning 400 on the Amazon Bedrock Converse path, with a "temperature is deprecated" message. The library's guard against sampling parameters was never applied to the Bedrock adapter. The application code passed nothing. The adapter did. Amazon Bedrock is AWS's managed API for third-party models, including Claude.

Audit for injected defaults before you blame the model:

rg -n "temperature|top_p|top_k|budget_tokens" --glob '!node_modules'

Check three places. Your own client wrapper comes first. Then any agent framework in the dependency tree. Then the gateway layer, such as an internal router that normalises requests across providers. For example, a router that sets a house default of temperature=0.2 will break every Opus 5 call in the building.

Should you move to Opus 5 now, or stay put?

Move, but stage it. The parameters are gone on every model from Opus 4.7 forward. Staying on Opus 4.6 only postpones the same work, on an older model, per Anthropic's model documentation.

A sane order of operations looks like this.

  1. Strip the sampling parameters first. They are ignored-by-omission on older models too, so this change is safe to ship before you switch models.
  2. Replace thinking budgets with effort. Pick a level per workload and record why, because you will not get the old numeric control back.
  3. Re-measure token counts. Do this before the switch, not after the invoice.
  4. Switch models, then watch truncation. Output cut-offs are the most common post-migration symptom, and they look like quality problems rather than budget problems.

Some features do depend on high-temperature sampling for variety, such as a copy generator that must not repeat itself. That behaviour now has to come from the prompt. It is a real loss, and worth naming plainly. The model decides its own sampling, and you steer with words.

What this says about API stability generally

Anthropic removed the knobs instead of deprecating them softly. That is now a scheduling fact for anyone building on frontier models. Parameters can vanish between model generations. The migration cost lands on whoever owns the wrapper.

The defence is boring. Keep provider-specific request shaping in one file. Log the exact request body in staging. Treat the cheapest AI API as the one that is cheapest to run, not the one with the lowest headline rate. Sonnet 5's September price rise is cancelled, which moves the arithmetic again. None of that arithmetic holds if your token counts rose 30% unnoticed.

Advertisement

FAQ

Why does Claude Opus 5 return a 400 error for temperature?

Anthropic removed the `temperature`, `top_p` and `top_k` sampling parameters starting with Claude Opus 4.7. Setting any of them to a non-default value on Opus 4.7, Opus 4.8, Opus 5, Fable 5 or Mythos 5 returns a 400 error. The fix is to omit the parameters from the request entirely.

What replaces budget_tokens for extended thinking on Claude Opus 5?

Nothing numeric replaces it. Adaptive thinking is always on, and the depth control is the `effort` parameter, which takes `low`, `medium`, `high`, `xhigh` or `max`. Passing `thinking.budget_tokens` on Opus 4.7 or later returns a 400 error.

Does Claude Opus 5 cost more per token than Opus 4.6?

The relevant change is counting, not pricing. Opus 4.7 introduced a tokenizer that can produce roughly 30% more tokens for the same content, and Opus 5 uses it too. Identical prompts therefore bill higher even at an unchanged per-token rate.

How do I find code that still sends temperature to Claude?

Grep the repository for `temperature`, `top_p`, `top_k` and `budget_tokens`, then check three layers: your own client wrapper, any agent framework in the dependency tree, and any proxy or gateway that normalises requests. Injected defaults in a wrapper are the most common cause.

Comments

Loading…

Sign in to join the conversation.

Related posts

Amazon Bedrock prompt caching write and read pricing multipliers

Bedrock cache writes ate 85 percent of one AI bill

Prompt caching is sold as a saving. It can also be the single largest line on an inference invoice, and the failure is quiet, because a cache write succeeds whether or not anything ever reads it back.

Fri Aug 21 2026 · 6 min read · 0 views

AI

We use cookies for ads and analytics.what this means.