
Claude Sonnet 4 & Opus 4 Deprecate June 15 — Migrate Now
June 9, 2026
Six days. That's how long you have before API calls to two Claude models start returning errors.
Anthropic is retiring Claude Sonnet 4 and Claude Opus 4 — the original 4.0 releases — on June 15, 2026. After that date, API requests to claude-sonnet-4-0 and claude-opus-4-0 will fail. This isn't a soft sunset. Production apps that haven't migrated will break.
If you're on claude.ai or Claude Code, you don't need to do anything — Anthropic handles model selection automatically in those products. This is specifically for developers making direct API calls with pinned model identifiers.
Find Out If You're Affected
Before doing anything else, scan your codebase:
grep -r "claude-sonnet-4-0\|claude-opus-4-0" ./src
Replace ./src with your actual source directory. This will surface every file containing either deprecated model string. If you get zero results, you're clear. If you get hits, keep reading.
What to Migrate To
Both deprecated models have direct successors that are more capable and in several cases cheaper per token.
The quick reference:
Deprecated:
claude-sonnet-4.0
claude-sonnet-4.5
Default replacement:
claude-opus-4.5
claude-opus-4.0
Best upgrade:
claude-opus-4.5
claude-opus-4.8
For most teams: swap claude-sonnet-4-0 → claude-sonnet-4-5 and claude-opus-4-0 → claude-opus-4-8. If you're already migrating, there's no reason to land on a middle version — Opus 4.8 is Anthropic's current flagship, released May 28, with stronger agentic coding, a new Fast mode at 2.5× speed, and dynamic workflows in Claude Code.
The Migration Is One Line
Python:
# Before
model="claude-opus-4-0"
# After
model="claude-opus-4-8"
Node.js / TypeScript:
// Before
model: "claude-sonnet-4-0"
// After
model: "claude-sonnet-4-5"
cURL:
# Before
"model": "claude-opus-4-0"
# After
"model": "claude-opus-4-8"
The API endpoint, request format, messages array, system prompts, max_tokens, and temperature are all unchanged. It really is just the model string.
Stop Hardcoding Model Strings
While you're in here, fix the underlying pattern that made this a scramble in the first place.
If you're calling these models in more than one place, centralize the model identifier into a config variable or environment variable. That way, future migrations only require a single change.
# config.py
CLAUDE_OPUS_MODEL = "claude-opus-4-8"
CLAUDE_SONNET_MODEL = "claude-sonnet-4-5"
Then reference CLAUDE_OPUS_MODEL throughout your codebase instead of the string literal. One variable, one place to update when the next deprecation notice lands.
What Else Changed in the Model Lineup
Worth knowing the full picture while you're auditing:
The Claude 3 generation — Opus, Sonnet, Haiku — has fully retired as of April 2026. The Claude 3.5 generation and Claude 3.7 Sonnet retired on February 19, 2026. Claude Sonnet 4 and Opus 4 retire June 15. The active models that have not been marked for deprecation are Opus 4.8, 4.7, 4.6, 4.5, 4.1, Sonnet 4.6, Sonnet 4.5, and Haiku 4.5.
If your codebase has any Claude 3.x model strings still in it, those have been erroring for months. Clean those up too.
The Timeline
- Today, June 9 — Run the grep, find your hits
- This week — Update model strings, test outputs, deploy
- June 15 — Deprecated models start returning errors
The migration is a one-line change in most cases. Update the model string, test your outputs, deploy. The only way this becomes an incident is if you don't do it before Sunday.
Sources: MindStudio, Anthropic