Claude Code access

This site provides POST /v1/messages, which is the Anthropic message format used by Claude Code. The model fills in qwen3.8-flash, and the tool call returns tool_use.

Anthropic official description does not support routing Claude Code to non-Claude models through third-party gateways. Therefore, the following are the compatible configurations of this site and do not represent official Anthropic certification.

If not yet installed, follow Claude Code installation guide to install the client.

Current terminal configuration

Replace YOUR_API_KEY with the site token. If you use another ShangHai Do site, replace the domain name in the example with the actual site root address without /v1.

Windows PowerShell:

$env:ANTHROPIC_BASE_URL = "https://shanghaido.com"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_API_KEY"
$env:ANTHROPIC_MODEL = "qwen3.8-flash"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "qwen3.8-flash"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "qwen3.8-flash"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "qwen3.8-flash"
claude

Bash:

export ANTHROPIC_BASE_URL="https://shanghaido.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export ANTHROPIC_MODEL="qwen3.8-flash"
export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen3.8-flash"
export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen3.8-flash"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen3.8-flash"
claude

ANTHROPIC_AUTH_TOKEN will be sent as a Bearer token, that is, the request header is used to carry the site key. Check whether there are any leftover ANTHROPIC_API_KEY or tool configurations for other services to avoid using multiple sets of credentials at the same time. Do not add /v1 or /v1/messages at the end of the root address. If you want to save them for a long time, you can merge these environment variables into the env set by the existing user, or use CC Switch to manage them.

interface calling example

curl "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-flash",
    "max_tokens": 512,
    "messages": [{"role": "user", "content": "Reply with OK."}]
  }'

Read returns text of type: "text" in the content array. The tool call returns type: "tool_use", and the application is responsible for actually executing the tool and returning the results. In the current Qwen thinking mode, tool_choice: {"type":"auto"} is used first; do not forcefully specify a tool when accessing for the first time.

If the tool prompts that the model does not exist, check the model name actually sent by the tool; do not fill in the Claude official model name that is not configured on this site.

References: Claude Code gateway guide, Connect to a gateway, Gateway protocol requirements.

encountered a problem

If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, error time and error information to facilitate troubleshooting.