Configure Claude Code to use the Quobit gateway through the Anthropic-compatible /v1/messages endpoint.

Step 1 — Install Claude Code

shell
npm install -g @anthropic-ai/claude-code
claude --version

Node.js 18 or later is required.

Install the Claude Code CLI and confirm the version before configuring it.

Step 2 — Create an API key

Create your own key in the Quobit console under API keys. Treat the key as private data: do not commit it, paste it into tickets or chat, or write it into logs.

Step 3 — Choose a model and the gateway base URL

Pick a public model alias enabled for your plan; glm-5.2 is available on Lite and Pro. Set a main model and a fast model: background tasks need quick responses, so point the Haiku alias at a fast model. This example uses glm-5.2 as the main model and kimi-k2.7-code for the Haiku alias. Availability varies by plan — not every account or plan can use both; check the Models page. Do not assume every background task or every auto-mode version uses the Haiku model. The base URL is the gateway origin only. Claude Code appends /v1/messages itself, so do not add /v1 to the base URL (that would produce /v1/v1/messages). This differs from the Codex guide, which points base_url at /v1.

Step 4 — Open or create settings.json

Claude Code reads user settings from ~/.claude/settings.json. On Windows this is C:\Users\<you>\.claude\settings.json; on macOS and Linux it is ~/.claude/settings.json. Create the file if it does not exist.

Step 5 — Paste the configuration and restart Claude Code

settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.quobit.ai",
    "ANTHROPIC_AUTH_TOKEN": "<your-api-key>",
    "ANTHROPIC_MODEL": "glm-5.2",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-5.2",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.2",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2.7-code",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "16000",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "100000"
  }
}

Replace <your-api-key> with your own key, and use a public alias enabled for your plan. Never commit this file: it holds your key.

Paste valid JSON — no comments and no trailing commas — save the file, then restart Claude Code (exit and run claude again) so the new session picks up the settings.

Per-plan options

settings.json (Pro)
{
  "env": {
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "160000"
  }
}

Use the block below only if your plan is Pro. Keep your existing settings.json and add this env var, or change only its value — do not replace the whole file, or you would drop your gateway, key, and model settings. Never set CLAUDE_CODE_MAX_CONTEXT_TOKENS above your plan's per-request limit.

The example above uses the Lite value CLAUDE_CODE_MAX_CONTEXT_TOKENS=100000. On Pro, use 160000. Both are buffers below your plan's per-request limit (Lite 128,000 tokens; Pro 200,000 tokens) so a request that also reserves output tokens still fits. CLAUDE_CODE_MAX_OUTPUT_TOKENS stays 16000 on both. These values only shape what Claude Code assumes; they do not raise your plan's limits.

Step 6 — Test the connection

shell
claude -p "Reply with exactly: OK"

With a correct configuration, Claude Code replies "OK".

If Claude Code is currently signed in to an Anthropic account, run /logout in that session before switching to the gateway, then start a new session.

Common errors

  • Missing or invalid API key: check the ANTHROPIC_AUTH_TOKEN.
  • Invalid model: use a public model alias enabled for your account (see the Models page).
  • Invalid base URL: set ANTHROPIC_BASE_URL to the gateway origin without a trailing /v1.
  • Plan limit reached (429 rate_window_exceeded): you have hit your plan's 5-hour cost window. Wait for the window to reset or upgrade your plan, and reduce the number of subagents running in parallel. This rolling 5-hour window is different from exhausting the whole billing cycle's quota.