Claude Code

Claude Code is Anthropic's official agent for the terminal, VS Code / JetBrains, the desktop app and the browser. It understands your whole codebase, fixes bugs and writes tests across many files, handles multi-day migrations, runs commands, creates Git commits and connects to external tools through MCP.

Already have an account? Sign in

codelux.configExample
agent
claude-code
endpoint
codelux.io/v1/messages
route
anthropic / claude-sonnet-5
status
available
  • Claude Code
Codelux Gateway
  • claude-sonnet-5
  • claude-opus-5-5
  • gpt-6-sol
  • DeepSeek-V41-Flash
  • kimi-k3
  • glm-5.3
Example: Claude Code connects to Codelux Gateway at codelux.io/v1/messages and uses anthropic / claude-sonnet-5. The same agent can switch between claude-sonnet-5, claude-opus-5-5, gpt-6-sol, DeepSeek-V41-Flash, kimi-k3, glm-5.3 and more.

How to use Claude Code with Codelux

About 10 minutes: install Claude Code → create a key in Portal → import it with CC-Switch (or edit settings.json) → start Claude Code and pick a model.

1. Install Claude Code

The native installer is recommended and updates itself in the background. Homebrew, WinGet and npm also work.

Check system requirements

ItemRequirement
OSmacOS 13.0+ · Windows 10 1809+ / Server 2019+ · Ubuntu 20.04+ · Debian 10+ · Alpine 3.19+
Hardware4 GB+ RAM, x64 or ARM64 CPU
ShellBash、Zsh、PowerShell、CMD
NetworkInternet access; with Codelux, model requests go to Codelux

Run the installer

Terminal
curl -fsSL https://claude.ai/install.sh | bash

Verify the installation

Open a new terminal window and run:

Terminal
claude --version
claude doctor

You should see a version such as 2.1.211 (Claude Code). claude doctor checks the install and your settings files. If you get command not found, open a new terminal or follow the official install troubleshooting to fix your PATH.

2. Set Codelux as the provider

Claude Code connects to a gateway with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. CC-Switch writes them for you, or you can edit ~/.claude/settings.json yourself.

Create a Codelux account and API key

  1. Go to Codelux Portal and create an account (existing users sign in).
  2. Pick a subscription plan or top up in Billing — any balance works for every agent.
  3. Open API Keys in the left menu and click Create New Key. Give it a name you will recognise, such as the agent's name.
  4. After it is created, copy the API key (starts with sk-) and the API base URL. The key is shown in full only once, so keep it somewhere safe.

Install CC-Switch

CC-Switch is an open-source (MIT) desktop app that manages API providers for Claude Code, Codex, Gemini CLI, OpenCode and more. It writes the configuration files for you, so you don't have to edit them by hand. Requirements: Windows 10+, macOS 12+, or Linux x86_64/ARM64 with glibc 2.35+ and WebKitGTK 4.1 (e.g. Ubuntu 22.04+, Debian 12+).

Install with Homebrew (recommended):

Terminal
brew install --cask cc-switch

Or download CC-Switch-v{version}-macOS.dmg from Releases. It is a Universal build signed and notarized by Apple, so it runs on both Apple Silicon and Intel Macs.

CC-Switch main window listing providers for Claude Code
CC-Switch main window: pick the app at the top, then enable a provider; the orange + button adds a new one.

