← All guides

Can you use other models with Claude Code?

The short answer is yes — Claude Code talks to an Anthropic-compatible endpoint, so if a provider exposes that shape you can route to it. Here's exactly what to set, what breaks, and the cleaner path if you just want an agent that swaps models without hacks.

TL;DR: Claude Code can be pointed at any endpoint that speaks the Anthropic Messages API by setting ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. That covers GLM, DeepSeek, and OpenAI-compatible models fronted by a proxy that translates to the Anthropic shape. It works but is fiddly — one global endpoint, easy to misconfigure, and tool-calling quirks vary by model. If you want to switch models in a click without editing env vars, use an agent that's built to bring your own model.

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

  1. 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.
  2. ANTHROPIC_AUTH_TOKENThe key for that endpoint (billed to you). For a local proxy this is often whatever the proxy expects.
  3. 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 usual
Reality check: this is one global endpoint. There's no clean in-app 'switch model' — to change providers you edit env vars and restart. Tool-calling and long-context behavior also vary by model, so some models drive the agent loop better than others.

GLM, DeepSeek, and local models specifically

What each needs

ModelHow it connectsNotes
GLM (Zhipu)OpenAI-compatible endpoint via a translating proxyCheap per token; solid for everyday coding
DeepSeekOpenAI-compatible endpoint via a translating proxyVery cheap; good value for iteration
Local model (vLLM/Ollama)Local OpenAI-compatible server + proxyCode 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.

If you want to run a coding agent on GLM, DeepSeek, or a local model — and switch whenever you like without editing env vars — Wuwei is a free, open-source AI agent built to bring your own model. Pick the provider, base URL, key, and model from a list and route wherever you want.

Windows · macOS · Linux — free, no login