<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ModAPI Developer Blog]]></title><description><![CDATA[ModAPI Developer Blog]]></description><link>https://modapi.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6b06f6ed6eb2a656c576e7d8/272ef570-660b-4093-b4b8-efa0da1bd035.png</url><title>ModAPI Developer Blog</title><link>https://modapi.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 01:06:36 GMT</lastBuildDate><atom:link href="https://modapi.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Claude Sonnet 4.5 retires Nov 30: a tested migration to claude-sonnet-5-5]]></title><description><![CDATA[claude-sonnet-4-5 stops working Nov 30. A tested migration to claude-sonnet-5-5, plus the request settings that changed.]]></description><link>https://modapi.hashnode.dev/claude-sonnet-4-5-retires-nov-30-a-tested-migration-to-claude-sonnet-5-5</link><guid isPermaLink="true">https://modapi.hashnode.dev/claude-sonnet-4-5-retires-nov-30-a-tested-migration-to-claude-sonnet-5-5</guid><category><![CDATA[claude]]></category><category><![CDATA[AI]]></category><category><![CDATA[APIs]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[ModAPI]]></dc:creator><pubDate>Thu, 26 Nov 2026 03:04:15 GMT</pubDate><content:encoded><![CDATA[<p><em>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).</em></p>
<p>Anthropic retires <code>claude-sonnet-4-5-20250929</code> on <strong>November 30, 2026</strong>. The retirement also covers <code>claude-sonnet-4-5</code>, the same model without the date suffix. The recommended replacement is <code>claude-sonnet-5-5</code> (<a href="https://platform.claude.com/docs/en/about-claude/model-deprecations">Anthropic's deprecation page</a>).</p>
<p>All examples go through ModAPI: its OpenAI-compatible endpoint is <code>https://modapi.ai/v1</code>, and its Anthropic Messages endpoint is <code>https://modapi.ai</code>.</p>
<h2>1. What happens when you call the old model</h2>
<p>ModAPI has already removed Sonnet 4.5, ahead of Anthropic's Nov 30 date. Calling it now returns:</p>
<pre><code class="language-bash">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"}]}'
</code></pre>
<pre><code class="language-json">HTTP 404
{
  "error": {
    "code": "model_not_found",
    "message": "The requested model is not available.",
    "type": "new_api_error"
  }
}
</code></pre>
<p>The alias <code>claude-sonnet-4-5</code> and the Messages endpoint return the same 404. If you see <code>model_not_found</code> for a Sonnet 4.5 ID, this is why.</p>
<h2>2. The model-name change (OpenAI-compatible endpoint)</h2>
<p>If your code only sends <code>model</code>, <code>messages</code> and <code>max_tokens</code>, changing the model name is the whole migration.</p>
<p><strong>Python, openai SDK</strong></p>
<pre><code class="language-python">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)
</code></pre>
<pre><code class="language-plaintext">OK
18 4
</code></pre>
<p><strong>curl</strong></p>
<pre><code class="language-bash">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"}]}'
</code></pre>
<pre><code class="language-json">{
  "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}
}
</code></pre>
<p><strong>Streaming</strong></p>
<pre><code class="language-python">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)
</code></pre>
<p>The text arrives in a content chunk, then a <code>finish_reason: "stop"</code> chunk, then a final chunk with empty <code>choices</code> that carries <code>usage</code>:</p>
<pre><code class="language-plaintext">OK
 18 4
