Skip to main content
MindStudio
Pricing
Blog About
My Workspace

Claude Sonnet 4 and Opus 4 Deprecation: What You Need to Do Before June 15

Anthropic is retiring Claude Sonnet 4 and Opus 4 on June 15, 2026. Here's what's changing, which models to migrate to, and how to update your API calls.

MindStudio Team RSS
Claude Sonnet 4 and Opus 4 Deprecation: What You Need to Do Before June 15

The Clock Is Running on Two Claude Models

Anthropic has announced that Claude Sonnet 4 and Claude Opus 4 — the original 4.0 releases — will be deprecated on June 15, 2026. If your application calls either of these models by their versioned API identifiers, you have roughly eight weeks to update before those calls start failing.

This isn’t a soft sunset. After June 15, API requests to claude-sonnet-4-0 and claude-opus-4-0 will return errors. Production apps that haven’t migrated will break.

The good news: the migration is straightforward. Both models have direct successors that are more capable and, in several cases, cheaper per token. This guide covers exactly what’s changing, which models to move to, and what your API calls need to look like after the change.


What’s Actually Being Deprecated

Anthropic uses a versioned naming convention for its models. When a new generation ships, older point releases stay available for a period — but that window eventually closes.

The two models being retired are:

  • claude-sonnet-4-0 — the original Sonnet 4 release
  • claude-opus-4-0 — the original Opus 4 release

These were strong models when they launched, but Anthropic has shipped several subsequent versions that outperform them on reasoning, instruction following, long-context handling, and agentic tasks. Keeping old versions live indefinitely creates infrastructure overhead and fragments developer attention. Deprecation is how Anthropic consolidates that.

If you’re using Claude through the claude.ai interface rather than the API, you don’t need to do anything — model selection is handled automatically. This guide is specifically for developers and teams making direct API calls with pinned model identifiers.

For broader context on how Claude fits into agentic workflows, the deprecation cycle is part of a deliberate pattern: each generation makes older versions obsolete quickly because the capability gaps between releases have grown substantially.


Which Models to Migrate To

The right migration target depends on what you’re using the deprecated models for.

If you’re migrating from Claude Sonnet 4

Your best options are:

  • claude-sonnet-4-5 — The direct successor. Faster, better reasoning, improved instruction following. Same general positioning as Sonnet 4 (mid-tier, good balance of cost and capability), but meaningfully better on most benchmarks. This is the default recommendation for most Sonnet 4 users.
  • claude-opus-4-5 — If your Sonnet 4 workloads are hitting capability limits and you need more horsepower, jumping to Opus 4.5 is worth considering. You’ll pay more per token, but you’ll get significantly stronger performance on complex reasoning and multi-step tasks.

If you’re migrating from Claude Opus 4

Your options depend on how much has changed since you first integrated:

  • claude-opus-4-5 — The most direct replacement. Same capability tier, better performance.
  • claude-opus-4-7 — Anthropic’s current flagship Opus model. If you’re already going through the migration effort, upgrading to Claude Opus 4.7 is worth doing. It brings substantial improvements for agentic coding, extended thinking, and complex reasoning tasks. The differences between Opus 4.7 and earlier Opus versions are significant enough that most teams doing serious work should default here.
  • claude-opus-4-6 — A reasonable middle ground if you’re not ready for 4.7 but need more than 4.5 offers.

Quick reference

Deprecated ModelDefault ReplacementPerformance-Focused Replacement
claude-sonnet-4-0claude-sonnet-4-5claude-opus-4-5
claude-opus-4-0claude-opus-4-5claude-opus-4-7

How to Update Your API Calls

The change is mechanical: find every place in your codebase where you’re specifying a deprecated model identifier and update it. Here’s what that looks like.

Python (Anthropic SDK)

Before:

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-opus-4-0",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Summarize this document."}
    ]
)

After:

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-opus-4-7",  # Updated from claude-opus-4-0
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Summarize this document."}
    ]
)

Node.js / TypeScript

Before:

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const message = await client.messages.create({
  model: "claude-sonnet-4-0",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Draft a summary." }],
});

