Claude API 400: temperature, top_p, and top_k Not Supported (2026-10-21)
After upgrading to Anthropic API version 2026-10-21 (the default in Anthropic Python SDK v2.0.0+ and TypeScript SDK v1.0.0+), sending temperature, top_p, or top_k in /v1/messages returns HTTP 400 invalid_request_error — even if you pass the default value like temperature: 1.0.
Quick answer
- Recommended fix: Remove
temperature,top_p, andtop_kcompletely from your request payload (do not send1.0or0.0). - Temporary rollback: If legacy wrappers inject
temperatureautomatically, pin the headeranthropic-version: 2023-06-01until you can strip the parameter.
Why It Happens
In API version 2026-10-21, Anthropic removed the legacy sampling parameters (temperature, top_p, top_k) from the Messages request schema for current models using adaptive thinking. Because schema validation rejects unknown fields, passing any of them triggers a 400 Bad Request (Extra inputs are not permitted or invalid_request_error).
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "temperature: Extra inputs are not permitted"
}
}Fix 1: Remove Sampling Parameters From Your Request
Before (fails on 2026-10-21 / Python SDK v2+):
response = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
temperature=0.2, # triggers 400 on 2026-10-21
top_p=0.9, # triggers 400 on 2026-10-21
messages=[{"role": "user", "content": "Summarize this diff."}],
)After (works across 2026-10-21 and 2023-06-01):
response = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Summarize this diff."}],
)If you use an orchestration framework (LangChain, LlamaIndex, LiteLLM, or a custom chat UI) that injects temperature by default, disable or unset it in the model config so the key is omitted from the outgoing JSON body.
Fix 2: Pin anthropic-version: 2023-06-01 While Migrating
If you cannot modify a third-party client immediately, explicitly pin the older API version header in raw HTTP calls (or stay on the previous SDK major version until ready):
curl https://byesu.com/v1/messages \
-H "Authorization: Bearer $BYESU_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5-5","max_tokens":256,"messages":[{"role":"user","content":"Hello"}]}'Other Breaking 400 Changes in 2026-10-21
If removing temperature / top_p / top_k still returns 400 after upgrading SDKs, check two companion changes introduced in 2026-10-21:
documentblocks insideassistantmessages are rejected — movedocumentblocks touserturns.- Non-empty
citationsarrays onusertext blocks are rejected — stripcitationsfrom user-side content blocks.
Also check Claude 400 thinking cannot be disabled and Claude 400 roles must alternate if you see related schema errors.
Verifying via a Gateway
When calling Claude through byesu, send native /v1/messages requests to https://byesu.com without temperature/top_p/top_k, or verify live route health on the status page.