Import Codelux into CC-Switch in one click

  1. Keep CC-Switch running (it registers the ccswitch:// link handler on first launch).
  2. In Portal, on the success page of the key you just created, find Import to desktop clients. It is only shown on desktop browsers.
  3. On the CC-Switch card, set Target app to Claude Code, then click Import.
  4. Your browser asks to open CC-Switch — allow it. CC-Switch shows a confirmation dialog with the provider name (Codelux), endpoint and key; confirm to add it.
  5. In CC-Switch, switch to Claude Code at the top and make sure the Codelux provider is enabled.

Prefer to add it by hand? In CC-Switch click the orange + → Custom, fill in Provider name (e.g. codelux.io), Website https://codelux.io, your API Key and the Request URL (the Codelux API base URL, no trailing slash), then click Add.

CC-Switch add provider form filled in for Codelux: provider name, website, API key and request URL
Adding Codelux manually in CC-Switch. For Claude Code the request URL is the host only, without a trailing slash.

If Claude Code still asks you to log in or shows onboarding on first launch, turn on Skip Claude Code first-run confirmation in CC-Switch Settings → General and restart Claude Code. It writes hasCompletedOnboarding: true to ~/.claude.json.

CC-Switch settings with the Skip Claude Code first-run confirmation switch turned on
The skip first-run confirmation switch in CC-Switch Settings → General. · CC-Switch 用户手册 (MIT)

(Optional) Configure settings.json by hand

Without CC-Switch, add this env block to your user settings file so it applies to every project:

OSFile
macOS / Linux / WSL~/.claude/settings.json
Windows%USERPROFILE%\.claude\settings.json
~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://codelux.io",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-codelux-key",
    "ANTHROPIC_MODEL": "claude-sonnet-5"
  }
}
  • ANTHROPIC_BASE_URL: the Codelux API base URL, without /v1 — Claude Code appends /v1/messages itself.
  • ANTHROPIC_AUTH_TOKEN: your Codelux API key, sent as Authorization: Bearer.
  • ANTHROPIC_MODEL (optional): the default model. Any model ID listed in Portal → AI Hub works, e.g. claude-opus-4-8 or glm-5.2.

To try it in the current terminal only, export the variables instead:

Terminal
export ANTHROPIC_BASE_URL=https://codelux.io
export ANTHROPIC_AUTH_TOKEN=sk-your-codelux-key

(Optional) Test the connection with curl

In a terminal where the variables are exported, run the command below. A JSON reply starting with {"id":"msg_ means the URL and key both work:

Terminal
curl -X POST "$ANTHROPIC_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-sonnet-5", "max_tokens": 16, "messages": [{"role": "user", "content": "hi"}]}'

A 401 means the key is wrong or was deleted — check it in Portal.

3. Start using Claude Code

Start Claude Code in your project, confirm it is connected to Codelux, then switch models as needed.

Start and confirm the connection

Terminal
cd your-project
claude

In the session, run /status and check the Status tab:

  • Anthropic base URL shows https://codelux.io — requests are going to Codelux.
  • The auth line names ANTHROPIC_AUTH_TOKEN — your Codelux key is in use, not a claude.ai login.

Then send any prompt, such as “summarize this project”. A normal reply means you are all set.

Switch models

Run /model to open the model picker, or pass a model ID directly:

Claude Code session
/model claude-opus-4-8
/model glm-5.2
/model deepseek-v4-flash

CC-Switch or ANTHROPIC_MODEL sets the default model; a /model choice is saved as the default for new sessions. The first request after a switch re-reads the conversation without cache.

Everyday commands

CommandWhat it does
/initScan the project and create CLAUDE.md with project instructions
/statusShow the base URL, credential source and loaded settings
/modelSwitch the model for this and new sessions
/compactSummarize a long conversation to free context
claude -p "..."Run a one-off task without the interactive UI (scripts and CI)
claude doctorDiagnose install and settings problems

See the model, tokens and charge of every request in Portal → Logs.

FAQ

Claude Code still asks me to log in

Put ANTHROPIC_AUTH_TOKEN somewhere Claude Code reads before first-run setup: ~/.claude/settings.json or a shell export (a project .claude/settings.json is applied only after onboarding). With CC-Switch, turn on Skip Claude Code first-run confirmation.

I get a 401 error

The key is wrong, deleted, or in the wrong variable. Check it in Portal → API Keys, and make sure it is in ANTHROPIC_AUTH_TOKEN.

Requests fail with 404 or connection errors

ANTHROPIC_BASE_URL must be the host only, without /v1 or /v1/messages. Run the curl test above to check the address.

Can Claude Code use non-Claude models?

Yes. Set ANTHROPIC_MODEL or run /model glm-5.2 with any model ID from Portal → AI Hub; Codelux translates the request.

How do I use it in the VS Code extension?

Add the same variables to VS Code's user settings under claudeCode.environmentVariables, as described in the official gateway guide.

I see 400 errors mentioning unknown fields

Set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 in the env block. It stops Claude Code from sending pre-release request fields.

Official references