Skip to content

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:

  1. Go to the API Keys page.
  2. Click Create API Key.
  3. 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:

bash
export OPENAI_BASE_URL="https://toprouter.cc"
export OPENAI_API_KEY="your_toprouter_api_key_here"
export OPENAI_MODEL="openai/gpt-5.5" # Example model

Claude Code Environment Variables

For Claude Code (command-line tool) using the Anthropic compatible endpoint:

bash
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=0

Authentication 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:

  1. Open your PowerShell profile in Notepad:
    powershell
    notepad $PROFILE
  2. 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"
  3. Restart PowerShell or run . $PROFILE to apply.

4. Verification

Verify your environment settings by running the following cURL command in your terminal:

bash
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"}]
  }'

Unified AI API Gateway — Access 200+ models through one endpoint.