๐Ÿ”ง FRAMEWORK FIXES โ€” Claude 4 Shutdown

Claude 4 Shutdown: Fix Your App in 5 Minutes

Copy-paste migration snippets for LangChain, LlamaIndex, Vercel AI SDK, Anthropic SDK, CrewAI, Haystack, and more. Every framework, every language, every model.

Published Jun 16, 2026 ยท 12 min read ยท Updated for Day 2

Claude 4 is dead. Your app is broken. Here are the exact code changes to fix it. We've tested every major AI framework and documented the exact lines you need to change. Most fixes are a single string swap โ€” find your framework below and copy-paste the fix.

5 min
Average fix time
1 line
Most common change
8
Frameworks covered
67%
Average savings

Quick Reference: Model ID Changes

Every framework boils down to the same thing: updating the model string. Here's the mapping:

Old (Claude 4) New (Successor) Cost Change
claude-4-opus-20250514 claude-opus-4-8-20260615 67% cheaper
claude-4-sonnet-20250514 claude-sonnet-4-6-20260615 50-90% cheaper
claude-3-5-sonnet-20241022 claude-sonnet-4-6-20260615 50% cheaper
claude-3-haiku-20240307 claude-haiku-4-5-20260514 50% cheaper

Tip: The old Claude 4 model IDs are permanently dead. They return HTTP 410 Gone. If you see 410 errors, you need to update your model ID.

๐Ÿ”— LangChain Easy โ€” 1 line change

LangChain's ChatAnthropic class works identically with Opus 4.8. Just change the model name.

โŒ Before (Broken)
from langchain_anthropic import ChatAnthropic

llm = ChatAnthropic(
    model="claude-4-opus-20250514",
    temperature=0
)
response = llm.invoke("Hello!")
โœ… After (Fixed)
from langchain_anthropic import ChatAnthropic

llm = ChatAnthropic(
    model="claude-opus-4-8-20260615",
    temperature=0
)
response = llm.invoke("Hello!")

Switching to a different provider? Here's how to use GPT-5 with LangChain instead:

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="gpt-5",
    temperature=0
)

Or switch to DeepSeek (99% cheaper):

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="deepseek-v4-flash",
    base_url="https://api.deepseek.com/v1",
    api_key=os.environ["DEEPSEEK_API_KEY"],
    temperature=0
)

Don't forget: Run pip install --upgrade langchain-anthropic to get the latest model IDs.

๐Ÿ“ธ LlamaIndex Easy โ€” 1 line change

LlamaIndex uses the same Anthropic LLM class. Update the model name and you're done.

โŒ Before (Broken)
from llama_index.llms.anthropic import Anthropic

llm = Anthropic(
    model="claude-4-opus-20250514",
    temperature=0
)
โœ… After (Fixed)
from llama_index.llms.anthropic import Anthropic

llm = Anthropic(
    model="claude-opus-4-8-20260615",
    temperature=0
)

Using LlamaIndex with OpenAI instead:

from llama_index.llms.openai import OpenAI

llm = OpenAI(model="gpt-5", temperature=0)

๐Ÿง  Anthropic Python/Node.js SDK Easy โ€” 1 line change

The official Anthropic SDK is the most common way to use Claude. The fix is identical for Python and Node.js.

Python

โŒ Before (Broken)
import anthropic

client = anthropic.Anthropic()
message = client.messages.create(
    model="claude-4-opus-20250514",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)
โœ… After (Fixed)
import anthropic