</code></pre>
<h2>3. The same change on the Anthropic Messages API</h2>
<p><strong>Python, anthropic SDK</strong></p>
<pre><code class="language-python">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)
</code></pre>
<pre><code class="language-plaintext">OK end_turn
18 4
</code></pre>
<p><strong>Claude Code</strong></p>
<p>Claude Code reads its endpoint and model from the environment, so the switch is one variable:</p>
<pre><code class="language-bash">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
</code></pre>
<p>Trimmed output from Claude Code 2.1.332:</p>
<pre><code class="language-json">{
  "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}
  }
}
</code></pre>
<p>(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.)</p>
<h2>4. Request settings that changed</h2>
<p>Anthropic's <a href="https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide">Sonnet 5.5 migration guide</a> 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 <code>thinking: {"type": "disabled"}</code>. 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 were accepted in this test, but that does not mean the old setting took effect, and it does not mean they will keep being accepted. Migrate by Anthropic's rules either way and remove all five: they fail on Anthropic's own API and on other providers.</p>
<h3>4.1 Forced tool use: fails on the OpenAI-compatible endpoint</h3>
<pre><code class="language-python">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."}],
)
</code></pre>
<pre><code class="language-json">HTTP 400
{
  "error": {
    "message": "tool_choice: type \"tool\" and \"any\" are not supported for this model.",
    "type": "invalid_request_error"
  }
}
</code></pre>
<p>On this endpoint ModAPI maps <code>tool_choice: "required"</code> to the Messages API's <code>{"type": "any"}</code>, which is what the error refers to. The same request sent straight to the Messages endpoint with <code>tool_choice: {"type": "any"}</code> returned 200 and a <code>tool_use</code> block in this test; don't rely on that, since Anthropic's API rejects forced tool choice for Sonnet 5.5.</p>
<p><strong>Fix:</strong> use <code>tool_choice: "auto"</code> (Messages: <code>{"type": "auto"}</code>) and say in the prompt when the tool should be used. With <code>auto</code>, the model called the tool:</p>
<pre><code class="language-json">{"finish_reason": "tool_calls", "message": {"content": "", "tool_calls": [{"type": "function", "function": {"name": "get_weather", "arguments": "{\"city\":\"Paris\"}"}}]}}
</code></pre>
<p>Anthropic's guide also recommends marking the tool <code>strict: true</code> so its input always matches the schema (<a href="https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide">migration guide</a>).</p>
<h3>4.2 Thinking budgets: fail</h3>
<pre><code class="language-python">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"}],
)
</code></pre>
<pre><code class="language-plaintext">HTTP 400
"thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.
</code></pre>
<p><strong>Fix:</strong> replace the budget with an effort level.</p>
<pre><code class="language-python">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"}],
)
</code></pre>
<pre><code class="language-plaintext">OK end_turn
18 4
</code></pre>
<p>On the OpenAI-compatible endpoint, <code>reasoning_effort</code> does the same job:</p>
<pre><code class="language-python">resp = client.chat.completions.create(
    model="claude-sonnet-5-5", max_tokens=1024, reasoning_effort="low",
    messages=[{"role": "user", "content": "Reply with exactly: OK"}],
)
</code></pre>
<pre><code class="language-plaintext">OK
18 4
</code></pre>
<h3>4.3 <code>temperature</code>, <code>top_p</code>, <code>top_k</code>: accepted in this test, not applied</h3>
<p><code>temperature=0.7</code> returned 200 and <code>OK</code> on both endpoints through ModAPI. The 200 does not mean the setting took effect: when a Chat Completions request is converted for Claude, ModAPI removes sampling parameters that Sonnet 5.5 doesn't support, so the model never received <code>temperature=0.7</code>. Anthropic's API rejects it for Sonnet 5.5.</p>
<p><strong>Fix:</strong> remove <code>temperature</code>, <code>top_p</code> and <code>top_k</code>. If you used a low temperature to get stable output, constrain the output through the prompt and structured output instead.</p>
<h3>4.4 Assistant prefill: accepted in this test, not a prefill</h3>
<p>Ending <code>messages</code> with <code>{"role": "assistant", "content": "The capital is"}</code> returned 200 through ModAPI. The reply started with a thinking block and then <code>Paris.</code>. In this test the request was converted on the way, and the trailing assistant message was kept as ordinary chat history. That shows the request succeeded; it does not mean Anthropic's native prefill behavior is supported. Anthropic's API rejects prefill for Sonnet 5.5.</p>
<p><strong>Fix:</strong> put the instruction in the system prompt or the last user message, or use structured output if you were prefilling <code>{</code> to get JSON.</p>
<h3>4.5 <code>thinking: {"type": "disabled"}</code>: accepted in this test</h3>
<p><code>thinking={"type": "disabled"}</code> on the Messages endpoint returned 200 and <code>OK</code> through ModAPI. That does not show thinking was turned off, or that the setting will stay accepted. Anthropic's API rejects it for Sonnet 5.5.</p>
<p><strong>Fix:</strong> drop the <code>thinking</code> field, or use <code>thinking={"type": "adaptive"}</code> with a low effort level as in 4.2.</p>
<h2>5. What the switch does to cost</h2>
<p>Per token, Sonnet 5.5 is cheaper than 4.5:</p>
<table>
<thead>
<tr>
<th>Model</th>
<th align="right">Input $/1M</th>
<th align="right">Output $/1M</th>
<th align="right">Cache read $/1M</th>
</tr>
</thead>
<tbody><tr>
<td>claude-sonnet-4-5-20250929</td>
<td align="right">$3</td>
<td align="right">$15</td>
<td align="right">$0.30</td>
</tr>
<tr>
<td>claude-sonnet-5-5</td>
<td align="right">$2</td>
<td align="right">$10</td>
<td align="right">$0.10</td>
</tr>
</tbody></table>
<p><em>Prices on ModAPI's standard channel group, from</em> <a href="https://modapi.ai/pricing?search=claude-sonnet&amp;utm_source=hashnode&amp;utm_medium=referral&amp;utm_campaign=tutorial"><em>modapi.ai/pricing</em></a> <em>on Nov 25, 2026 (the 4.5 row is its last listed price). Top up $100, get up to $330 in LLM credit:</em> <a href="https://modapi.ai/campaigns?utm_source=hashnode&amp;utm_medium=referral&amp;utm_campaign=tutorial"><em>modapi.ai/campaigns</em></a><em>.</em></p>
<p>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 (<a href="https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide">migration guide</a>). That is Anthropic's figure, not one we measured. Re-check <code>max_tokens</code> and any token budgets after switching.</p>
<h2>Checklist</h2>
<ul>
<li><input disabled type="checkbox" /> Replace <code>claude-sonnet-4-5-20250929</code> and <code>claude-sonnet-4-5</code> everywhere, including env vars like <code>ANTHROPIC_MODEL</code>.</li>
<li><input disabled type="checkbox" /> Change forced <code>tool_choice</code> to <code>auto</code>.</li>
<li><input disabled type="checkbox" /> Replace thinking budgets with an effort level.</li>
<li><input disabled type="checkbox" /> Remove <code>temperature</code>, <code>top_p</code>, <code>top_k</code>, assistant prefills and <code>thinking: {"type": "disabled"}</code>, even if a request with them still returns 200.</li>
<li><input disabled type="checkbox" /> Re-check token counts and <code>max_tokens</code>.</li>
</ul>
<p>New accounts get $20 in free credit: <a href="https://modapi.ai/?utm_source=hashnode&amp;utm_medium=referral&amp;utm_campaign=tutorial">modapi.ai</a>.</p>
]]></content:encoded></item></channel></rss>