The short answer
Yes. Claude Code isn't magically locked to one model — it sends requests to whatever endpoint its config points at. If that endpoint speaks the Anthropic Messages API, Claude Code will happily use it. The catch is that most alternative providers (GLM, DeepSeek, etc.) speak the OpenAI-compatible shape, not the Anthropic one, so you usually need a small proxy in between to translate.
How to point Claude Code at another model
The env vars that matter
- ANTHROPIC_BASE_URLPoint it at the endpoint you want — either a provider that natively speaks the Anthropic API, or a local proxy that translates OpenAI-compatible calls into the Anthropic shape.
- ANTHROPIC_AUTH_TOKENThe key for that endpoint (billed to you). For a local proxy this is often whatever the proxy expects.
- Model nameSet the model in config/flags to whatever the endpoint exposes (e.g. glm-4.6, deepseek-chat, or your local model).
# Example: route Claude Code through a translating proxy
export ANTHROPIC_BASE_URL="http://localhost:8080"
export ANTHROPIC_AUTH_TOKEN="your-key"
# then run claude as usualGLM, DeepSeek, and local models specifically
What each needs
| Model | How it connects | Notes |
|---|---|---|
| GLM (Zhipu) | OpenAI-compatible endpoint via a translating proxy | Cheap per token; solid for everyday coding |
| DeepSeek | OpenAI-compatible endpoint via a translating proxy | Very cheap; good value for iteration |
| Local model (vLLM/Ollama) | Local OpenAI-compatible server + proxy | Code never leaves your machine; needs the hardware |
The cleaner option: an agent that swaps models natively
The proxy route works, but you're fighting the fact that Claude Code was built around one provider. If your actual goal is "I want to run my coding agent on GLM today and something else tomorrow, without editing env vars," it's less friction to use an agent where the provider, base URL, key, and model are just settings you pick from a list. No translating proxy, no restart-to-switch.
What that looks like
Pick the model in the UI
Claude, OpenAI-compatible endpoints, GLM / Kimi / DeepSeek — switch in a click, no env-var editing.
No proxy plumbing
OpenAI-compatible providers work directly instead of needing an Anthropic-shape translator.
Local and open source
Runs on your machine, MIT-licensed, your keys and code stay yours.
FAQ
Can Claude Code use GLM or DeepSeek instead of Claude?
Yes, indirectly. Claude Code speaks the Anthropic Messages API, while GLM and DeepSeek speak the OpenAI-compatible one, so you set ANTHROPIC_BASE_URL to a small proxy that translates between the two. It works, but there's no in-app model switch — you change env vars and restart.
Can Claude Code run a fully local model?
Yes — serve the model with a local OpenAI-compatible server (like vLLM or Ollama) and put a translating proxy in front so Claude Code sees an Anthropic-shaped endpoint. Your code stays on your machine.
Is there a way to switch models without all this setup?
Use an agent built to bring your own model, where provider/base URL/key/model are settings you pick from a list. Wuwei is a free, open-source example — no translating proxy and you switch models in a click.