Auto Configuration Guide
TopRouter provides a unified API endpoint to access 200+ models. To prevent manual configuration errors, use the template environment variables and verification commands below to set up your clients.
::: important API Base URL The official API Base URL is: https://toprouter.cc (do not append /v1 at the end). :::
1. Prepare Your API Key
Before configuration, log in to the console to create an API Key:
- Go to the API Keys page.
- Click Create API Key.
- Copy your API Key (it will only be displayed once).
2. Environment Variables Configuration
OpenAI Compatible Client Environment Variables
For OpenAI SDK, Cherry Studio, Cursor, and other compatible clients, configure the following variables:
export OPENAI_BASE_URL="https://toprouter.cc"
export OPENAI_API_KEY="your_toprouter_api_key_here"
export OPENAI_MODEL="openai/gpt-5.5" # Example modelClaude Code Environment Variables
For Claude Code (command-line tool) using the Anthropic compatible endpoint:
export ANTHROPIC_BASE_URL="https://toprouter.cc"
export ANTHROPIC_API_KEY="your_toprouter_api_key_here"
# Optional settings to disable telemetry and headers
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export CLAUDE_CODE_ATTRIBUTION_HEADER=0Authentication Conflict
Do not set ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY simultaneously, as it may cause authentication conflicts in some versions of Claude Code.
3. Persistent Profile Configuration (Windows PowerShell)
For Windows users who wish to persist environment variables across PowerShell sessions:
- Open your PowerShell profile in Notepad:powershell
notepad $PROFILE - Append the following lines and save:powershell
$env:OPENAI_BASE_URL="https://toprouter.cc" $env:OPENAI_API_KEY="your_toprouter_api_key_here" $env:OPENAI_MODEL="openai/gpt-5.5" - Restart PowerShell or run
. $PROFILEto apply.
4. Verification
Verify your environment settings by running the following cURL command in your terminal:
curl https://toprouter.cc/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.5",
"messages": [{"role": "user", "content": "Reply exactly toprouter-ok"}]
}'