Skip to content

Integrations with Agents ​

This page explains how to connect common agents and developer tools to the Site URL, including API BaseURL, API keys, model IDs, and practical client configuration.

Unified rules:

  • API BaseURL: use the value from the “API BaseURL” section on the Overview page, for example https://cn-api.tokenfor.me for the CN2 region
  • OpenAI / xAI-compatible endpoints: usually use <API BaseURL>/v1
  • Anthropic / Claude Code: usually use <API BaseURL> and let the client append /v1/messages
  • Gemini-compatible endpoints: usually use <API BaseURL>/v1beta
  • API key / token: the key created in the Site URL console
  • One key is bound to one vendor group. Use separate keys for GPT, Claude, Gemini, and Grok groups when they are configured separately

Default models used in this page:

  • GPT: gpt-5.6-sol
  • Claude: claude-opus-5
  • Gemini: gemini-3-pro-preview

Generic HTTP template ​

If a tool supports OpenAI-compatible APIs, first verify the route with a simple request:

http
POST <API BaseURL>/v1/chat/completions
Authorization: Bearer <Your_API_Key>
Content-Type: application/json

{
  "model": "gpt-5.6-sol",
  "messages": [
    { "role": "user", "content": "Hello, test whether the Site URL is working." }
  ]
}

For the CN2 region, the full request URL is:

text
https://cn-api.tokenfor.me/v1/chat/completions

Codex (ChatGPT) Configuration ​

Codex reads model provider settings from ~/.codex/config.toml. For TokenFor, use the OpenAI Responses wire API.

macOS ​

Edit the config file:

bash
nano ~/.codex/config.toml

Add or update:

toml
model_provider = "tokenforme"
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
disable_response_storage = true

[model_providers.tokenforme]
name = "tokenfor.me"
base_url = "https://cn-api.tokenfor.me/v1"
wire_api = "responses"
requires_openai_auth = false
env_key = "Tokenforme_KEY"

Then put the key in your shell environment:

bash
nano ~/.zshrc
bash
export Tokenforme_KEY="sk-your-key"

Reload the shell config and start Codex:

bash
source ~/.zshrc
codex

If you are not using the CN2 region, replace https://cn-api.tokenfor.me in base_url with the API BaseURL from the Overview page.

Windows ​

Edit:

text
%USERPROFILE%\.codex\config.toml

Use the same TOML config:

toml
model_provider = "tokenforme"
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
disable_response_storage = true

[model_providers.tokenforme]
name = "tokenfor.me"
base_url = "https://cn-api.tokenfor.me/v1"
wire_api = "responses"
requires_openai_auth = false
env_key = "Tokenforme_KEY"

Set the user environment variable in PowerShell:

powershell
[Environment]::SetEnvironmentVariable("Tokenforme_KEY", "sk-your-key", "User")
$env:Tokenforme_KEY = "sk-your-key"
codex

After changing persistent environment variables, reopen the terminal so Codex can read them.

Claude Code Configuration ​

Claude Code uses an Anthropic Messages-style endpoint. Use the API BaseURL without /v1, for example https://cn-api.tokenfor.me, so the client does not accidentally call /v1/v1/messages.

macOS ​

Option 1: use shell environment variables.

bash
nano ~/.zshrc
bash
export ANTHROPIC_BASE_URL="https://cn-api.tokenfor.me"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
export ANTHROPIC_MODEL="claude-opus-5"
bash
source ~/.zshrc
claude

Option 2: use Claude Code settings.

bash
mkdir -p ~/.claude
nano ~/.claude/settings.json
json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://cn-api.tokenfor.me",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
    "ANTHROPIC_MODEL": "claude-opus-5"
  }
}

Windows ​

Set user environment variables in PowerShell:

powershell
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://cn-api.tokenfor.me", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-your-key", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "claude-opus-5", "User")

$env:ANTHROPIC_BASE_URL = "https://cn-api.tokenfor.me"
$env:ANTHROPIC_AUTH_TOKEN = "sk-your-key"
$env:ANTHROPIC_MODEL = "claude-opus-5"
claude

