Claude Code

Point ANTHROPIC_BASE_URL at this gateway — two env vars, plus the model id list and how to debug 402 / 400

Claude Code switches API endpoints through environment variables. Point the base URL at this gateway and every claude-* model goes through us.

Before you start#

  • An API key: create one at dianqi.zsopc.com/dashboard/keys. The format is the sk-gpushare- prefix plus 64 hex characters (76 in total), and you can re-reveal it on its detail page at any time (stored encrypted server-side).
  • A balance above zero: every key draws on the same account balance (a USD wallet), and sign-up includes $0.30 of trial credit. At zero balance even a perfect configuration gets 402 / billing_error on the very first message. Top up at dflop.top/dashboard/billing (Stripe, $1 minimum, same SSO account and shared balance as dianqi.zsopc.com).

Setup#

# ~/.bashrc or ~/.zshrc
export ANTHROPIC_BASE_URL=https://dianqi.zsopc.com
export ANTHROPIC_AUTH_TOKEN=sk-gpushare-<64 hex characters>

Then restart Claude Code:

claude

Check it worked#

Send any message — Claude Code shouldn't report 401 or 403. To confirm you're going through this gateway rather than straight to Anthropic, use a freshly created key and check whether usage shows up at dianqi.zsopc.com/dashboard/keys.

Switching model#

The gateway matches model ids exactly (only case-insensitively): there are no -latest aliases, and dated official ids are not normalised onto catalog ids. Sending an id outside the catalog returns 400 (under the Anthropic protocol, error.type=not_found_error with a message like model `xxx` is not available).

Currently available claude-* ids (as of June 2026; full pricing in Models):

Model IDNotes
claude-opus-4-8 / claude-opus-4-7 / claude-opus-4-6The Opus line, 1M context
claude-sonnet-4-6Sonnet, 1M context
claude-haiku-4-5-20251001Haiku — recommended as the background helper model
claude-opus-4-5-thinking / claude-opus-4-6-thinkingThinking-mode variants

If your Claude Code client defaults to a model id that isn't in the table above (newer clients may default to a more recent official id), pin both the main and the background model to catalog ids:

export ANTHROPIC_MODEL=claude-opus-4-6
export ANTHROPIC_SMALL_FAST_MODEL=claude-haiku-4-5-20251001

If the background helper model's id (used for title generation and similar) isn't in the catalog, those helper features fail silently — set both.

Non-Claude models work here too: the /v1/messages endpoint has Anthropic-protocol channels for GLM, Gemini, GPT and others, so setting ANTHROPIC_MODEL to glm-5.1, gemini-3-pro-preview or gpt-5.5 routes through the gateway without changing clients. For fuller multi-model support, try FlopCode — this platform's official fork.

Several keys at once#

Use direnv to set a different ANTHROPIC_AUTH_TOKEN per project directory:

# project-a/.envrc
export ANTHROPIC_BASE_URL=https://dianqi.zsopc.com
export ANTHROPIC_AUTH_TOKEN=sk-gpushare-projectA-key

# project-b/.envrc
export ANTHROPIC_BASE_URL=https://dianqi.zsopc.com
export ANTHROPIC_AUTH_TOKEN=sk-gpushare-projectB-key

Each key gets its own usage audit trail and allowed_models allowlist. Note that all keys share one account balance — splitting by project buys access control and auditing, not budget isolation.

Knowledge base over MCP#

Claude Code is itself an MCP client: the same sk-gpushare-* key can also plug in this platform's knowledge search (https://dianqi.zsopc.com/mcp). Setup: Knowledge base API & MCP.

Going back to Anthropic#

Delete the two export lines from ~/.bashrc / ~/.zshrc and open a new terminal (or unset them in the current shell):

unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN

Then start claude and run /login in the session to sign back into your Anthropic account.

Known limitations#

  • POST /v1/messages/count_tokens isn't implemented: token-counting requests from the Anthropic SDK and Claude Code get a 404. Normal conversation is unaffected.

Troubleshooting#

SymptomWhat to check
401 / 403Whether the key was copied in full (sk-gpushare- prefix plus 64 hex characters, 76 total), and whether it's expired or disabled
402 billing_errorBalance is low or zero. Top up at dflop.top/dashboard/billing; all keys share one balance, so a new key won't help
400 not_found_error (model not available)The model id isn't in the catalog and must match Models exactly (no -latest aliases) — see "Switching model" above
Network timeoutsWhether a firewall blocks dianqi.zsopc.com; the upstream ceiling is 180s per request, so set your client timeout to ≥ 200s

More error codes: Error codes.

Other clients#