Skip to content

Claude Code

Claude Code can go through a gateway instead of a claude.ai account: it reads the API address and the key from two environment variables. Once set up, you use it exactly as usual.

  • A Kloria key, ideally dedicated to Claude Code (see Quickstart).
  • macOS 13+, Windows 10+ or a recent Linux distribution.
  1. Install Claude Code

    Fenêtre de terminal
    curl -fsSL https://claude.ai/install.sh | bash

    Open a new terminal and check with claude --version. If it’s already installed, skip to the next step.

  2. Point Claude Code at Kloria

    Open (or create) your user settings file:

    • macOS / Linux: ~/.claude/settings.json
    • Windows: %USERPROFILE%\.claude\settings.json

    Add the following env block, with your key instead of sk-…:

    ~/.claude/settings.json
    {
    "env": {
    "ANTHROPIC_BASE_URL": "https://api.kloria.dev",
    "ANTHROPIC_AUTH_TOKEN": "sk-…",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-5"
    }
    }

    If the file already has other settings, just add the env key next to them.

  3. Start Claude Code and check

    In your project folder:

    Fenêtre de terminal
    claude

    Type /status: the Anthropic base URL line should show https://api.kloria.dev, and an Auth token line should mention ANTHROPIC_AUTH_TOKEN. Close the menu and send a message: a normal reply confirms everything goes through Kloria.

Variable Role
ANTHROPIC_BASE_URL Sends requests to Kloria instead of Anthropic. No /v1: Claude Code adds it.
ANTHROPIC_AUTH_TOKEN Your Kloria key, sent in the Authorization: Bearer header. It takes precedence over an existing claude.ai login.
ANTHROPIC_DEFAULT_OPUS_MODEL The model used when you pick “Opus” in /model.
ANTHROPIC_DEFAULT_SONNET_MODEL The model used for “Sonnet”, the default choice.
ANTHROPIC_DEFAULT_HAIKU_MODEL The model used for “Haiku” and for background tasks (session titles, summaries).
  • During a session: /model, then pick Opus or Sonnet. Aliases are resolved by the variables above.
  • At launch: claude --model claude-opus-5-5.
  • For a one-off session, you can also set ANTHROPIC_MODEL to the model ID you want.

Available IDs are on Models and pricing.

If you’d rather not write the key in settings.json, keep ANTHROPIC_BASE_URL and the models in the file, remove ANTHROPIC_AUTH_TOKEN, and export it in your shell before starting claude:

Fenêtre de terminal
read -s ANTHROPIC_AUTH_TOKEN && export ANTHROPIC_AUTH_TOKEN
claude

A variable exported in the shell only applies to that terminal and the programs started from it. Never put the key in a project’s .claude/settings.json: that file is shared with the repository.

What changes compared with a claude.ai account

Section titled “What changes compared with a claude.ai account”

Through a gateway, Claude Code turns off features tied to a claude.ai account: Remote Control, voice dictation and fast mode (/fast). Everything else (agents, MCP, hooks, plugins, plan mode) works normally.

Your claude.ai login, if you have one, stays saved but unused while ANTHROPIC_AUTH_TOKEN is set. Remove the variable to go back to your account.

Variable When to add it
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = 1 If you get 400 errors mentioning anthropic-beta, context_management or “Extra inputs are not permitted”.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = 1 To turn off telemetry and version checks. It also disables auto-updates: run claude update from time to time.
CLAUDE_CODE_SUBAGENT_MODEL To force a model for subagents, for example claude-sonnet-5 while the main session runs on Opus.

All of these go in the same env block of the settings file.

Symptom Check
Claude Code asks you to log in to claude.ai The key isn’t read. Make sure ANTHROPIC_AUTH_TOKEN is in ~/.claude/settings.json (not a project file) and that the JSON is valid: claude doctor reports it.
/status doesn’t show api.kloria.dev ANTHROPIC_BASE_URL isn’t applied. Same check as above.
401 error The key is invalid, disabled or expired. Check it in the console, or create a new one.
403 error mentioning “quota” Your balance or the key’s quota is used up. See Credits and billing.
Startup warning about two authentication sources A claude.ai login exists alongside the key. /logout removes it, the Kloria key stays.

More cases on the Troubleshooting page.

© 2026 Kloria — private beta