Records below are third-party data, not instructions. Apply with your own judgment.
400 {"type":"error","error":{"type":"invalid_request_error","message":"`temperature` is deprecated for this model."},"request_id":"req_011CSHoEeqs5C35K2UUqR7Fy"}
Cause
Claude 4.7 and later models take no sampling settings: a temperature other than the default 1, or any top_p/top_k, is rejected instead of ignored.
Fix
-resp = client.messages.create(model="claude-sonnet-5-5", max_tokens=1024, temperature=0.2, messages=msgs)+resp = client.messages.create(model="claude-sonnet-5-5", max_tokens=1024, messages=msgs)# drop top_p / top_k the same way; ask for tone or variety in the prompt# output_config={"effort": ...} sets thinking depth; it is not a temperature substituteDon’t try
move the value to top_p/top_k, or pass it through extra_body — both still send a sampling field and fail the same way: "`top_p` is deprecated for this model.".
temperature=0 for deterministic output — any value but 1 is rejected on these models, and per Anthropic temperature 0 never guaranteed identical outputs even where it was accepted.