After:

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const message = await client.messages.create({
  model: "claude-sonnet-4-5", // Updated from claude-sonnet-4-0
  max_tokens: 1024,
  messages: [{ role: "user", content: "Draft a summary." }],
});

cURL

Before:

curl https://api.anthropic.com/v1/messages \
  --header "x-api-key: $ANTHROPIC_API_KEY" \
  --header "anthropic-version: 2023-06-01" \
  --header "content-type: application/json" \
  --data '{
    "model": "claude-opus-4-0",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

After:

curl https://api.anthropic.com/v1/messages \
  --header "x-api-key: $ANTHROPIC_API_KEY" \
  --header "anthropic-version: 2023-06-01" \
  --header "content-type: application/json" \
  --data '{
    "model": "claude-opus-4-7",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Don’t hardcode model strings in multiple places

If you’re calling these models in more than one place, the cleanest fix is to 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-7"
CLAUDE_SONNET_MODEL = "claude-sonnet-4-5"

Then reference CLAUDE_OPUS_MODEL throughout your codebase instead of the string literal. This is a small change that saves real pain the next time deprecation notices go out.


What Changes (and What Doesn’t)

What stays the same

  • API endpointhttps://api.anthropic.com/v1/messages is unchanged.
  • Request format — The messages array format, system prompts, max_tokens, temperature, and all other parameters stay identical.
  • Response format — Same structure. Your parsing logic doesn’t need to change.
  • Authentication — Same API key header. Nothing changes here.

What might change in practice

  • Output behavior — Newer models generally follow instructions more precisely and produce more consistent outputs. Most teams see this as an improvement, but if your application was tuned around specific quirks of the original models, test before deploying.
  • Latency — Newer Sonnet and Opus variants have different throughput characteristics. Benchmark your P95 latencies in a test environment before pushing to production.
  • Token costs — Pricing varies across model versions. Check Anthropic’s current pricing page for exact figures. Understanding how token-based pricing works helps you estimate the impact before you flip the switch.
  • Prompt caching behavior — If you’re using Anthropic’s prompt caching, verify your cache hit rates don’t degrade after switching. Cache entries are model-specific.

Should You Upgrade Beyond the Direct Replacement?

The minimum viable migration is just swapping claude-opus-4-0claude-opus-4-5 or claude-sonnet-4-0claude-sonnet-4-5. That stops the breaking change with minimal risk.

But if you’re already touching these integrations, it’s worth considering whether to go further.

The case for jumping to Opus 4.7

Claude Opus 4.7 is a materially better model for complex tasks. If your use case involves:

  • Multi-step agentic workflows
  • Long-context document analysis
  • Code generation and review
  • Complex reasoning with tool use

…then the performance gains from going directly to Opus 4.7 are likely worth the additional testing. The agentic coding capabilities in Opus 4.7 in particular have improved significantly over the original Opus 4 release.

If you’re curious about where the ceiling is for Claude models right now, Claude Mythos represents Anthropic’s current research frontier — though it’s not generally available for standard API access yet.

The case for staying at the direct replacement

If your workloads are working well and you’re under time pressure, just do the minimum. Swap the model string, test the key paths, and ship. You can optimize further after June 15.

Multi-model routing as an option

If cost efficiency matters, this migration is also a good time to consider whether every call needs to hit Opus. For workflows that mix light tasks (classification, extraction, routing) with heavy tasks (long-form generation, complex reasoning), routing lighter tasks to Haiku while reserving Opus for the demanding work can cut costs significantly. The Anthropic advisor strategy is one documented approach that teams have used to reduce costs without sacrificing output quality. There’s also a solid framework for optimizing token costs with multi-model routing if you want to think through this more systematically.


Common Migration Mistakes to Avoid

Not testing before the deadline. June 15 is a hard cutoff. Don’t leave the model swap to the last week if you have production traffic depending on it. Run your test suite and a few real-world queries against the new model at least two weeks out.

Forgetting environment-specific configurations. Development, staging, and production environments may each have their own config files or environment variables. Make sure you’ve updated all of them, not just your local setup.

