Claude Code
Run Claude Code against FluxRouter over the Anthropic protocol by swapping the base URL.
Claude Code talks the Anthropic wire format, so it connects to FluxRouter's Anthropic endpoint at https://api.fluxrouter.ai/anthropic. You change the base URL and the key, and Claude Code routes every request through Flux.
One-click: Flux Desktop sets this up for you. Install it, sign in, and your Claude Code config is written automatically.
Manual config
The cleanest way is the env block in ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.fluxrouter.ai/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-YOUR-FLUX-KEY",
"ANTHROPIC_MODEL": "flux-auto"
}
}
Or set it in your shell and launch:
export ANTHROPIC_BASE_URL="https://api.fluxrouter.ai/anthropic"
export ANTHROPIC_API_KEY="sk-YOUR-FLUX-KEY" # or ANTHROPIC_AUTH_TOKEN
claude
ANTHROPIC_BASE_URL only swaps the host. The request body stays the standard Anthropic /v1/messages shape, which FluxRouter's /anthropic endpoint already speaks.
Caveats
- settings.json wins over your shell. If both set the same variable, the
settings.jsonenvblock takes precedence. - MCP tool search is disabled on a custom host. Claude Code turns off MCP tool search by default when pointed at a non-first-party host. Set
ENABLE_TOOL_SEARCH=trueto restore it. - First-run on a clean install. On a brand new CLI install with no prior
~/.claude.json, thesettings.jsonenvblock can fail to load on the very first run. Re-run after the first launch, or export the variables in your shell instead.
Test it
After configuring, just start claude and send a first message like "say hello." If it answers, you're routing through Flux. To confirm at the protocol level, hit the Anthropic endpoint directly:
curl https://api.fluxrouter.ai/anthropic/v1/messages \
-H "x-api-key: sk-YOUR-FLUX-KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"flux-auto","max_tokens":1024,"messages":[{"role":"user","content":"hi"}]}'