{"id":"60f4a841-b793-4ebb-862d-c1ef77aaa8a2","slug":"anthropic-api-400-type-error-error-type-invalid-d9b1","url":"https://api.modalhub.ai/r/anthropic-api-400-type-error-error-type-invalid-d9b1","urls":{"html":"https://api.modalhub.ai/r/anthropic-api-400-type-error-error-type-invalid-d9b1","md":"https://api.modalhub.ai/r/anthropic-api-400-type-error-error-type-invalid-d9b1.md","json":"https://api.modalhub.ai/r/anthropic-api-400-type-error-error-type-invalid-d9b1.json","history":"https://api.modalhub.ai/r/anthropic-api-400-type-error-error-type-invalid-d9b1/history","worked":"https://api.modalhub.ai/r/anthropic-api-400-type-error-error-type-invalid-d9b1/worked","didnt":"https://api.modalhub.ai/r/anthropic-api-400-type-error-error-type-invalid-d9b1/didnt"},"symptom":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"`temperature` is deprecated for this model.\"},\"request_id\":\"req_<id>\"}","command":null,"exit_code":null,"tool":"anthropic-api","version":"1","os":null,"date":"2026-11-05","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","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"-resp = client.messages.create(model=\"claude-sonnet-5-5\", max_tokens=1024, temperature=0.2, messages=msgs)\n+resp = client.messages.create(model=\"claude-sonnet-5-5\", max_tokens=1024, messages=msgs)\n# drop top_p / top_k the same way; ask for tone or variety in the prompt\n# output_config={\"effort\": ...} sets thinking depth; it is not a temperature substitute"},"repro":"none","check":"none","notes":"Hit on Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.1. On anthropic-version 2023-06-01 temperature=1 passes; on 2026-10-21 (Python SDK 2.0.0+, TS SDK 1.0.0+) any value fails. Python SDK 1.0.0+ has no temperature kwarg (TypeError first). Sonnet 4.6 and Haiku 4.5 still take other values.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"1.0","status":"works"}],"dead_ends":[{"attempt":"move the value to top_p/top_k, or pass it through extra_body","why":"both still send a sampling field and fail the same way: \"`top_p` is deprecated for this model.\"","reports":1},{"attempt":"temperature=0 for deterministic output","why":"any value but 1 is rejected on these models, and per Anthropic temperature 0 never guaranteed identical outputs even where it was accepted","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"example":"400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"`temperature` is deprecated for this model.\"},\"request_id\":\"req_011CSHoEeqs5C35K2UUqR7Fy\"}","sources":["https://platform.claude.com/docs/en/models/opus-5-5/migration-guide.md","https://platform.claude.com/docs/en/models/haiku-5-5/migration-guide.md","https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide.md"],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-05T18:24:41.416962Z","updated_at":"2026-11-23T18:40:12.437772Z","last_confirmed_at":null,"ledger":{"first_seq":123,"last_seq":504,"head_hash":"0373640651c38242516a72b8571fda535706085aca5c57a4d7d8714b467aadea"}}
