Use Claude Code With Other Models: GLM, DeepSeek, GPT [2026]

5 min readBy Nathan House
Claude Code

Claude Code reads two environment variables before it makes a single request: where to send it, and what key to send with it. Change those two values and the same tool — same agent, same file editing, same tools — talks to a completely different model.

Most people never touch them. They're worth knowing about, because there are five situations where you'll want them, and one of them will probably happen to you this month.

If you'd rather skip the explanation and just install the thing, the free tool is at github.com/nathanhouse/claude-model-router.

Why You'd Point Claude Code Somewhere Else

Anthropic goes down. Not often, but it happens, and when it does your session stops mid-task. A second provider configured in advance turns a dead afternoon into a five-second switch.

Your quota runs out. Same problem, more common. If you burn through your plan by Thursday, a cheap provider gets you to Monday.

Cost. GLM-4.7 costs $0.40 per million input tokens and $1.75 per million output. Claude Opus 5 is $5 in, $25 out. So you're paying somewhere between a tenth and a fifteenth as much, depending on how output-heavy the work is. For bulk jobs — first drafts, mechanical refactors, test scaffolding — that's often the right trade. I still use Claude for the hard problems. I don't use it to rename variables across forty files.

A second opinion. This is the one people underrate. When I run an adversarial code review, I deliberately send the same code to three different model families, because they have different blind spots. Claude misses things GPT catches, and the reverse is just as true. Being able to re-run a review on a different brain, without changing tools, is genuinely useful.

There's a fifth reason, and it's brand new: on 11 August 2026 Anthropic announced that supported Claude models now watermark their generated text. It applies across the API, claude.ai and Claude Code, worldwide — not just the EU. It's a statistical signal in the model's word choices, not hidden characters you could strip out.

It's worth being precise about what that does and doesn't mean, because it's already being misreported. Anthropic's own wording is that a detected mark means the text may have been processed by Claude — proofread someone else's paragraph and it gets marked too. It isn't proof of authorship. There's also no public detector yet, so nobody outside Anthropic can check anything today. If that matters to your work, I've written it up properly in our guide to AI watermarking.

The relevant point for this article is simply that other providers don't do it. There's no evidence that DeepSeek, GLM, Kimi or Qwen embed statistical text watermarks, and a model you run on your own machine can't be watermarked at all, because you control the sampling.

How It Works: Two Environment Variables

Several providers now run an Anthropic-compatible endpoint. That means they speak the same API format Claude Code already speaks, so nothing needs translating and no proxy has to sit in the middle.

$ export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
$ export ANTHROPIC_AUTH_TOKEN=your-zai-key
$ claude

That's it. Claude Code starts up as normal and every request goes to GLM instead.

Diagram: Claude Code reads ANTHROPIC_BASE_URL (which server answers) and ANTHROPIC_AUTH_TOKEN (which key pays) at startup, then routes to GLM, DeepSeek or GPT

Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY

Both variables authenticate, but ANTHROPIC_API_KEY triggers a one-time approval prompt — and if you ever decline it, Claude Code remembers and ignores that key permanently. That failure looks exactly like a broken setup. ANTHROPIC_AUTH_TOKEN takes effect immediately with no prompt.

Which Providers Have an Endpoint

I tested each of these by sending a deliberately wrong key: a 401 or 403 means the endpoint is real and checking credentials, while a 404 means it doesn't exist. Here's what came back in August 2026:

ProviderANTHROPIC_BASE_URL
z.ai (GLM)<code>https://api.z.ai/api/anthropic</code>
DeepSeek<code>https://api.deepseek.com/anthropic</code>
Moonshot (Kimi)<code>https://api.moonshot.ai/anthropic</code>
MiniMax<code>https://api.minimax.io/anthropic</code>
Alibaba (Qwen)<code>https://dashscope-intl.aliyuncs.com/apps/anthropic</code>
OpenRouter<code>https://openrouter.ai/api</code>

OpenAI is the notable absence. There is no api.openai.com/anthropic — it returns a 404. The only way to reach GPT from Claude Code is through OpenRouter, which proxies it.

OpenRouter earns a mention for a second reason: one key reaches around 400 models across every major vendor, which makes it the practical failover for exactly the case where Anthropic is the thing that's broken. The trade-off is that OpenRouter is a middleman that sees your prompts. The direct endpoints above aren't — your request goes to the vendor and nowhere else.

The Catches

One provider per session. The base URL is read at startup. /model switches models within a provider, but it can't switch providers — you start a new session for that. Worth knowing too that /model saves your choice globally, so it will follow you into your next ordinary Claude session.

Anthropic doesn't support this. Their documentation says so directly. Remote Control, voice dictation and fast mode stop working on a non-Anthropic endpoint. It works today; there's no guarantee it survives the next update.

Where your data goes. z.ai, DeepSeek, Kimi, MiniMax and Qwen all run in China. That's fine for learning and personal projects. Think properly before pointing them at client work. If that's a problem, run a model on your own machine instead — Ollama speaks the Anthropic format natively, and nothing leaves the building.

