Configure Claude Code
This page explains how to connect Claude Code CLI or the Claude Code IDE extension to the LLMAPI Messages API. Use an API key whose group supports Messages.
Choose the correct key
A Regular API key's group determines whether it can call the Messages API. Prefer a key whose Use Key dialog displays the Claude Code option:
- Anthropic groups normally support Claude Code directly.
- An OpenAI group displays Claude Code configuration only when an administrator enables Messages dispatch.
- For other groups, use the Use Key dialog and the actual model list as the source of truth.
Do not assume that a key usable by Codex or OpenAI is also usable by Claude Code.
Copy configuration from the website's API Key page
- Sign in to the website and open the API Key page.
- Find the Regular API key and select Use Key.
- Select Claude Code, then choose macOS/Linux, Windows CMD, or PowerShell.
- Copy the generated terminal variables and user-level
settings.json. - Fully quit and restart Claude Code or the IDE extension.
The generated configuration uses the current service's public Base URL, and the Claude Code option is shown only for compatible keys. If the generated content differs from the example below, use the generated content.
If CC Switch is installed, you can use Import to CCS on the website's API Key page to open the import flow. After confirming the import, select Enable in CC Switch. See Configure CC Switch.
Persistent configuration
| System | File location |
|---|---|
| macOS / Linux | ~/.claude/settings.json |
| Windows | %USERPROFILE%\.claude\settings.json |
If Claude Code has already been used or configured, ~/.claude will normally exist and does not need to be recreated. Run mkdir -p ~/.claude only when the directory is missing and the configuration file cannot be saved.
Save the following user-level settings.json:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_BASE_URL": "https://api.llmapi.site",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
}
}Replace YOUR_API_KEY with the Regular API key. ANTHROPIC_BASE_URL is the service root; do not append /v1/messages.
This file contains the API key. Do not commit it to Git, send it in chat, or expose it in screenshots. If settings.json already exists, merge the env fields into the existing JSON instead of deleting unrelated Claude Code settings.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 also disables automatic updates, telemetry, error reporting, version information, Gateway model discovery, and some feature-flag requests. Remove this variable if you rely on those features; changing only the Base URL or key does not restore them.
Temporary terminal configuration
Temporary environment variables apply only to the current terminal session and are useful for validating the key and group first.
macOS / Linux:
export ANTHROPIC_BASE_URL="https://api.llmapi.site"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export CLAUDE_CODE_ATTRIBUTION_HEADER=0PowerShell:
$env:ANTHROPIC_BASE_URL="https://api.llmapi.site"
$env:ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
$env:CLAUDE_CODE_ATTRIBUTION_HEADER="0"For persistent use, prefer the user-level ~/.claude/settings.json. Do not place a plaintext key in project scripts.
VS Code / Cursor extension
The Claude Code IDE extension reads the same user-level ~/.claude/settings.json, so you do not need to store the API key again in editor settings. To suppress the extension's login prompt, add the following to the editor's user-level settings.json:
{
"claudeCode.disableLoginPrompt": true
}Use the editor's user settings, not the project's .vscode/settings.json. After saving, run Developer: Reload Window from the command palette.
Verify the configuration
You can first validate the Messages API directly:
curl https://api.llmapi.site/v1/messages \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 64,
"messages": [{ "role": "user", "content": "Reply with OK." }]
}'The model must be available to the current key. Then verify the client you actually use. You do not need to install Claude Code CLI just to verify the IDE extension.
Claude Code CLI
Confirm that the command is available:
claude --versionThen run:
claudeClaude Code IDE extension
Run Developer: Reload Window from the command palette, open the Claude Code panel, and send a new request. When configuration is loaded correctly, the extension should use LLMAPI directly instead of starting the official account sign-in flow.
Troubleshooting
| Symptom | Resolution |
|---|---|
The API returns 401 | Check that ANTHROPIC_AUTH_TOKEN is complete and the key is active. |
The API returns 404 or reports that Messages is unavailable | The key's group does not support the Messages API. Use a Regular API key whose Use Key dialog displays Claude Code. |
| The model is unavailable | Query the model list with the same key and select a Claude model exposed by the group instead of copying the example model blindly. |
| Claude Code still opens the official sign-in flow | Check the ~/.claude/settings.json path and JSON syntax. Project-level .claude/settings.json and .claude/settings.local.json take precedence over user settings, so check them for conflicts. Then fully quit and reopen Claude Code and the IDE extension. |
| The terminal works but the IDE does not | Confirm that the extension can read ~/.claude/settings.json, add claudeCode.disableLoginPrompt to the editor's user settings, and run Developer: Reload Window. |
See Anthropic's third-party provider instructions for the IDE extension and the Claude Code environment variable reference for current behavior.