BYOK is live — 1,000,000 free BYOK requests every month, no top-up requiredLearn more

Guides2026-10-167 min read

Claude Code with Other Models: DeepSeek, Kimi, GLM, Qwen

Running Claude Code with other models comes down to one fact: Claude Code speaks the Anthropic Messages format, and any endpoint that serves that format can answer it. Point Claude Code at such an endpoint, name a model, and the same terminal agent, tools and workflow run on DeepSeek, Kimi, GLM, Qwen or MiniMax instead of Claude.

This guide covers the setup, which model suits which kind of work, what we saw when we tested it on 16 October 2026, and the limits worth knowing before a long session. One point first, so it is not buried: Anthropic's own documentation says it does not support routing Claude Code to non-Claude models through any gateway. It works because the protocol is shared, not because anyone certifies the combination. Test with your own repository before you depend on it.

Why run Claude Code with other models

Three reasons come up repeatedly.

  • Cost per task. A coding agent resends its system prompt, tool definitions and conversation on every turn. In our test, a one-word reply in Claude Code 2.1.295 still sent 20,751 input tokens. At those volumes, the per-token price of the model decides the bill more than any single prompt does.
  • No usage window. A subscription meters agent use in time windows, and a heavy session can run out mid-task. Pay-per-token access through an API key has no window to wait out.
  • Choice per task. Some teams keep Claude for planning and hard debugging, and hand routine edits, test runs and repository exploration to a cheaper model. Claude Code lets you set the main model, the background model and the subagent model separately.

For the wider argument about subscription windows and rate limits, see Coding Agents and Rate Walls.

How it works

Claude Code reads its endpoint from ANTHROPIC_BASE_URL and its credential from ANTHROPIC_AUTH_TOKEN (sent as a Bearer token) or ANTHROPIC_API_KEY (sent as x-api-key). Every request goes to /v1/messages on that base URL, in Anthropic's format, with the model name you configured.

BoostRail serves /v1/messages for every text model in its catalog, not only Claude. The request is translated for the route serving that model, and the response comes back as Anthropic streaming events, including tool calls. The fields that cannot be applied are listed on the Messages reference and reported in the x-boostrail-degraded response header, so nothing is dropped silently.

Setup in three steps

Step 1. Create a key in the BoostRail console. The same key works for every model in the catalog.

Step 2. Put the settings in ~/.claude/settings.json. A settings file reaches desktop launches and background agents, which shell exports do not reliably do.

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.boostrail.com",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_MODEL": "kimi-k3[1m]",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}

What each line does:

  • ANTHROPIC_AUTH_TOKEN is the credential variable Anthropic's documentation recommends when a gateway accepts Bearer tokens. While it is set, requests carry this key instead of your claude.ai login, and the subscription's limits do not apply to them.
  • ANTHROPIC_MODEL sets the main model. The [1m] suffix tells Claude Code the model has a one-million-token window; Claude Code strips it before sending, so BoostRail receives kimi-k3.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL moves background work, such as session titles and summaries, to a cheaper model.
  • CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS stops Claude Code from sending pre-release fields that only Anthropic's own API accepts.

Step 3. Check the connection before a long session. This is a direct request with the same key:

curl https://api.boostrail.com/v1/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "kimi-k3", "max_tokens": 256, "messages": [{"role": "user", "content": "Reply with OK"}]}'

A JSON body whose content array holds the reply means the key and base URL work. Leave room in max_tokens: reasoning models spend part of it thinking, and with a budget of 16 tokens Kimi K3 returned an empty content array. Then start claude, run /status, and look for the Anthropic base URL line. If it is missing, the variables did not reach the session. The coding agents page has the same settings for Codex CLI, Cline and other tools.

Which model for which job

The model ids below are the ones BoostRail accepts. The positioning comes from each lab's own model card or announcement, linked in the last column, so read it as the lab's claim rather than ours.

Model idWhat the lab says it is built forContextSource
kimi-k3Long-horizon coding, agentic knowledge work and reasoning1MMoonshot model card
glm-5.3Coding; Z.ai calls it its most capable open-weights coding modelsee cardZ.ai model card
qwen3.8-maxAutonomous coding and long-horizon execution1MAlibaba announcement
minimax-m3Long-horizon agent work, coding and long-context efficiency1MMiniMax model card
deepseek-v4.1-flashCost-efficient, input-heavy agent workloads1MDeepSeek model card

