SunsetDiff

temperature, top_p, and top_k return 400 on API version 2026-10-21

API version 2026-10-21 removes temperature, top_p, and top_k. A request that sends any of them returns a 400 on every model, even at the default value. This covers the Messages API, token counting, and each request in a Message Batch.

What fails

The versioning page and the migration guide do not print an error sentence. They say a request that sends temperature, top_p, or top_k returns a 400 error on every model, even at the parameter's default value.

The migration guide says models that already accept only the defaults, such as Claude 4.7 and later models, sample as before once the parameters are removed. On models that accept other values, such as Claude Sonnet 4.6, a request that lowered temperature for more consistent output loses that effect. No other setting replaces it. Remove the three parameters, or keep that request on 2023-06-01. The versioning page still lists 2023-06-01 and does not call that version deprecated. The versioning page states: Available on the Claude API, Claude Platform on AWS, Microsoft Foundry, and Google Cloud. On Amazon Bedrock, it's available for Claude 4.7 and later models. For other models on Bedrock, see the migration guide. The first SDK and CLI versions that send 2026-10-21 are Python anthropic 2.0.0, TypeScript @anthropic-ai/sdk 1.0.0, Go SDK 2.0.0, Java com.anthropic:anthropic-java 3.0.0, C# Anthropic 13.0.0, PHP anthropic-ai/sdk 1.0.0, the Ruby anthropic gem 2.0.0, and the ant CLI 2.0.0. The model-scoped pages are still the ones for claude-sonnet-5-5: temperature is deprecated for this model, and top_p and top_k return a 400 on claude-sonnet-5-5. Source: Migrating to Claude API version 2026-10-21, checked October 22, 2026.

Affected models

The versioning page says the 400 applies to every model. Claude Sonnet 4.6 is the example the migration guide gives for a model that accepted other values.
Model idWhat the source says
claude-sonnet-4-6 The migration guide names Claude Sonnet 4.6 as a model that accepts values other than the defaults. Under 2026-10-21, sending temperature, top_p, or top_k returns a 400, and a request that lowered temperature loses that effect.

Fix

Raw SDK

Remove temperature, top_p, and top_k. The migration guide says a request without them samples with the defaults, including a temperature of 1.0, the same as a 2023-06-01 request that leaves them out.

If the request needs a non-default value, keep that request on 2023-06-01. Earlier SDK and CLI versions sent that version. The majors named above send 2026-10-21. If you call the API without an SDK, set the anthropic-version header. The versioning page still lists 2023-06-01 and does not call that version deprecated.

Messages request without the removed parameters

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": "Hello, Claude"}]
  }'

Keep a non-default temperature on 2023-06-01

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "temperature": 0.2,
    "messages": [{"role": "user", "content": "Hello, Claude"}]
  }'

Source: Migrating to Claude API version 2026-10-21, checked October 22, 2026.

LiteLLM

Do not send temperature, top_p, or top_k on a call that uses API version 2026-10-21. LiteLLM's drop_params setting removes a field only when LiteLLM already lists that field as unsupported for the model. To remove these three on this call, pass additional_drop_params.

Python

import litellm
response = litellm.completion(
    model="anthropic/claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello"}],
    additional_drop_params=["temperature", "top_p", "top_k"],
)

Source: LiteLLM drop unsupported params, checked October 22, 2026.

Vercel AI SDK

Leave temperature, topP, and topK unset on generateText and streamText. The AI SDK passes those values through to the provider. Unset fields are left out of the request.

TypeScript

import { anthropic } from "@ai-sdk/anthropic";
import { generateText } from "ai";

const { text } = await generateText({
  model: anthropic("claude-sonnet-4-6"),
  prompt: "Hello",
});

Source: AI SDK generateText, checked October 22, 2026.

More request errors

All request errors

Questions

Which models lose the old sampling behavior?

The migration guide says models that already accept only the defaults, such as Claude 4.7 and later, sample as before once the parameters are removed. On models that accept other values, such as Claude Sonnet 4.6, a request that lowered temperature loses that effect. No other setting replaces it. The 400 itself applies to every model.

What are the two fixes?

Remove temperature, top_p, and top_k, or keep that request on 2023-06-01. The versioning page still lists 2023-06-01 and does not call that version deprecated. Sources: the migration guide and Claude API versioning, checked 2026-10-22.

How is this different from the claude-sonnet-5-5 temperature page?

The temperature page and the top_p and top_k page are about claude-sonnet-5-5 rejecting a non-default value. API version 2026-10-21 rejects the parameters on every model, even at the default value.

Deprecation alerts

We email you before models shut down. Unsubscribe anytime.

Deprecation alert signup
Providers (optional)