TokenRa
中文Get API Key

Tool integration · Claude Code · Codex

Use TokenRa in CC Switch

CC Switch is an open-source desktop app that keeps the API providers of Claude Code, Codex and other coding tools in one place and switches between them in one click. The TokenRa console can hand a key straight to CC Switch.

Works with
Claude Code, Codex
Claude Code endpoint
https://tokenra.io
Codex endpoint
https://tokenra.io/v1
Checked against
CC Switch v4.0.21

Before you start

Before you start

What we tested
The Claude Code and Codex configurations CC Switch writes were run against TokenRa in those tools on 2026-10-29. The CC Switch steps follow its v4.0.21 user manual; we did not drive the desktop app itself.

Install

Install CC Switch

Download CC Switch from its GitHub releases: the .msi installer or portable .zip for Windows 10 and later, the .dmg for macOS 12 and later, or the .deb, .rpm or .AppImage for Linux. The project's only official website is ccswitch.io. With a package manager:

SHELL
# macOS (Homebrew)
brew install --cask cc-switch

# Arch Linux
paru -S cc-switch-bin

On first start CC Switch imports your current Claude Code and Codex setup as a provider named default, so you can always switch back to it.

One click

Import from the TokenRa console

  1. Sign in and open API Keys in the console.
  2. Open the actions menu of the key you want to use and choose CC Switch.
  3. In Import to CC Switch, pick the application, Claude or Codex, keep or change the name, and choose the primary model. For Claude, also fill in the Haiku, Sonnet and Opus models, for example with the same model ID, because Claude Code uses them for its aliases and background tasks.
  4. Click Open CC Switch and allow the browser to open the app.
  5. CC Switch shows the endpoint, the masked key and the models. Confirm the import; with the option to switch to the provider after import turned on, TokenRa becomes the active provider right away.
The link carries your key
The console builds the ccswitch:// link in your browser and puts this key in it. Use it on your own computer and do not share it. The dialog also lists Gemini; Gemini CLI support on TokenRa is still being prepared, so choose Claude or Codex.
Codex with MiniMax M3.1 Flash
Edit the provider in CC Switch and add web_search = "disabled" to its config.toml, otherwise requests fail with HTTP 400. The Codex CLI page explains why.

Manual

Add TokenRa manually

Select the tool in the CC Switch sidebar, click + to add a provider and choose the custom configuration. Name it TokenRa, paste the configuration below and replace sk-... with your key. The button next to the model field fetches the model list from /v1/models, which works with a TokenRa key.

Claude Code

settings.json · env
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://tokenra.io",
    "ANTHROPIC_AUTH_TOKEN": "sk-...",
    "ANTHROPIC_MODEL": "deepseek-v4.1-flash",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4.1-flash",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4.1-flash"
  }
}

Codex

The Codex form has an auth.json part and a config.toml part:

auth.json
{
  "OPENAI_API_KEY": "sk-..."
}
config.toml
model_provider = "custom"
model = "deepseek-v4.1-flash"
web_search = "disabled"

[model_providers.custom]
name = "TokenRa"
base_url = "https://tokenra.io/v1"
wire_api = "responses"
requires_openai_auth = true

CC Switch keeps its Codex providers in [model_providers.custom] and, when you switch, writes the key into that table as experimental_bearer_token. We ran exactly that configuration in Codex CLI 0.165.0 on 2026-10-29.

Switch

Switch providers

  • In the main window, click Enable on the TokenRa card, or pick TokenRa from the CC Switch menu in the system tray.
  • Claude Code picks up the switch without a restart. Restart Codex after switching.
  • To go back, enable default, your earlier setup, or an official provider.

FAQ

FAQ

Which files does CC Switch change?

For Claude Code ~/.claude/settings.json, for Codex ~/.codex/config.toml. It only replaces the connection fields (address, key, model) and backs up each file before it rewrites it for the first time.

With or without /v1?

Claude Code uses https://tokenra.io, without /v1. Codex uses https://tokenra.io/v1. The console's one-click import sets both correctly.

Nothing happens when I click Open CC Switch

CC Switch is not installed, or the browser blocked the ccswitch:// link. Install CC Switch, click the button again and allow the browser to open the app, or add the provider manually as shown above.

Codex returns HTTP 400 about web search

Add web_search = "disabled" to the provider's config.toml in CC Switch, then restart Codex.