The simplest way to run Claude Code on a cheaper model needs no extra software at all. Claude Code reads a base-URL and a token from the environment, so if your provider exposes an Anthropic-compatible endpoint, you just point Claude Code at it and go. No proxy, no router, no translation layer.
This explains how that works, which providers support it, and exactly how to set it up on Windows and WSL. It’s the method to prefer whenever it’s available — see the overview in use cheap AI models with Claude Code.
What “Anthropic-compatible” means
Claude Code communicates using Anthropic’s Messages API format. An Anthropic-compatible endpoint is any server that accepts that exact format and replies in kind. Because the shapes match, Claude Code can’t tell the difference — it sends the same requests it always would, just to a different address.
That’s the whole trick. Several Chinese providers ship these endpoints specifically so tools like Claude Code work out of the box.
The setup
Three environment variables do it. For DeepSeek:
export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-your-deepseek-key"
export ANTHROPIC_MODEL="deepseek-chat"
claude
That’s it — Claude Code now runs on DeepSeek. The ANTHROPIC_MODEL value sets which model to use; some providers also use a small/fast model variable for lightweight calls.
Which providers support it
Anthropic-compatible base URLs (confirm on provider docs)
| DeepSeek | https://api.deepseek.com/anthropic |
|---|---|
| Z.AI (GLM) | https://api.z.ai/api/anthropic |
| Moonshot (Kimi) | https://api.moonshot.ai/anthropic |
These are the well-known ones; more providers add them over time. Always verify the current base URL and model IDs in the provider’s own Claude Code guide, since they change with new releases. Per-model walkthroughs: DeepSeek, GLM-5, Kimi.
Setting variables on Windows vs WSL
WSL (recommended): add them to your shell profile so they persist:
echo 'export ANTHROPIC_BASE_URL="https://api.deepseek.com/anthropic"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="sk-your-key"' >> ~/.bashrc
echo 'export ANTHROPIC_MODEL="deepseek-chat"' >> ~/.bashrc
source ~/.bashrc
Native Windows (PowerShell): set them for the session, or use setx to persist:
$env:ANTHROPIC_BASE_URL = "https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-key"
$env:ANTHROPIC_MODEL = "deepseek-chat"
claude
Endpoint vs router: when to use which
Anthropic endpoint vs Claude Code Router
| Anthropic endpoint | No proxy, fewer parts; needs provider support |
|---|---|
| Claude Code Router | Works with OpenAI-only providers; adds per-task routing |
Use the Anthropic endpoint when your provider offers one and you want one model. Use Claude Code Router when the provider is OpenAI-only, or when you want to route background, thinking, and long-context tasks to different models.
Verify
Start Claude Code and run a trivial task — list files, summarize the README. If it responds and edits normally, the endpoint is live. If you get auth errors, the token variable isn’t set in the current shell; if you get format errors, you’re probably on the OpenAI URL instead of the Anthropic one.
Anthropic endpoint checklist
- Confirm the provider's Anthropic-compatible base URL
- Set ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL
- Use the /anthropic endpoint, not the /v1 one
- Persist the vars in ~/.bashrc (WSL) or via setx (Windows)
- Test on a small task; unset to return to Claude
Wrapping up
When a provider offers an Anthropic-compatible endpoint, running Claude Code on it is the cleanest path there is: set ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_MODEL, and launch. No proxy, nothing to maintain. DeepSeek, GLM, and Kimi all support it; just be sure you’re using the /anthropic URL and not the OpenAI one.
When your provider is OpenAI-only or you want smart routing, reach for Claude Code Router. Either way, the model decision is covered in cheapest AI coding API in 2026.