Claude Code
Claude Code runs in a terminal and as an extension for VS Code and Cursor. All three share one settings file, so you only configure it once.
Setup
- Install Claude Code:
npm install -g @anthropic-ai/claude-code. Node.js 18 or newer is required. To verify the install, runclaude --version. - Open the settings file
~/.claude/settings.json(on Windows%USERPROFILE%\.claude\settings.json). If the folder is missing, create it. - Paste the configuration and replace the key with your own from the API Keys section of the dashboard:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.codexkey.online",
"ANTHROPIC_AUTH_TOKEN": "sk_cdx_YOUR_KEY",
"ANTHROPIC_MODEL": "claude-sonnet-5[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5",
"CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-5"
}
}- Run
claude.
Important: The base URL has no /v1.
The ANTHROPIC_DEFAULT_* lines are mandatory. Without them Claude Code asks for its own default models and answers "There's an issue with the selected model".
What the variables do
| Variable | Purpose |
|---|---|
ANTHROPIC_BASE_URL | The codexkey API address, without /v1. |
ANTHROPIC_AUTH_TOKEN | Your codexkey key. |
ANTHROPIC_MODEL | The model Claude Code starts with. |
ANTHROPIC_DEFAULT_OPUS_MODEL | Model for the opus alias. |
ANTHROPIC_DEFAULT_SONNET_MODEL | Model for the sonnet alias. |
ANTHROPIC_DEFAULT_HAIKU_MODEL | Model for light background tasks (the haiku alias). |
CLAUDE_CODE_SUBAGENT_MODEL | Model used by subagents. |
Background tasks are given to Sonnet 5 because it is in both channels. Premium also has Haiku: claude-haiku-5.5 (1M context) and claude-haiku-4.5 (200K context), both cheaper than Sonnet 5. You can set them if your key runs on Premium. The Cheap channel has no Haiku, and such a request returns the error model_not_in_channel.
Instead of writing them to the file, you can set the same variables in the shell environment.
1M context
Without a suffix, Claude Code assumes the model's context is 200K and compacts history at roughly 190K. The [1m] suffix opens the full 1M, for example claude-opus-5-5[1m]. It is needed only in Claude Code and only for models with a 1M context. In other programs the model name is written without it.
Model and reasoning
The model is changed with the command /model claude-opus-5-5[1m]. Any model from the catalog will do, GPT and Gemini included, for example gpt-6-astra.
To make the model reason more deeply, put think, think hard or ultrathink in the prompt. The thinking budget is capped by the variable MAX_THINKING_TOKENS=12000.
When something goes wrong
Claude Code asks you to sign in to an Anthropic account
Close Claude Code and open it again: settings are read at launch. If it still asks you to sign in, check ANTHROPIC_BASE_URL: it must have no typos and no /v1.
Model not found
Compare the model name with the catalog: it has to match the ID column.
Error 401
The key starts with sk_cdx_ and must be active in the API Keys section. The other codes are covered in the error reference.