All posts

How to run Claude Code on GLM, DeepSeek, or Kimi

Point Claude Code at OhMyGPT, list the models that accept the Anthropic Messages protocol, and switch between them without changing the Claude Code setup.

Claude Code sends every request in the Anthropic Messages format. If a model accepts that format, Claude Code can use it. On OhMyGPT, GLM, DeepSeek, Kimi, and GPT models accept it, so you can change the model and keep your Claude Code setup.

You need Claude Code and an OhMyGPT API key.

Connect Claude Code

Set two variables in the shell that starts Claude Code, and then choose a model with a third one:

export ANTHROPIC_BASE_URL="https://api.ohmygpt.com"
export ANTHROPIC_AUTH_TOKEN="$OHMYGPT_API_KEY"
export ANTHROPIC_MODEL="zhipu/glm-5.3"
claude

Do not add /v1 to the base URL. Claude Code adds /v1/messages itself, and a second /v1 makes every request return 404.

To check the connection, run /status in Claude Code. The Anthropic base URL line shows https://api.ohmygpt.com.

Test without paying for tokens

The model ohmygpt/mock is free. It is available after you top up your account for the first time. Start Claude Code on it to test the key, the base URL, and one tool call:

claude --model ohmygpt/mock

Find a model that works

The catalog changes often, so list the models instead of copying IDs from an article. This command prints each available model that accepts the Messages format:

curl -s https://api.ohmygpt.com/v1/models \
	| jq -r '.data[] | select(.available and any(.protocols[]?; .id == "anthropic-messages")) | .id'

On 22 November 2026, the command printed 151 IDs. Four of them are:

Model IDContext window in tokens
zhipu/glm-5.31,048,576
moonshot/kimi-k3.1-pro1,048,576
deepseek/deepseek-v4.1-flash-10171,000,000
anthropic/claude-sonnet-5-51,000,000

The Models page shows the price of each model, and the Rankings page compares their capability scores.

Switch models during a session

Type /model and a model ID:

/model moonshot/kimi-k3.1-pro

Claude Code also runs background work, such as session titles, on a Haiku-class model. If you want that work on another model, set it before you start Claude Code:

export ANTHROPIC_DEFAULT_HAIKU_MODEL="zhipu/glm-5.3"

Stay on one model within a long task. Each model keeps its own prompt cache, so the first request after a switch reads nothing from the cache. How to cut agent costs with prompt caching shows the numbers.

Let omgvibe set the variables

omgvibe is our open-source command-line tool. It starts Claude Code with the key, the endpoint, and the model for that session only. It does not edit the Claude Code configuration files.

npm install -g omgvibe
ov claude --model zhipu/glm-5.3

omgvibe needs Node.js 20.12 or newer. The same command starts Codex (ov codex) and opencode (ov opencode).

Know the limits

Claude Code is built for Claude models. Other models run its tools, but prompts that Anthropic tuned for Claude can produce different results on them. Compare models on one real task from your repository before you move a team.

If a request fails, the Claude Code guide lists each error with its cause and its fix.

Try it

Create an API key, and then send your first request with the quickstart.