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.
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.
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 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"}]}'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.jsonthat gets committed to Git, or your key leaks.{ "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
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$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" claudeWhen a variable is set in both settings.json and the shell, settings.json wins.
Start claude and check /status
Run
claudeand type/status: the Anthropic base URL line should showhttps://api.88z.aiand the Auth token line should name ANTHROPIC_AUTH_TOKEN. If it shows a claude.ai login instead, the config is not active; run/logoutand reopen. Then send any prompt; a normal reply means you are done.
What each variable does
| Variable | Value | Notes |
|---|---|---|
ANTHROPIC_BASE_URL | https://api.88z.ai | Gateway address, without /v1 |
ANTHROPIC_AUTH_TOKEN | YOUR_88Z_API_KEY | Sent as Authorization: Bearer; ANTHROPIC_API_KEY (sent as x-api-key) also works here |
ANTHROPIC_MODEL | claude-sonnet-5-5 | Main model. Claude Code’s own names work; they map to anthropic/claude-sonnet-5.5 |
ANTHROPIC_DEFAULT_SONNET_MODEL / _OPUS_MODEL | claude-sonnet-5-5 / claude-opus-5-5 | What the sonnet and opus aliases in /model resolve to |
ANTHROPIC_DEFAULT_HAIKU_MODEL | claude-haiku-5-5 | Used for background tasks; without it the main model is used, which costs more |
CLAUDE_CODE_MAX_OUTPUT_TOKENS | 32000 | This 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:
| Model | Per turn | 100 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:30 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
| Error | Cause | Fix |
|---|---|---|
401 invalid_api_key | The key is wrong, deleted, or has extra spaces | Copy the key again from the workspace; check for stray spaces or line breaks. |
402 insufficient_points | Balance is too low to reserve this request | Top up and retry, or use a cheaper model or a lower max output. |
402 key_quota_exceeded | This API key has reached the point cap you set | Raise that key’s point cap in the workspace, or use another key. |
400 unsupported_model | The model name is not callable here | Use an ID from /v1/models or the catalogue, e.g. anthropic/claude-sonnet-5.5. |
400 invalid_output_limit | Max output is above the per-request cap | Set max output to 32,768 or less. |
413 input_too_large | The request text is above the cap | Trim context or start a new conversation (cap: 512 KiB, 128 messages). |
429 upstream_rate_limited | The model service is rate-limiting | Wait for Retry-After, or switch model for now. |
400 unsupported_parameter | The request carries an experimental field this site does not accept | Add "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
/compactor 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.