You can also edit:

text
%USERPROFILE%\.claude\settings.json
json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://cn-api.tokenfor.me",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
    "ANTHROPIC_MODEL": "claude-opus-5"
  }
}

If your Claude Code version only reads ANTHROPIC_API_KEY, put the same key there instead of ANTHROPIC_AUTH_TOKEN. Avoid mixing different Claude keys on the same machine.

CC Switch Configuration ​

CC Switch is useful when you want one place to manage providers for Claude Code, Codex, Gemini CLI, OpenClaw, Hermes, and similar tools. Get one target tool working first, then move the route into CC Switch.

To add a TokenFor provider in CC Switch:

  1. Open CC Switch and click +
  2. Prefer App-specific provider
  3. Choose a custom provider for the current target app
  4. Enter the API key and endpoint
  5. Fetch models or enter the model ID manually
  6. Save and switch to the provider
  7. Reopen the terminal used by the target tool

Common values:

Target toolEndpointModelAPI format
Codexhttps://cn-api.tokenfor.me/v1gpt-5.6-solOpenAI Responses
Claude Codehttps://cn-api.tokenfor.meclaude-opus-5Anthropic Messages
Geminihttps://cn-api.tokenfor.me/v1betagemini-3-pro-previewGemini

For Codex custom format, confirm that the generated ~/.codex/config.toml contains:

toml
model_provider = "tokenforme"
model = "gpt-5.6-sol"

[model_providers.tokenforme]
base_url = "https://cn-api.tokenfor.me/v1"
wire_api = "responses"
requires_openai_auth = false
env_key = "Tokenforme_KEY"

For Claude custom format, confirm that the generated environment block contains:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://cn-api.tokenfor.me",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
    "ANTHROPIC_MODEL": "claude-opus-5"
  }
}

Hermes Configuration ​

Hermes stores its main config in ~/.hermes/config.yaml. Put secrets in ~/.hermes/.env. For a first working GPT route, configure it as an OpenAI-compatible Responses endpoint.

Edit the secret file:

bash
nano ~/.hermes/.env
bash
OPENAI_API_KEY=sk-your-key

Edit the model config:

bash
nano ~/.hermes/config.yaml
yaml
model:
  provider: openai
  default: gpt-5.6-sol
  base_url: "https://cn-api.tokenfor.me/v1"
  api_mode: responses

You can also switch models inside a Hermes session:

text
/model gpt-5.6-sol

For Claude or Gemini models in Hermes, choose the matching provider type in Hermes model settings and use:

  • Claude: claude-opus-5
  • Gemini: gemini-3-pro-preview

Config changes usually apply to new sessions. Restart Hermes or switch models inside the session if an existing chat keeps using the old model.

Cherry Studio Configuration ​

Cherry Studio supports custom model providers. The usual path is:

text
Settings -> Model Services -> Add

OpenAI-compatible / GPT ​

Add a custom provider:

FieldValue
Provider typeOpenAI or OpenAI Compatible
API addresshttps://cn-api.tokenfor.me
API Keysk-your-key
Modelgpt-5.6-sol

Some Cherry Studio versions append /v1/chat/completions automatically. If the full URL or an extra /v1 fails, check whether the actual request became /v1/v1/chat/completions.

Claude ​

Add an Anthropic provider:

FieldValue
Provider typeAnthropic
API addresshttps://cn-api.tokenfor.me
API Keysk-your-key
Modelclaude-opus-5

Gemini ​

Add a Gemini provider:

FieldValue
Provider typeGemini
API addresshttps://cn-api.tokenfor.me/v1beta
API Keysk-your-key
Modelgemini-3-pro-preview

After saving, run Check/Test Connection. If models are not fetched automatically, add the model IDs manually.

OpenClaw Configuration ​

OpenClaw can use separate providers for GPT, Claude, Gemini, and Grok. One key is bound to one vendor group, so use the matching key for each group.

