Claude Sonnet 4 Retiring June 15: How to Migrate Your JSON Pipeline Today
Claude Sonnet 4 and Opus 4 retire June 15, 2026. API calls will fail immediately. Here's the exact JSON migration checklist — model string updates, output behavior differences, and how to test your pipeline before Monday.
Have broken JSON right now? Fix it free in under 1 second — no signup.
Fix My JSON →Claude Sonnet 4 (claude-sonnet-4-20250514) and Claude Opus 4 (claude-opus-4-20250514) retire Monday June 15, 2026 at 9AM PT. There is no grace period. After that cutoff, any API call using those model IDs returns an error — your JSON pipeline stops working.
This guide gives you the exact steps to migrate before Monday, covers what changes in JSON output behavior between the old and new models, and shows you how to test that your pipeline is clean before the cutoff.
What Happens on June 15
Starting 9AM PT Monday:
claude-sonnet-4-20250514→ API errorclaude-opus-4-20250514→ API error- No automatic failover — Anthropic does not redirect deprecated models to newer ones
If you're using the alias claude-sonnet-4-0 or claude-opus-4-0, those aliases are also retired. The only safe path is updating to a current model ID.
The One-Line Fix (Migration Checklist)
For most codebases, migration is a find-and-replace:
| Old model ID | Recommended replacement |
|---|---|
claude-sonnet-4-20250514 | claude-sonnet-4-5 |
claude-opus-4-20250514 | claude-opus-4-5 |
claude-sonnet-4-0 (alias) | claude-sonnet-4-5 |
claude-opus-4-0 (alias) | claude-opus-4-5 |
If you're on the 4.x line already and want to stay current, jump to:
- Sonnet →
claude-sonnet-4-6(most capable current Sonnet, same pricing tier) - Opus/complex workloads →
claude-opus-4-7(highest capability, reasoning improvements)
# Find everywhere the old model strings appear
grep -r "claude-sonnet-4-20250514\|claude-opus-4-20250514\|claude-sonnet-4-0\|claude-opus-4-0" . --include=".py" --include=".ts" --include=".js" --include=".env" --include="*.json"
JSON Output Behavior: What Changes Between Sonnet 4 and 4.5/4.6
This is the part most migration guides skip. The model update is one line — but if your JSON pipeline is sensitive to output format differences, these changes matter.
1. Prefill Is Gone (if you haven't migrated yet)
If you're still on Sonnet 4 and using the prefill pattern (assistant turn pre-loading), your code never hit the prefill deprecation. As of Sonnet 4.5+, prefill is fully removed:
# BROKEN on 4.5+ — this returns a 400 error
messages=[
{"role": "user", "content": "Return JSON..."},
{"role": "assistant", "content": "{"} # <-- prefill no longer works
]
Migrate to output_config.format:
# CORRECT — works on all current models
response = anthropic.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Extract data as JSON"}],
output_config={"format": "json"}
)
See the full Claude prefill deprecation migration guide if you haven't updated this yet.
2. Structured Output Is Now GA
In Sonnet 4, Anthropic's native structured output (JSON Schema enforcement) was in beta. As of Sonnet 4.5+, it's generally available across all tiers:
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Extract person data from: Alice, 28, engineer in NYC"}],
output_config={
"format": "json",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"},
"role": {"type": "string"},
"city": {"type": "string"}
},
"required": ["name", "age", "role", "city"]
}
}
)
data = json.loads(response.content[0].text)
This guarantees schema compliance at the model level — no more parsing failures on well-formed prompts. If you were manually validating and repairing output from Sonnet 4, you may be able to simplify your retry logic.
3. Temperature / Top-P / Top-K Changes on Opus 4.7+
If you're migrating Opus 4 → Opus 4.7, note that explicit temperature, top_p, and top_k parameters are not accepted on Opus 4.7:
# BREAKS on Opus 4.7 — these params return 400
client.messages.create(
model="claude-opus-4-7",
temperature=0.0, # <-- causes 400 error
...
)
For JSON output specifically, you typically set temperature=0 to reduce variance. On Opus 4.7, remove this parameter — the model defaults to near-deterministic output for structured tasks without it.
- Sonnet 4 → Sonnet 4.5 or 4.6: no param changes needed
- Opus 4 → Opus 4.5: no param changes needed
- Opus 4 → Opus 4.7: remove temperature/top_p/top_k if set
4. Tool Use JSON Remains Backward-Compatible
Tool use schemas, input validation, and JSON response structure are stable across all 4.x models. If your pipeline uses tool calling for JSON extraction, you don't need to change anything beyond the model ID.
// This pattern works on 4.5, 4.6, 4.7 without changes
const response = await client.messages.create({
model: "claude-sonnet-4-5", // just update this line
tools: [
{
name: "extract_data",
description: "Extract structured data",
input_schema: {
type: "object",
properties: { name: { type: "string" }, count: { type: "integer" } },
required: ["name", "count"]
}
}
],
tool_choice: { type: "auto" },
messages: [{ role: "user", content: "Extract: Alice, 5 items" }]
});
Pre-Cutoff Testing Checklist
Run these checks before Monday 9AM PT:
import anthropic
import json
def test_json_pipeline(model: str):
client = anthropic.Anthropic()
# Test 1: Basic JSON output
r = client.messages.create(
model=model,
max_tokens=256,
messages=[{
"role": "user",
"content": 'Return {"status": "ok", "version": 2} and nothing else.'
}]
)
data = json.loads(r.content[0].text)
assert data["status"] == "ok", "Basic JSON test failed"
print(f"✓ {model}: basic JSON output OK")
# Test 2: Structured output (if using output_config)
r2 = client.messages.create(
model=model,
max_tokens=256,
messages=[{"role": "user", "content": "Return name='Alice' age=30 as JSON"}],
output_config={"format": "json"}
)
data2 = json.loads(r2.content[0].text)
print(f"✓ {model}: structured output OK — {data2}")
Run against your new model
test_json_pipeline("claude-sonnet-4-5")
If you're getting parse errors during testing, use the AI JSONMedic repair tool to inspect the raw output and identify whether it's a truncation, markdown wrapping, or schema mismatch issue.
Common Migration Errors and Fixes
Error: model_not_found or invalid_model
{"type": "error", "error": {"type": "invalid_request_error", "message": "model: claude-sonnet-4-20250514 has been deprecated"}}
Fix: Update model string to claude-sonnet-4-5.
Error: 400 Bad Request after migration to Opus 4.7
If you're passing temperature=0 explicitly, remove it. Opus 4.7 rejects these params.
JSON Output Has Extra Prose After Migration
Some developers report that after switching from Sonnet 4 to 4.6, the model occasionally adds a brief explanation after the JSON block when using pure prompting (no output_config). Fix: use output_config: {format: "json"} or switch to tool use. Both enforce pure JSON output at the model level.
LangChain / LlamaIndex Users
# LangChain — update model in ChatAnthropic
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(model="claude-sonnet-4-5") # was claude-sonnet-4-20250514
For more context on LangChain JSON output patterns, see the LangChain JSON Output Parser guide.
Agent SDK Billing Note
Starting June 15, Anthropic splits the billing pool for programmatic API usage (Agent SDK) from conversational usage. If you're running automated pipelines and haven't enabled overflow billing, you may hit a credit ceiling silently on Monday. Check your Anthropic console billing settings before the cutoff.
What If You Miss the Deadline?
If your pipeline breaks after June 15:
- Update the model string immediately — takes 2 minutes
- Redeploy
- If JSON output format has changed, use the repair endpoint as a temporary fallback while you test the new model
The repair API accepts malformed JSON and returns valid JSON — it can bridge the gap while you validate that the new model's output format matches your schema expectations.
FAQ
Does switching from Sonnet 4 to Sonnet 4.5 require changing my prompts?
No. Prompt format, system message structure, and message array format are unchanged across all 4.x versions. The model improvement is internal — you won't need to rewrite your prompts for JSON tasks.
Will my JSON output be different on Sonnet 4.5 vs Sonnet 4?
Minor stylistic differences are possible (whitespace, key ordering in edge cases), but semantically the output should be equivalent for well-formed schemas. Run your test suite against the new model before deployment rather than assuming it's identical.
What if my code uses claude-sonnet-4-0 (without the date)?
Both the dated ID and the 4-0 alias are retired June 15. Update to claude-sonnet-4-5.
Is structured output GA on Sonnet 4.5?
Yes. Native structured output with JSON Schema enforcement is generally available on Sonnet 4.5, 4.6, and Opus 4.5+. No more beta caveats.
My tool use pipeline passes temperature=0 — do I need to change it?
Only if migrating to Opus 4.7. For Sonnet 4.5 and Sonnet 4.6, temperature works as before.
What's the difference between Sonnet 4.5 and Sonnet 4.6 for JSON tasks?
Sonnet 4.6 has stronger reasoning and follows complex schema instructions more reliably, especially for nested structures. For production JSON pipelines, 4.6 is the recommended target if you're updating anyway.
Still dealing with broken JSON?
Paste it in and get it fixed in under 1 second — free, no signup, no install. Works with ChatGPT, Claude, n8n, and any AI output.
Fix My JSON Free →Related Articles