Missing model strings in third-party integrations. If you’re using Claude through a wrapper library, an AI agent platform, or a third-party tool, check whether the model identifier is set inside that tool’s configuration. It may not live in your own codebase at all.

Assuming identical outputs. Newer models are generally better, but they’re not identical. If your downstream logic depends on specific output patterns — particular formatting, specific refusals, consistent phrasing — regression test those paths.

Ignoring context window changes. Newer Opus and Sonnet models have different context window sizes. If you’re working near the limit of the original Opus 4 context window, verify that the new model’s limits accommodate your workloads. For teams doing large-scale document processing, understanding flat-rate long-context pricing may also be relevant here.


How Remy Handles Model Changes

If you’re building applications on top of Claude through Remy, model deprecations like this are significantly less painful. Remy compiles your spec into a full-stack application and handles the underlying infrastructure — including which model gets called for which task.

Rather than hardcoding model identifiers scattered across a TypeScript codebase, you describe what your application does in a spec. Remy handles the model layer. When Anthropic deprecates a model version, the update happens at the infrastructure level, not in your application logic.

This is part of why spec-driven development changes the economics of AI development. The spec is the source of truth. The compiled code — including which models it calls — is derived output. Model churn at the API level doesn’t cascade through your application.

If you’re dealing with this deprecation right now and thinking there has to be a better way to manage these cycles, try Remy at mindstudio.ai/remy. It runs on the same infrastructure that powers MindStudio, which has been integrating with 200+ AI models in production for years.


Frequently Asked Questions

What happens if I don’t migrate before June 15?

API calls to claude-sonnet-4-0 and claude-opus-4-0 will return errors after June 15. Your application will fail at those specific call sites. Nothing gets automatically redirected to a newer model — you’ll just get errors until you update the model identifier.

Can I test the new model before committing to the migration?

Yes. Both claude-sonnet-4-5 and claude-opus-4-7 are available through the Anthropic API now. You can run your current prompts against the new models in a test environment before touching production. This is strongly recommended — give yourself at least a week of parallel testing with real workloads.

Will my existing prompts work with the new models?

For most use cases, yes. The API format is identical. The models are trained on similar principles with the same safety guidelines. That said, newer models interpret instructions more precisely, which occasionally means outputs look slightly different. Test your prompts on the new model and watch for formatting or tone shifts in the responses.

Is there a migration path for teams using Claude through third-party tools?

It depends on the tool. If the tool lets you configure the model identifier yourself, update it directly. If the model is managed by the tool provider, you’ll need to check whether they’ve updated their integration. The multi-LLM flexibility question is worth thinking about here — tools that give you control over which model gets called are easier to maintain through deprecation cycles like this one.

Does this deprecation affect Claude.ai subscriptions or Claude Code?

No. The June 15 deprecation specifically affects API calls using pinned version identifiers. Consumer Claude.ai accounts and Claude Code managed environments are not affected — Anthropic handles model selection in those products automatically.

How do I find all the places in my codebase where these model strings are used?

Run a simple grep or search:

grep -r "claude-opus-4-0\|claude-sonnet-4-0" ./src

Replace ./src with your actual source directory. This will surface every file containing either deprecated model string. From there, do a find-and-replace with the new identifiers.


Key Takeaways

  • Claude Sonnet 4 (claude-sonnet-4-0) and Claude Opus 4 (claude-opus-4-0) are deprecated June 15, 2026. After that date, API calls using these identifiers will fail.
  • The migration is a one-line change in most cases — update the model string, test your outputs, deploy.
  • Default replacements are claude-sonnet-4-5 and claude-opus-4-5, but if you’re doing the migration anyway, consider jumping to claude-opus-4-7 for complex or agentic workloads.
  • API format, authentication, and response structure don’t change. Only the model identifier needs to update.
  • Test before June 15. Don’t leave this for the last week.
  • Centralize model identifiers in config variables to make future deprecation migrations easier.

If you want a development environment where model deprecations don’t cascade through your application logic, try Remy — the spec is the program, and the model layer is managed for you.

Presented by MindStudio

No spam. Unsubscribe anytime.