A practical split many teams start with: a strong model as the main model for planning and multi-file changes, and deepseek-v4.1-flash for background work and subagents that read and summarise code. Prices for each model, input and output, are on the Models page. For a broader look at these labs, see Chinese AI Models in 2026.

What we tested

On 16 October 2026 we ran two checks with BoostRail's internal test key.

A two-turn tool call over /v1/messages. Each model received a read_file tool and the question "What Python version does this project need?". All five models in the table above called the tool with the right file, accepted the tool result, and answered correctly with end_turn. This shows the request and response shapes Claude Code relies on round-trip correctly for these models. It is a single test per model, not a guarantee across every route.

Claude Code itself. We ran Claude Code 2.1.295 in print mode against BoostRail, with glm-5.3 as the main model, and asked it to create a Python file and run it. It wrote the file, ran it with python3, and reported the correct output in three turns. Shorter runs with kimi-k3 and deepseek-v4.1-flash as the main model also returned normally. Two details from those runs are useful:

  • Usage showed cache reads on Kimi K3 and DeepSeek V4.1 Flash (cache_read_input_tokens above zero), so repeated context was billed at the cache-read price on those runs. GLM-5.3 showed almost none.
  • Claude Code's own cost figure is computed from its built-in price table, not from your bill. For the one-word DeepSeek reply it showed $0.083; the same tokens at DeepSeek V4.1 Flash's catalog price come to about $0.003. Check spending in the BoostRail console, which records the price applied to each request.

Limits to know before a long session

  • The /model picker will not list them. With gateway model discovery on, Claude Code only keeps ids that contain "claude" or "anthropic". Type the id instead: /model glm-5.3 switches the session.
  • Context window. For an id it does not recognise, Claude Code assumes 200K tokens and compacts the conversation before that. Add [1m] for models with a one-million-token window. For a model capped below 200K, such as qwen3-coder-flash on BoostRail, set CLAUDE_CODE_AUTO_COMPACT_WINDOW to its limit.
  • Token counting. BoostRail does not serve /v1/messages/count_tokens. Claude Code falls back to its own estimate, so /context shows approximate numbers.
  • Thinking blocks. Earlier thinking blocks in the conversation history are accepted and dropped, and named in x-boostrail-degraded. Each model reasons in its own way.
  • Auto mode. Auto mode sends a separate safety-classifier request for each action, and in our run it went to a Claude model rather than the one we configured. With Claude Code 2.1.295 and a non-Claude main model, auto mode blocked the shell command it could not evaluate. Use the default permission mode with allow rules for the commands you trust.
  • A diagnostic line. Print mode starts with [claude-code:unrecognized_model] for ids Claude Code does not know. It is informational; the request still goes through.

Mixing Claude and other models

Nothing forces an all-or-nothing switch. Because every model sits behind the same endpoint and key, you can keep claude-sonnet-5 as the main model and move only background work to deepseek-v4.1-flash, or the other way round. CLAUDE_CODE_SUBAGENT_MODEL sets the default model for subagents, and a subagent definition can still name its own model. When a session needs Claude's judgement for one hard step, /model claude-sonnet-5 switches back without touching the settings file.

If your team already holds contracts with model providers, BYOK runs catalog models on your own provider keys behind the same endpoint; see the BYOK guide.

Frequently asked questions

Does Anthropic support Claude Code with other models?

No. Anthropic's documentation states that it does not support routing Claude Code to non-Claude models through any gateway. The setup works because the Messages format is shared. Treat it as a configuration you own and test it on your own code.

Will my Claude subscription still be charged?

No. While ANTHROPIC_AUTH_TOKEN is set, Claude Code sends that key instead of your claude.ai login, and the subscription's usage limits do not apply to those requests. Usage is billed per token to the BoostRail account that owns the key.

Why is DeepSeek, Kimi or GLM missing from /model?

Gateway model discovery only adds ids that contain "claude" or "anthropic". Set the model in ANTHROPIC_MODEL, or type /model followed by the id during a session.

Does prompt caching work with non-Claude models?

It depends on the model's route. Where caching is supported, cache reads appear in cache_read_input_tokens and are billed at the cache-read price shown on the Models page. In our runs Kimi K3 and DeepSeek V4.1 Flash showed cache reads and GLM-5.3 showed very few.

Which settings file should I use?

Use ~/.claude/settings.json for your own machine. Do not put the key in a project's .claude/settings.json, which is committed to the repository and shared with everyone who clones it.

Start with one API key.

BoostRail is one OpenAI-compatible API for 68 text, image and video models. An API key takes about a minute.

Last updated: 2026-10-16