I'm on the team behind ModAPI, the gateway used in the examples. This post was drafted by an AI agent and reviewed by our team; every request below was run on Nov 25, 2026, and the outputs shown are the real ones (with request IDs removed).
Anthropic retires claude-sonnet-4-5-20250929 on November 30, 2026. The retirement also covers claude-sonnet-4-5, the same model without the date suffix. The recommended replacement is claude-sonnet-5-5 (Anthropic's deprecation page).
All examples go through ModAPI: its OpenAI-compatible endpoint is https://modapi.ai/v1, and its Anthropic Messages endpoint is https://modapi.ai.
1. What happens when you call the old model
ModAPI has already removed Sonnet 4.5, ahead of Anthropic's Nov 30 date. Calling it now returns:
curl https://modapi.ai/v1/chat/completions \ -H "Authorization: Bearer $MODAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "claude-sonnet-4-5-20250929", "max_tokens": 64, "messages": [{"role": "user", "content": "Reply with exactly: OK"}]}' HTTP 404 { "error": { "code": "model_not_found", "message": "The requested model is not available.", "type": "new_api_error" } } The alias claude-sonnet-4-5 and the Messages endpoint return the same 404. If you see model_not_found for a Sonnet 4.5 ID, this is why.
2. The model-name change (OpenAI-compatible endpoint)
If your code only sends model, messages and max_tokens, changing the model name is the whole migration.
Python, openai SDK
import os from openai import OpenAI client = OpenAI(base_url="https://modapi.ai/v1", api_key=os.environ["MODAPI_API_KEY"]) resp = client.chat.completions.create( model="claude-sonnet-5-5", # was "claude-sonnet-4-5-20250929" max_tokens=64, messages=[{"role": "user", "content": "Reply with exactly: OK"}], ) print(resp.choices[0].message.content) print(resp.usage.prompt_tokens, resp.usage.completion_tokens) OK 18 4 curl
curl https://modapi.ai/v1/chat/completions \ -H "Authorization: Bearer $MODAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "claude-sonnet-5-5", "max_tokens": 64, "messages": [{"role": "user", "content": "Reply with exactly: OK"}]}' { "model": "claude-sonnet-5-5", "object": "chat.completion", "choices": [ {"index": 0, "message": {"role": "assistant", "content": "OK"}, "finish_reason": "stop"} ], "usage": {"prompt_tokens": 18, "completion_tokens": 4, "total_tokens": 22} } Streaming
stream = client.chat.completions.create( model="claude-sonnet-5-5", max_tokens=64, stream=True, stream_options={"include_usage": True}, messages=[{"role": "user", "content": "Reply with exactly: OK"}], ) for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True) if chunk.usage: print("\n", chunk.usage.prompt_tokens, chunk.usage.completion_tokens) The text arrives in a content chunk, then a finish_reason: "stop" chunk, then a final chunk with empty choices that carries usage:
OK 18 4 3. The same change on the Anthropic Messages API
Python, anthropic SDK
import os import anthropic client = anthropic.Anthropic(base_url="https://modapi.ai", api_key=os.environ["MODAPI_API_KEY"]) msg = client.messages.create( model="claude-sonnet-5-5", max_tokens=64, messages=[{"role": "user", "content": "Reply with exactly: OK"}], ) print(msg.content[0].text, msg.stop_reason) print(msg.usage.input_tokens, msg.usage.output_tokens) OK end_turn 18 4 Claude Code
Claude Code reads its endpoint and model from the environment, so the switch is one variable:
export ANTHROPIC_BASE_URL="https://modapi.ai" export ANTHROPIC_AUTH_TOKEN="your-modapi-api-key" export ANTHROPIC_MODEL="claude-sonnet-5-5" # was claude-sonnet-4-5-20250929 claude -p "Reply with exactly: OK" --output-format json Trimmed output from Claude Code 2.1.332:
{ "type": "result", "subtype": "success", "is_error": false, "result": "OK", "stop_reason": "end_turn", "modelUsage": { "claude-sonnet-5-5": {"inputTokens": 4, "outputTokens": 4, "cacheCreationInputTokens": 15059, "contextWindow": 1000000, "maxOutputTokens": 128000} } } (The 15,059 cache-creation tokens are Claude Code's own system prompt and tool definitions, written to the prompt cache on the first call.)
4. Request settings that changed
Anthropic's Sonnet 5.5 migration guide lists five settings that Sonnet 4.5 accepted and Sonnet 5.5 rejects with a 400 error on Anthropic's API: sampling parameters, forced tool choice, assistant prefill, thinking budgets, and thinking: {"type": "disabled"}. I sent each one through ModAPI (tested Nov 25, 2026). Two failed (forced tool choice on the OpenAI-compatible endpoint, and thinking budgets); the other three went through, because the gateway accepted them. Remove all of them anyway: they fail on Anthropic's own API and on other providers, and you don't want your code to depend on a gateway being lenient.
4.1 Forced tool use: fails on the OpenAI-compatible endpoint
client.chat.completions.create( model="claude-sonnet-5-5", max_tokens=64, tools=[get_weather_tool], tool_choice="required", messages=[{"role": "user", "content": "What's the weather in Paris? Use the tool."}], ) HTTP 400 { "error": { "message": "tool_choice: type \"tool\" and \"any\" are not supported for this model.", "type": "invalid_request_error" } } The same request on the Messages endpoint with tool_choice: {"type": "any"} returned 200 and a tool_use block through ModAPI.
Fix: use tool_choice: "auto" (Messages: {"type": "auto"}) and say in the prompt when the tool should be used. With auto, the model called the tool:
{"finish_reason": "tool_calls", "message": {"content": "", "tool_calls": [{"type": "function", "function": {"name": "get_weather", "arguments": "{\"city\":\"Paris\"}"}}]}} Anthropic's guide also recommends marking the tool strict: true so its input always matches the schema (migration guide).
4.2 Thinking budgets: fail
client.messages.create( model="claude-sonnet-5-5", max_tokens=2048, thinking={"type": "enabled", "budget_tokens": 1024}, messages=[{"role": "user", "content": "Reply with exactly: OK"}], ) HTTP 400 "thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior. Fix: replace the budget with an effort level.
msg = client.messages.create( model="claude-sonnet-5-5", max_tokens=1024, thinking={"type": "adaptive"}, output_config={"effort": "low"}, # low, medium, high, xhigh, max messages=[{"role": "user", "content": "Reply with exactly: OK"}], ) OK end_turn 18 4 On the OpenAI-compatible endpoint, reasoning_effort does the same job:
resp = client.chat.completions.create( model="claude-sonnet-5-5", max_tokens=1024, reasoning_effort="low", messages=[{"role": "user", "content": "Reply with exactly: OK"}], ) OK 18 4 4.3 temperature, top_p, top_k: went through on ModAPI
temperature=0.7 returned 200 and OK on both endpoints through ModAPI. Anthropic's API rejects it for Sonnet 5.5.
Fix: remove temperature, top_p and top_k. If you used a low temperature to get stable output, constrain the output through the prompt and structured output instead.
4.4 Assistant prefill: went through on ModAPI
Ending messages with {"role": "assistant", "content": "The capital is"} returned 200 through ModAPI. The reply started with a thinking block and then Paris.. Anthropic's API rejects prefill for Sonnet 5.5.
Fix: put the instruction in the system prompt or the last user message, or use structured output if you were prefilling { to get JSON.
4.5 thinking: {"type": "disabled"}: went through on ModAPI
thinking={"type": "disabled"} on the Messages endpoint returned 200 and OK through ModAPI. Anthropic's API rejects it for Sonnet 5.5.
Fix: drop the thinking field, or use thinking={"type": "adaptive"} with a low effort level as in 4.2.
5. What the switch does to cost
Per token, Sonnet 5.5 is cheaper than 4.5:
| Model | Input $/1M | Output $/1M | Cache read $/1M |
|---|---|---|---|
| claude-sonnet-4-5-20250929 | $3 | $15 | $0.30 |
| claude-sonnet-5-5 | $2 | $10 | $0.10 |
Prices on ModAPI's standard channel group, from modapi.ai/pricing on Nov 25, 2026 (the 4.5 row is its last listed price). Top up $100, get up to $330 in LLM credit: modapi.ai/campaigns.
The bill for the same work drops by less than the per-token price. Sonnet 5.5 uses a newer tokenizer, and Anthropic's migration guide says the same text produces "about 30 percent more tokens" than on Sonnet 4.5, depending on the content (migration guide). That is Anthropic's figure, not one we measured. Re-check max_tokens and any token budgets after switching.
Checklist
- [ ] Replace
claude-sonnet-4-5-20250929andclaude-sonnet-4-5everywhere, including env vars likeANTHROPIC_MODEL. - [ ] Change forced
tool_choicetoauto. - [ ] Replace thinking budgets with an effort level.
- [ ] Remove
temperature,top_p,top_k, assistant prefills andthinking: {"type": "disabled"}, even if your provider still accepts them. - [ ] Re-check token counts and
max_tokens.
New accounts get $20 in free credit: modapi.ai.
