Skip to content
InferenceHub

Claude Code

Anthropic's CLI agent, on the Anthropic Messages wire. Reaches: every enabled Claude model, plus the open-weight daily drivers — GLM-5.2, DeepSeek 3.2, Kimi K2.6, MiniMax M2.5, Qwen3.5 — with tool calls and thinking.

Install: npm install -g @anthropic-ai/claude-code (verify with claude --version).

60-second demo — Claude Code routed through InferenceHub, switching between Claude and open-weight models with /model.
1

Add the gateway to ~/.claude/settings.json

Point ANTHROPIC_BASE_URL at the bare origin (no /v1) and set ANTHROPIC_AUTH_TOKEN to your key:

// ~/.claude/settings.json
{
"env": {
"ANTHROPIC_BASE_URL": "https://app.inferencehub.tech",
"ANTHROPIC_AUTH_TOKEN": "sk-prov-live-YOUR_KEY",
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
},
"model": "sonnet"
}
The model field sets the default for every new session — a short alias like sonnet, opus, or haiku. CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY (Claude Code ≥ 2.1.129) makes the /model picker list every model on your plan automatically — Claude ids as-is, open-weight models under claude-code-* aliases (claude-code-glm-5.2, … — same models, same prices). To pin a version: claude --model claude-sonnet-4-6 at launch, or /model claude-sonnet-4-6 mid-session.
2

Prefer environment variables?

Save them to your shell profile so they persist across sessions:

echo 'export ANTHROPIC_BASE_URL="https://app.inferencehub.tech"' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN="sk-prov-live-YOUR_KEY"' >> ~/.zshrc
echo 'export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY="1"' >> ~/.zshrc
source ~/.zshrc

Using bash or fish? Replace ~/.zshrc with ~/.bashrc or ~/.config/fish/config.fish.

3

Run Claude Code

Start a session — it now routes through InferenceHub, and your spend appears in the portal under Usage & Billing:

claude

Open-weight daily drivers

Claude Code can drive every open-weight model on the platform — glm-5.2, deepseek-3.2, deepseek-v4-pro, kimi-k3, kimi-k2.6, minimax-m2.5, qwen3.5-397b-a17b — on the same Anthropic-compatible endpoint, tool calls and thinking included. Set one as the default ("model": "glm-5.2" in settings.json), pick it from the /model picker (listed as claude-code-glm-5.2, …), or per-session:

export ANTHROPIC_MODEL="glm-5.2"
export ANTHROPIC_SMALL_FAST_MODEL="glm-5.2" # background calls stay open-weight too
claude

Switch mid-session with /model kimi-k3 — or back to opus for design work. On a plan, open-weight and lower-priced Claude usage (like sonnet) draws the standard windows; premium models like opus draw the shared premium budget — see Billing & plans. Note: image attachments aren't supported on the open-weight models.

Troubleshooting

If you see…Fix
401 / invalid API keyCheck the key is a live sk-prov-live-… and ANTHROPIC_BASE_URL is the bare origin (no /v1).
/model shows only sonnet / opus / haiku, not your full catalogGateway discovery isn't running. Confirm CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY is "1", that CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC is not set (it suppresses discovery), and Claude Code is v2.1.129 or newer. The bare ids (glm-5.2) still work via --model even without discovery.
Still asks for an Anthropic login, or a "subscription tier" 403 on /loginThat's Claude Code's own Anthropic billing, not the gateway. Run /logout, then launch again — the config authenticates with ANTHROPIC_AUTH_TOKEN, so no Anthropic login is needed. A stale shell export of ANTHROPIC_BASE_URL also wins over settings.json — echo $ANTHROPIC_BASE_URL and unset any old one.