GUIDE · CLAUDE CODE

Use Claude Code with 88Z.ai

Claude Code officially supports connecting through an LLM gateway: set the gateway address and a credential. This guide gives a copy-ready settings.json, how to confirm it works, and how to fix common errors.

Reviewed 2026-11-26 · Based on the official Claude Code gateway docs

Claude models only. Anthropic states it does not support routing Claude Code to non-Claude models through any gateway, so do not set GPT or DeepSeek here; use Cherry Studio or the OpenAI-compatible API for those.
  1. Create an API key and top up

    Sign in, create a key under Workspace → API keys (shown once), then top up with Alipay in the wallet, CNY 10–500 per payment.

  2. Test the key with curl

    Confirm the key and balance before touching Claude Code. A JSON reply with text in content means it works; testing with Haiku costs almost nothing.

    curl

    curl https://api.88z.ai/v1/messages \
      -H "Authorization: Bearer YOUR_88Z_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "content-type: application/json" \
      -d '{"model":"claude-haiku-5-5","max_tokens":32,"messages":[{"role":"user","content":"ping"}]}'
  3. Write ~/.claude/settings.json

    Put it in your user settings ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json) so it applies to every project. Do not put it in a project .claude/settings.json that gets committed to Git, or your key leaks.

    ~/.claude/settings.json

    {
      "env": {
        "ANTHROPIC_BASE_URL": "https://api.88z.ai",
        "ANTHROPIC_AUTH_TOKEN": "YOUR_88Z_API_KEY",
        "ANTHROPIC_MODEL": "claude-sonnet-5-5",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5",
        "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "32000"
      }
    }
    Just trying it? Use environment variables

    macOS / Linux (bash, zsh)

    export ANTHROPIC_BASE_URL=https://api.88z.ai
    export ANTHROPIC_AUTH_TOKEN=YOUR_88Z_API_KEY
    export ANTHROPIC_MODEL=claude-sonnet-5-5
    export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-5-5
    export CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000
    claude

    Windows PowerShell

    $env:ANTHROPIC_BASE_URL = "https://api.88z.ai"
    $env:ANTHROPIC_AUTH_TOKEN = "YOUR_88Z_API_KEY"
    $env:ANTHROPIC_MODEL = "claude-sonnet-5-5"
    $env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-5-5"
    $env:CLAUDE_CODE_MAX_OUTPUT_TOKENS = "32000"
    claude

    When a variable is set in both settings.json and the shell, settings.json wins.

  4. Start claude and check /status

    Run claude and type /status: the Anthropic base URL line should show https://api.88z.ai and the Auth token line should name ANTHROPIC_AUTH_TOKEN. If it shows a claude.ai login instead, the config is not active; run /logout and reopen. Then send any prompt; a normal reply means you are done.

What each variable does

VariableValueNotes
ANTHROPIC_BASE_URLhttps://api.88z.aiGateway address, without /v1
ANTHROPIC_AUTH_TOKENYOUR_88Z_API_KEYSent as Authorization: Bearer; ANTHROPIC_API_KEY (sent as x-api-key) also works here
ANTHROPIC_MODELclaude-sonnet-5-5Main model. Claude Code’s own names work; they map to anthropic/claude-sonnet-5.5
ANTHROPIC_DEFAULT_SONNET_MODEL / _OPUS_MODELclaude-sonnet-5-5 / claude-opus-5-5What the sonnet and opus aliases in /model resolve to
ANTHROPIC_DEFAULT_HAIKU_MODELclaude-haiku-5-5Used for background tasks; without it the main model is used, which costs more
CLAUDE_CODE_MAX_OUTPUT_TOKENS32000This site caps output at 32,768 tokens per request; a higher value returns 400 invalid_output_limit

What Claude Code roughly costs

Each agent turn resends a long context, most of it from the prompt cache. Estimate for one turn with 60,000 input tokens (50,000 cached) and 2,000 output tokens:

ModelPer turn100 turns
anthropic/claude-haiku-5.5¥0.0215¥2.15
anthropic/claude-sonnet-5.5¥0.387¥38.7
anthropic/claude-opus-5.5¥0.774¥77.4

Prices as of 2026-11-27 23:25 Beijing time (UTC+8), from the live catalogue, generated from the same source as /models.json. Unit: CNY per 1M tokens. Reference prices follow price changes by the model services, and models are added or retired over time, so prices and the model count can differ between visits. When quoting a price, include the catalogue time and treat /models.json as the current value. First-time cache writes are billed at the cache-write rate and are not included. Estimate with your own usage →

Common errors

ErrorCauseFix
401 invalid_api_keyThe key is wrong, deleted, or has extra spacesCopy the key again from the workspace; check for stray spaces or line breaks.
402 insufficient_pointsBalance is too low to reserve this requestTop up and retry, or use a cheaper model or a lower max output.
402 key_quota_exceededThis API key has reached the point cap you setRaise that key’s point cap in the workspace, or use another key.
400 unsupported_modelThe model name is not callable hereUse an ID from /v1/models or the catalogue, e.g. anthropic/claude-sonnet-5.5.
400 invalid_output_limitMax output is above the per-request capSet max output to 32,768 or less.
413 input_too_largeThe request text is above the capTrim context or start a new conversation (cap: 512 KiB, 128 messages).
429 upstream_rate_limitedThe model service is rate-limitingWait for Retry-After, or switch model for now.
400 unsupported_parameterThe request carries an experimental field this site does not acceptAdd "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1" to env and restart Claude Code.

Known limitations

  • Per request: up to 128 messages and 512 KiB of text. Very long sessions may hit 413; run /compact or start a new session.
  • This site has no count_tokens endpoint, so Claude Code falls back to estimates and /context shows approximate counts. Billing is unaffected.
  • Per the official docs, features tied to a claude.ai account, such as Remote Control, are unavailable with gateway credentials.

Related