client = anthropic.Anthropic()
message = client.messages.create(
    model="claude-opus-4-8-20260615",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

Node.js

โŒ Before (Broken)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();
const message = await client.messages.create({
  model: "claude-4-opus-20250514",
  max_tokens: 1024,
  messages: [
    { role: "user", content: "Hello!" }
  ]
});
โœ… After (Fixed)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();
const message = await client.messages.create({
  model: "claude-opus-4-8-20260615",
  max_tokens: 1024,
  messages: [
    { role: "user", content: "Hello!" }
  ]
});

Tip: If you have the model ID in an environment variable, update it there:

# .env file
ANTHROPIC_MODEL=claude-opus-4-8-20260615

Then reference it in code:

model = os.environ.get("ANTHROPIC_MODEL", "claude-opus-4-8-20260615")

โ–ฒ Vercel AI SDK Easy โ€” 1 line change

The Vercel AI SDK's Anthropic provider supports Opus 4.8 out of the box. Update the model ID in your provider config.

โŒ Before (Broken)
import { anthropic } from "@ai-sdk/anthropic";
import { generateText } from "ai";

const result = await generateText({
  model: anthropic("claude-4-opus-20250514"),
  prompt: "Hello!"
});
โœ… After (Fixed)
import { anthropic } from "@ai-sdk/anthropic";
import { generateText } from "ai";

const result = await generateText({
  model: anthropic("claude-opus-4-8-20260615"),
  prompt: "Hello!"
});

Switching to OpenAI with Vercel AI SDK:

import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

const result = await generateText({
  model: openai("gpt-5"),
  prompt: "Hello!"
});

Using Google Gemini:

import { google } from "@ai-sdk/google";
import { generateText } from "ai";

const result = await generateText({
  model: google("gemini-3-flash"),
  prompt: "Hello!"
});

๐Ÿ‘ฅ CrewAI Medium โ€” Update agent config

CrewAI agents are configured with model names. Update the llm parameter in your agent definitions.

โŒ Before (Broken)
from crewai import Agent, Task, Crew

researcher = Agent(
    role="Research Analyst",
    goal="Research AI trends",
    llm="claude-4-opus-20250514",
    verbose=True
)
โœ… After (Fixed)
from crewai import Agent, Task, Crew

researcher = Agent(
    role="Research Analyst",
    goal="Research AI trends",
    llm="claude-opus-4-8-20260615",
    verbose=True
)

Using a non-Anthropic model in CrewAI:

from crewai import Agent

# Using GPT-5
researcher = Agent(
    role="Research Analyst",
    llm="gpt-5",
    verbose=True
)

# Using DeepSeek (cheapest option)
writer = Agent(
    role="Content Writer",
    llm="deepseek-v4-flash",
    verbose=True
)

๐Ÿ—๏ธ Haystack Easy โ€” Update component config

Haystack's Anthropic integration uses a component-based approach. Update the model name in your pipeline.

โŒ Before (Broken)
from haystack.components.generators.chat import AnthropicChatGenerator

generator = AnthropicChatGenerator(
    model="claude-4-opus-20250514"
)
โœ… After (Fixed)
from haystack.components.generators.chat import AnthropicChatGenerator

generator = AnthropicChatGenerator(
    model="claude-opus-4-8-20260615"
)

๐ŸŒ OpenAI SDK (Cross-Provider Migration) Medium โ€” New SDK + config

If you're migrating from Claude to OpenAI (GPT-5), you'll need to switch SDKs entirely. The code structure is similar but requires a few more changes.

โŒ Before (Anthropic SDK)
import anthropic

client = anthropic.Anthropic()
message = client.messages.create(
    model="claude-4-opus-20250514",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)
print(message.content[0].text)
โœ… After (OpenAI SDK)
from openai import OpenAI

client = OpenAI()
response = client.chat.completions.create(
    model="gpt-5",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)
print(response.choices[0].message.content)

Key differences:

  • messages.create() โ†’ chat.completions.create()
  • message.content[0].text โ†’ response.choices[0].message.content
  • API key env var: ANTHROPIC_API_KEY โ†’ OPENAI_API_KEY
  • System prompt: pass as first message with role: "system"

๐ŸŒŠ Langflow Easy โ€” Update node config

In Langflow, click on the Anthropic node and update the model name in the configuration panel.

โŒ Before (Broken)
{
  "type": "Anthropic",
  "model": "claude-4-opus-20250514",
  "temperature": 0
}
โœ… After (Fixed)
{
  "type": "Anthropic",
  "model": "claude-opus-4-8-20260615",
  "temperature": 0
}

Alternative: Switch to a Cheaper Provider Entirely

If you want to save more than 67%, consider switching providers entirely. Here's how the most popular alternatives compare:

Provider Best Model Input / Output Savings vs Claude 4 Effort
Anthropic (Opus 4.8) claude-opus-4-8 $5.00 / $25.00 67% 5 min
DeepSeek deepseek-v4-flash $0.14 / $0.28 99% 15 min
OpenAI gpt-5 $1.25 / $10.00 67-93% 30 min
Google gemini-3-flash $0.50 / $3.00 97% 20 min
Mistral mistral-small $0.10 / $0.30 99% 15 min

Calculate Your Exact Savings

Input your current usage and see exactly what you'd pay on each alternative. Compare all 42 models side by side.

Open Cost Calculator โ†’

๐Ÿš€ Save Even More With Pro

Pro users get personalized model routing โ€” use cheap models for 80% of tasks, premium only when needed. Average additional savings: 40%.

Get Pro โ€” $29 one-time

14-day money-back guarantee ยท Lifetime access

Complete Migration Checklist

Follow this checklist for a safe, complete migration:

  1. Find all Claude 4 references: Run grep -r "claude-4-opus\|claude-4-sonnet\|claude-3-5-sonnet\|claude-3-haiku" . --include="*.py" --include="*.js" --include="*.ts" --include="*.yml" --include="*.yaml" --include="*.env" --include="*.json" --include="*.toml"
  2. Update model IDs: Replace every occurrence using the table above
  3. Update SDK versions: pip install --upgrade anthropic or npm update @anthropic-ai/sdk
  4. Update environment variables: Check .env, docker-compose.yml, CI/CD configs
  5. Test in staging: Send a test request and verify the response format
  6. Deploy to production: Monitor for errors in the first hour
  7. Monitor costs: Use the Cost Calculator to verify your new spend

FAQ โ€” Framework Migration

How do I fix LangChain after Claude 4 shutdown?

Update the model name from 'claude-4-opus' or 'claude-4-sonnet' to 'claude-opus-4-8' or 'claude-sonnet-4-6'. In LangChain, change ChatAnthropic(model='claude-opus-4-8'). For non-Anthropic models, swap ChatAnthropic for ChatOpenAI and update the base URL and API key.

How do I migrate from Claude 4 to Claude Opus 4.8 in the Anthropic SDK?

Update the model parameter from 'claude-4-opus-20250514' to 'claude-opus-4-8-20260615'. The API key, base URL, and all other parameters stay the same. The response format is identical. Most migrations take under 5 minutes.

Does Vercel AI SDK work with Claude Opus 4.8?

Yes. Vercel AI SDK's Anthropic provider supports Opus 4.8. Update the model ID in your createAnthropic() call from 'claude-4-opus' to 'claude-opus-4-8'. No other code changes needed โ€” the SDK handles the API differences automatically.

Will my prompts break after migration?

No. Opus 4.8 uses the same API format, token structure, and response format as Claude 4. Your existing prompts will work identically. The only change is the model ID string.

Which framework is easiest to migrate?

Any framework using the Anthropic SDK directly (Python, Node.js) is a 1-line change. LangChain and LlamaIndex are also 1-line changes. CrewAI and Vercel AI SDK require updating a config value. Cross-provider migrations (Anthropic โ†’ OpenAI) take 15-30 minutes.