Reference documentation. Available models, billing and routing depend on the current site configuration.

CLIENT INTEGRATIONS

Connect the tools you already use

Choose the protocol first, then enter the key, matching Base URL, and an exact model ID from the live catalog.

Last updated:

Choose a client

Endpoint rules

Client protocolBase URLFinal request
OpenAI compatiblehttp://localhost:3000/v1 /v1/chat/completions or /v1/responses
Anthropic Messageshttp://localhost:3000/v1/messages
Long-running generationhttp://localhost:3000/v1The matching OpenAI-compatible resource path
A 404 usually means the path was joined twice

Inspect the final request URL for a duplicated /v1 or resource path before changing the key or model.

RECOMMENDED IMPORT

CC Switch (CCS)

Use one-click import from API keys for supported tools, including Claude Code, Cursor, OpenClaw, and Hermes.

  1. Install the latest CC Switch release.
  2. Open the target key and choose CCS import.
  3. Select the application and a model that is available to the key group.
  4. Confirm the redacted key and endpoint before allowing the browser to open ccswitch://.
Success signal

The target tool returns a response and the same model request appears in usage logs with HTTP 200.

The import also turns on CC Switch's balance query, refreshed every 5 minutes. The remaining amount is what the key can still spend: the account balance for an unlimited key, and for a key with a quota the smaller of its remaining quota and the account balance. The used amount is the key's own spend. Other tools can call GET http://localhost:3000/v1/dashboard/billing/credit_grants with the same key; total_available is the remaining amount, in CNY.

Hermes configuration

For Hermes OpenAI-compatible mode, use http://localhost:3000/v1 as the Base URL and keep the wire protocol on chat_completions. A named custom provider should use the custom:<name> form in model.provider; a bare custom provider can be reinterpreted by Hermes when the model name looks like a Responses-only model.

model:
  default: YOUR_MODEL_ID
  provider: custom:ccapi

custom_providers:
  - name: ccapi
    base_url: http://localhost:3000/v1
    api_key: sk-your-token
    api_mode: chat_completions
    model: YOUR_MODEL_ID

OPENAI RESPONSES

Codex CLI

Define the provider in the user-level ~/.codex/config.toml and keep the key in an environment variable.

~/.codex/config.toml
model = "YOUR_MODEL_ID"
model_provider = "ccapi"

[model_providers.ccapi]
name = "懂api"
base_url = "http://localhost:3000/v1"
env_key = "DONGAPI_API_KEY"
wire_api = "responses"
Shell test
export DONGAPI_API_KEY="sk-your-key"
codex exec "Reply with ok"

Confirm a /v1/responses request in usage logs. See the official Codex configuration reference for current keys.

ANTHROPIC MESSAGES

Claude Code

Use Bearer authentication through ANTHROPIC_AUTH_TOKEN. The Base URL must not include /v1.

Shell
export ANTHROPIC_BASE_URL="http://localhost:3000"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
export ANTHROPIC_MODEL="YOUR_MODEL_ID"

claude -p "Reply with ok"
Pi long-session caching

Pi uses the short Claude prompt-cache retention by default. For repository sessions that may pause for more than five minutes, start Pi with PI_CACHE_RETENTION=long and enable supportsLongCacheRetention plus sendSessionAffinityHeaders in the custom Anthropic provider compatibility settings. 懂api high-cache Claude groups also fill in a one-hour TTL when the client requested caching but omitted the TTL; explicit client TTLs remain unchanged.

export PI_CACHE_RETENTION=long

"compat": {
  "supportsLongCacheRetention": true,
  "sendSessionAffinityHeaders": true
}

If the request still goes to the official host, inspect the variables in the current shell and restart Claude Code. See the Claude Code gateway reference.

OPENAI COMPATIBLE

Cursor and desktop clients

Cursor Chat, Cherry Studio, Chatbox, Open WebUI, LobeChat, and similar clients normally use these fields:

Provider fields
Provider: OpenAI compatible
API Key: sk-your-key
Base URL: http://localhost:3000/v1
Model: YOUR_MODEL_ID
  1. Add the exact model ID shown in Models.
  2. Restart clients that cache provider settings.
  3. Send “Reply with ok” in a new chat and verify the request in usage logs.