Two harmless warnings appear on every launch: one saying your model isn't recognised, one about claude.ai connectors. Both are cosmetic. Ignore them.

The Free Tool

Setting the variables by hand works, but you'll get bored of it by the third time. So I built a small tool that wraps it into one command per provider, and put it on GitHub for free:

claude-model-router

Free · MIT licensed · works in bash and zsh

Get it on GitHub →
$ git clone https://github.com/nathanhouse/claude-model-router.git ~/claude-model-router
$ echo 'source ~/claude-model-router/model-router-setup.sh' >> ~/.zshrc && source ~/.zshrc

Then:

one command per provider
cc-glm            # z.ai GLM
cc-deepseek       # DeepSeek
cc-openrouter     # GPT, Grok, Kimi — around 400 models

cc-glm -p "explain what this repo does"   # one-shot prompt

Your normal claude command is untouched and still uses Anthropic.

It's MIT licensed, and it's deliberately not a router app. Those exist, and they work, but they run a local proxy that every prompt and every API key passes through. I read the source of two popular ones earlier this year and found plaintext credential storage in one and disabled TLS certificate verification in the other — the full write-ups are in my Claude Code Router review and 9router review. This approach adds no third-party code to that path, because there's nothing in the path.

Comparison: with a router app your prompts and API keys pass through a local proxy before reaching the model provider; with a direct endpoint they go straight to the provider

It also ships with a self-test, which matters more than it sounds. Run it and it builds a simulated clean machine — empty environment, fresh home directory, keys in an unusual location — then checks the whole thing works in both bash and zsh:

$ bash model-router-selftest.sh          # no API calls, no cost
$ bash model-router-selftest.sh --live   # one real call per provider

If it fails, it tells you whether the problem is your setup or the tool. I wrote it because I'd rather you could check my work than take my word for it.

The whole thing lives at github.com/nathanhouse/claude-model-router — clone it, read it, change it.

Want to Build This Kind of Thing Yourself?

Knowing that a tool is just two environment variables and a HTTP endpoint — and being able to prove it with a probe rather than a guess — is the muscle the AI era rewards. It's what our AI Master's Program is built for: you learn AI-Driven Cyber Security Engineering and build your own personal AI infrastructure, no coding background required.

FAQ

Can Claude Code use models other than Claude?

Yes. Claude Code reads two environment variables — ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN — to decide where to send requests and what key to use. Several providers now run an Anthropic-compatible endpoint, so setting those two values points Claude Code at GLM, DeepSeek, Kimi, Qwen or (via OpenRouter) GPT and Grok, with no proxy software in between.

Which providers have an Anthropic-compatible endpoint?

As of August 2026: z.ai (GLM), DeepSeek, Moonshot (Kimi), MiniMax, Alibaba (Qwen) and OpenRouter. OpenAI is the notable absence — there is no api.openai.com/anthropic endpoint, so OpenRouter is the only route to GPT from Claude Code.

Can I switch models mid-session with /model?

Only within the same provider. The base URL is read when Claude Code starts, so /model can change which of that provider's models answers, but it cannot move you to a different provider. Changing provider means starting a new session. Note also that /model saves your choice globally, so it will affect your next ordinary Claude session too.

Does Anthropic support running Claude Code on other models?

No. Anthropic's documentation states plainly that routing Claude Code to non-Claude models through a gateway isn't supported. Remote Control, voice dictation and fast mode stop working on a non-Anthropic endpoint. It works today, but there is no compatibility guarantee across updates.

Is it safe to use a router app instead?

Be careful. Router apps run a local proxy that every prompt and every API key passes through. We audited two popular ones and found plaintext credential storage in one and disabled TLS certificate verification in the other. Pointing Claude Code straight at a vendor's own endpoint adds no third-party code to that path at all.

Do other providers watermark their output like Claude now does?

There's no evidence that DeepSeek, GLM, Kimi or Qwen embed statistical text watermarks. China's content-labelling rules require visible labels and file metadata but only encourage embedded watermarks, so the assumption that a Chinese provider would mark more is backwards. A model you run locally can't be watermarked at all, since you control the sampling.

About the Author

Nathan House

Nathan House, Founder & CEO of StationX

Nathan House has 30 years of hands-on cybersecurity experience and is Cambridge-educated, holding CISSP, CISA, CISM, OSCP, CEH, and SABSA. He founded StationX in 1999 — one of the UK’s first cybersecurity companies — and has secured £71 billion in UK mobile banking transactions and the London 2012 Olympics, advising clients including Microsoft, Cisco, BP, Vodafone, and VISA. He authored the world’s most popular cybersecurity course — a #1 Udemy bestseller taken by over 500,000 students — and was named Cyber Security Educator of the Year 2020, AI Security Educator of the Year, and a UK Top 25 Security Influencer 2025. A DEF CON speaker and featured expert on CNN, Fox News, NBC, and the BBC, Nathan leads StationX’s training of more than half a million students worldwide.