Leaving the Anthropic API rarely requires a rewrite: for most teams, the switch comes down to one line of configuration (the base URL) plus picking an open-weight model from a shortlist of three families. This guide maps Claude workloads to open equivalents and walks the migration.
Key takeaways
- The switch is usually one line of configuration (a new base URL) if your code already speaks the OpenAI schema; Anthropic-only features (prompt caching, extended thinking) are where the real work sits.
- Three open-model families cover most Claude workloads: Qwen3, DeepSeek, and Llama. Kimi K2 and OpenAI's gpt-oss are credible fourth options.
- Exactly one deployment model gives you verifiable zero retention: self-hosting on hardware you control. Hosted "zero-retention" is a policy statement, not an auditable fact.
- Plan two rollout phases: shadow mode against live traffic, then endpoint-by-endpoint cutover, with a rollback flag throughout.
- Budget four checkpoints: prompt inventory, model shortlist, a small eval on your own data, staged rollout.
Why are teams re-evaluating the Anthropic API in 2026?
In 2025 Anthropic updated its consumer privacy policy so that claude.ai chats could be used for training unless users opted out, with longer retention for those who allow it. The change triggered days of retention-policy anxiety on X, and a wave of conflation between Anthropic's consumer terms and its API terms, which are separate documents with different commitments.
Worth stating plainly: Anthropic's commercial terms have historically been among the clearer ones in the industry, stating that API inputs are not used to train models by default. This is not a dunk piece. The structural lesson is older than any one vendor: any hosted provider's terms are unilateral and changeable. If your prompts, your users' data, or your compliance posture can't absorb a policy change you don't control, the answer is optionality, not outrage. Cost at scale and rate-limit ceilings push teams in the same direction.
What does Anthropic's retention policy actually say?
Two documents matter, and they say different things:
- Commercial / API terms. Anthropic's published commercial terms state that customer API content is not used to train models by default, and its trust documentation defines retention windows for safety and abuse monitoring. Enterprise customers can negotiate modified terms. Read the current versions; they have changed before.
- Consumer privacy policy (claude.ai). The 2025 update moved consumer chats to an opt-out model for training use, with extended retention for users who allow it. This is the document that drove the X discourse. It does not govern API traffic.
The deeper point: for any hosted provider, retention is a policy statement. You cannot audit a datacenter from the outside. DeAI's trust framework separates provider claims into "policy" (what they promise) and "verifiable" (what you can check). It's a useful lens whether you stay or go.
Which open models are the closest Claude alternatives?
No single open model is "the open Claude." Match by workload, and verify against current model cards and public leaderboards. The frontier moves monthly.
Coding and agentic work
Claude's reputation was built here. The open shortlist most teams start with: the Qwen3-Coder family, DeepSeek-V3 and its successors, and Zhipu's GLM coding variants. All three sit near the frontier for code generation and tool calling on current public leaderboards, and all are served behind OpenAI-compatible endpoints at multiple hosts.
General chat and reasoning
Qwen3-235B (Apache-2.0) and DeepSeek-R1 (MIT) are the default picks for reasoning-heavy workloads; Llama 3.3 70B covers lighter general-assistant duty on much cheaper hardware; Kimi K2 has a strong following for agentic, tool-heavy flows; OpenAI's gpt-oss-120b is Apache-2.0 and sized to fit on a single high-end GPU. Licenses differ (Llama ships under its own community license), so check terms before commercial deployment.
Long context
Several open models now advertise context windows in the hundreds of thousands of tokens. Advertised length and usable recall are different things; test with your actual documents before committing a RAG pipeline to any window claim.
Where should you run open models?
Hosted OpenAI-compatible providers
Together, Fireworks, DeepInfra, Groq, Cerebras, and aggregators like OpenRouter all serve the major open weights behind OpenAI-compatible endpoints, typically at a fraction of frontier-API pricing. Check their published pricing pages for current rates. Some advertise zero retention; treat that as a policy statement, per the lens above.
Decentralized marketplaces
Morpheus, a decentralized inference marketplace, routes requests to independent operators rather than one company's datacenters. That distributes trust instead of concentrating it, but the same rule holds: unless you control the hardware, retention assurances are policy, not proof.
Self-hosting
vLLM or SGLang on rented or owned GPUs for production; Ollama or llama.cpp for development and small deployments. This is the only setup where "nobody sees your prompts" is a fact rather than a claim. The trade: you own uptime, scaling, and ops. It pencils out at sustained volume or under hard compliance requirements.
How do you actually switch from the Claude API?
Step 1: Inventory your usage
Export or log a week of Anthropic traffic: which models, token volumes, and which features you actually exercise (tool use, prompt caching, extended thinking, vision). Most teams discover they use a fraction of the surface area.
Step 2: Shortlist and eval
Pick two or three candidate models and run 50–200 representative prompts through both Claude and the candidates. Grade with a rubric or an LLM judge. Your own prompts beat any public benchmark for this decision.
Step 3: Swap the base URL
Most open-model hosts expose the OpenAI chat-completions schema, so the client change is small:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.your-provider.example/v1", # your host's endpoint
api_key=os.environ["PROVIDER_API_KEY"],
)
response = client.chat.completions.create(
model="your-chosen-model", # exact name varies by provider
messages=[
{"role": "system", "content": "You are a careful assistant."},
{"role": "user", "content": "Summarize this diff."},
],
)
print(response.choices[0].message.content)
curl https://api.your-provider.example/v1/chat/completions \
-H "Authorization: Bearer $PROVIDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-chosen-model",
"messages": [
{"role": "system", "content": "You are a careful assistant."},
{"role": "user", "content": "Summarize this diff."}
]
}'
If you're coming from the Anthropic SDK rather than raw HTTP, the mapping is well-trodden: Anthropic itself publishes an OpenAI-SDK compatibility shim, which is a decent reference for how the schemas line up. The same swap, from the other direction, is covered in our guide to leaving the OpenAI API.
Step 4: Port the Anthropic-specific features
- System prompts: Anthropic takes
systemas a top-level parameter; the OpenAI schema uses a system message. Trivial. max_tokens: required on Anthropic, optional in the OpenAI schema. Set sane defaults anyway.- Tool use: Anthropic's
input_schemamaps toparametersunder OpenAItools. Both are JSON Schema; most definitions port mechanically, but test argument-validation edge cases. - Extended thinking: reasoning-style open models (DeepSeek-R1, Qwen3 thinking variants) expose chain-of-thought differently: some providers return a separate
reasoning_contentfield, some stream it inline. Normalize it in one wrapper function. - Prompt caching: Anthropic uses explicit
cache_controlbreakpoints. Many OpenAI-compatible hosts do automatic prefix caching, or none at all. Cost and latency behavior will differ; measure, don't assume.
Step 5: Shadow, then cut over
Run the new model in shadow mode against live traffic for a few days, diff the outputs, then cut over endpoint by endpoint behind a feature flag. Keep Claude wired as a fallback until the new path has survived a full traffic cycle.
What breaks when you leave Claude?
Honestly: some things. Claude's long-context recall and tool-use reliability are genuine strengths, and per-task gaps remain even as open models close the broad ones, which is why the Step 2 eval matters more than any article, including this one. Refusal behavior also differs across models and providers; DeAI's refusal-index methodology scores how models handle benign-but-edgy requests, and it is worth consulting as results publish.
Your MCP servers carry over. MCP is an open protocol, not an Anthropic product feature. What you gain in exchange for the gaps: portability across hosts, price competition at the model layer, freedom to fine-tune, and, if you self-host, an end to retention-policy risk as a category.
FAQ
Claude API data retention: what does Anthropic actually keep?
Anthropic's commercial terms state that API inputs are not used for training by default, with retention windows defined in its trust documentation. Consumer (claude.ai) terms differ and changed in 2025. Policies evolve, so read the current pages before deciding.
What is the best open-source Claude alternative?
There is no single best. For coding and agentic work, Qwen3-Coder and DeepSeek-V3 are common starting points; for general chat, Qwen3-235B, Llama 3.3 70B, and Kimi K2. Run a small eval on your own prompts before committing.
Do I have to rewrite my app to leave the Claude API?
Usually not. Most open-model hosts expose OpenAI-compatible endpoints, so the client change is a base URL, an API key, and a model name. Anthropic-specific features (tool schemas, prompt caching, extended thinking) need targeted porting.
Is self-hosting the only way to get verifiable zero retention?
Yes, if "verifiable" is the requirement. A hosted provider's zero-retention promise is a policy statement you cannot audit from outside. Self-hosting on hardware you control is the only setup where "nobody sees your prompts" is a fact, not a claim.
Questions
- Claude API data retention: what does Anthropic actually keep?
- Anthropic's commercial terms state that API inputs are not used for training by default, with retention windows defined in its trust documentation. Consumer (claude.ai) terms differ and changed in 2025. Policies evolve — read the current pages before deciding.
- What is the best open-source Claude alternative?
- There is no single best. For coding and agentic work, Qwen3-Coder and DeepSeek-V3 are common starting points; for general chat, Qwen3-235B, Llama 3.3 70B, and Kimi K2. Run a small eval on your own prompts before committing.
- Do I have to rewrite my app to leave the Claude API?
- Usually not. Most open-model hosts expose OpenAI-compatible endpoints, so the client change is a base URL, an API key, and a model name. Anthropic-specific features — tool schemas, prompt caching, extended thinking — need targeted porting.
- Is self-hosting the only way to get verifiable zero retention?
- Yes, if 'verifiable' is the requirement. A hosted provider's zero-retention promise is a policy statement you cannot audit from outside. Self-hosting on hardware you control is the only setup where 'nobody sees your prompts' is a fact, not a claim.
Sources
- Anthropic Privacy Policy — Anthropic
- Anthropic Commercial Terms of Service — Anthropic
- Anthropic API Documentation — Anthropic
- Qwen3-235B-A22B model card — Hugging Face
- DeepSeek-V3 model card — Hugging Face
- Llama 3.3 70B Instruct model card — Hugging Face
- Kimi K2 Instruct model card — Hugging Face
- vLLM Documentation — vLLM Project
About DeAI
DeAI is an independent publication covering open-weight AI models, private inference, and decentralized infrastructure — the tools for running AI you actually control. We test providers on price, privacy, and refusal behavior and publish the numbers, not the vibes. DeAI is powered by Morpheus (mor.org), a decentralized inference marketplace, and covers it on the same terms as every other provider.
Powered by Morpheus and StrandCMS
Morpheus is a decentralized inference marketplace, covered on the same terms as every other provider — we rank it wherever the data lands. StrandCMS is the open-source, agent-first framework this site is built on.
