Why temperature and top_p now return HTTP 400 on newer Claude models
Source: Anthropic model deprecations. Last verified 6 October 2026. Dates come from the provider's page; if it disagrees with this page, the provider is right.
| What | Where | Effect |
|---|---|---|
temperature, top_p, top_k | Requests to Claude 4.7 and later models | Request rejected with HTTP 400 |
anthropic | Python SDK v1.0 and later | The parameters were removed from the SDK |
According to Anthropic's deprecation documentation, Claude models from 4.7 onward reject the sampling parameters temperature, top_p and top_k with an HTTP 400 error, and version 1.0 of the Anthropic Python SDK removed them. Code that worked on an older model can fail the moment you change the model ID, even though nothing else changed.
Why this one is easy to miss
Most deprecation tooling works at the package level. Renovate and Dependabot tell you a newer SDK exists; they don't look at the arguments you pass to it. This break lives at the call site: a keyword argument in a request, a key in a YAML prompt config, or a default set by a wrapper function your team wrote years ago. It also only appears when two things change together, the model and the parameter, which is exactly what happens during a migration like the Claude Sonnet 4.5 retirement.
How to find the calls
Start broad, then narrow. This search lists files that mention any of the three parameters:
rg -n -w "temperature|top_p|top_k" \
--type-add 'cfg:*.{yaml,yml,toml,json}' -t py -t ts -t js -t cfg \
--glob '!node_modules' --glob '!vendor'That will be noisy: these names are common in machine-learning code that has nothing to do with Claude. Narrow it to files that also call Anthropic:
rg -l -i "anthropic|claude" | xargs rg -n -w "temperature|top_p|top_k"Then review each hit by hand. The places that matter most:
- Direct SDK calls that pass the parameters as keyword arguments.
- Shared request builders, such as a helper that fills in “sensible defaults” for every model call. One default there affects every caller.
- Prompt or model config files (YAML, JSON, TOML) where a parameter sits next to the model name.
- Third-party wrappers. If you call Claude through a framework or gateway, check whether it sends a default sampling value on your behalf. Its documentation or changelog should say.
What to do about it
- For requests to Claude 4.7 and later models, stop sending the three parameters.
- If you upgrade the Python SDK to v1.0 or later, expect code that passes them to need changes, and run your tests before deploying.
- If a code path serves both older and newer models, make the parameters conditional on the model, and delete the branch once the older model is retired.
- Check Anthropic's documentation for how to control output on newer models. We don't paraphrase that advice here, because it belongs to the provider and may change.
Prevent it next time
Keep model IDs and their request options together in one config module, so a model change and a parameter change land in the same pull request. See keeping model IDs in one place. And before swapping models, run a small evaluation set, which catches a 400 error at once.