GPT ​

json
{
  "models": {
    "providers": {
      "tokenforme-gpt": {
        "baseUrl": "<API BaseURL>/v1",
        "apiKey": "sk-your-key",
        "models": [
          {
            "id": "gpt-5.6-sol",
            "name": "gpt-5.6-sol",
            "api": "openai-responses",
            "reasoning": true,
            "input": ["text"]
          }
        ]
      }
    }
  }
}

Claude ​

json
{
  "models": {
    "providers": {
      "tokenforme-claude": {
        "baseUrl": "<API BaseURL>/v1",
        "apiKey": "sk-your-key",
        "models": [
          {
            "id": "claude-opus-5",
            "name": "claude-opus-5",
            "api": "anthropic-messages",
            "reasoning": true,
            "input": ["text"]
          }
        ]
      }
    }
  }
}

Gemini ​

json
{
  "models": {
    "providers": {
      "tokenforme-gemini": {
        "baseUrl": "<API BaseURL>/v1beta",
        "apiKey": "sk-your-key",
        "api": "google-generative-ai",
        "models": [
          {
            "id": "gemini-3-pro-preview",
            "name": "gemini-3-pro-preview",
            "api": "google-generative-ai",
            "reasoning": false,
            "input": ["text", "image"]
          }
        ],
        "authHeader": true,
        "request": {
          "headers": {
            "Authorization": "Bearer ${models.providers.tokenforme-gemini.apiKey}"
          }
        }
      }
    }
  }
}

Grok ​

json
{
  "models": {
    "providers": {
      "tokenforme-grok": {
        "baseUrl": "<API BaseURL>/v1",
        "apiKey": "sk-your-key",
        "models": [
          {
            "id": "grok-4.5",
            "name": "grok-4.5",
            "api": "openai",
            "reasoning": true,
            "input": ["text", "image"]
          }
        ]
      }
    }
  }
}

Continue Plugin ​

Example Continue config for VS Code:

yaml
name: TokenFor Models
version: 0.0.1
schema: v1

models:
  - name: gpt-5.6-sol
    provider: openai
    model: gpt-5.6-sol
    apiKey: "sk-your-key"
    apiBase: "<API BaseURL>/v1"

  - name: claude-opus-5
    provider: anthropic
    model: claude-opus-5
    apiKey: "sk-your-key"
    apiBase: "<API BaseURL>"

  - name: gemini-3-pro-preview
    provider: gemini
    model: gemini-3-pro-preview
    apiKey: "sk-your-key"
    apiBase: "<API BaseURL>/v1beta"

If your Continue version does not support one of these provider types, switch that model to a provider type supported by your local version and verify it with a short test request.

Other Tools ​

For Qoder, Cursor, and other tools that support custom model APIs, the usual flow is:

  1. Find the Model, Provider, API, or Endpoint settings
  2. Use <API BaseURL>/v1 for OpenAI-compatible tools
  3. Use <API BaseURL> for Anthropic-compatible tools
  4. Use <API BaseURL>/v1beta for Gemini-compatible tools
  5. Paste the API key created in the Site URL console
  6. Select or enter a model ID, such as gpt-5.6-sol, claude-opus-5, or gemini-3-pro-preview
  7. Save and send a short test message

If the tool has Test Connection, Check, or Fetch Models, use it before running long tasks.

Debugging & Troubleshooting ​

  • Authentication failure: check whether the key is correct, enabled, and belongs to the vendor group for the selected model
  • Connection failure: make sure the BaseURL is the API BaseURL from the Overview page, not a website URL
  • Path failure: check whether /v1 was appended twice, especially in Cherry Studio and Claude Code
  • Model not found: confirm the model is enabled in the console and use the exact model ID
  • CC Switch change not applied: reopen the target CLI terminal and confirm it reads the same config directory
  • Codex still uses official OpenAI: confirm requires_openai_auth = false, env_key, and the environment variable name match exactly