Coding agents
Claude Code
Anthropic's coding agent, routed through Melious — two env vars, no fork, full session support
Claude Code is Anthropic's official terminal coding agent — a single claude command that reads files, makes edits, runs tools, and holds a session's worth of context across turns. The distinguishing behavior is how hard it pushes on exploration: slash commands, long tool chains, multi-file edits, thorough summaries. Because it reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, pointing it at Melious is two environment variables — our Messages endpoint implements the Anthropic SDK and maps claude-* model names to the open-weight models we actually run.
With the Melious CLI
With the Melious CLI installed and signed in, two commands take you from nothing to a session:
melious tools install claude-code
melious launch claude-codeFor Claude Code, tools install prints Anthropic's installer command for your OS rather than running it — run that line yourself, then launch from inside your project. The first launch in a project asks Trust this workspace? The agent runs as you, with your Melious key, so Melious asks before handing it over; the answer defaults to no. Workspace trust covers what a grant means and how to revoke it.
Melious configures Claude Code through environment variables only, scoped to the launched process: the base URL, your key as ANTHROPIC_AUTH_TOKEN, the model slots (main, secondary, lightweight), and a longer request timeout. It clears an inherited ANTHROPIC_API_KEY and the other-provider selectors for that process, and writes no file — your Claude settings, sessions, and login stay where Claude Code put them. Melious sets CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, which reduces nonessential traffic; Claude Code's own policies apply. Models, -- passthrough, and exit status: launching a coding agent.
Manual setup (alternative)
For when you'd rather not use the Melious CLI. These steps set the same variables by hand.
Install Claude Code
Use Anthropic's official installer.
macOS, Linux, WSL:
curl -fsSL https://claude.ai/install.sh | bashWindows PowerShell:
irm https://claude.ai/install.ps1 | iexOr a package manager:
brew install --cask claude-code # macOS, Linux
winget install Anthropic.ClaudeCode # Windows
npm install -g @anthropic-ai/claude-code # any platform, needs Node.jsPoint Claude Code at Melious
Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment. The base URL is https://api.melious.ai — without /v1. The Anthropic SDK appends its own version prefix, and double-prefixing breaks routing.
# Required.
export ANTHROPIC_BASE_URL=https://api.melious.ai
export ANTHROPIC_AUTH_TOKEN=sk-mel-<YOUR_API_KEY>
export ANTHROPIC_API_KEY=""
# Recommended. Pins every slot Claude Code may reach for at
# runtime — including hard-coded names like `claude-haiku-4-5`
# Anthropic uses for background tasks — to a known Melious model.
# Also raises the request timeout for long agent runs.
# CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC reduces nonessential traffic
# to Anthropic; Claude Code's own policies apply.
export ANTHROPIC_MODEL=<MODEL_ID>
export ANTHROPIC_SMALL_FAST_MODEL=<LIGHTWEIGHT_MODEL_ID>
export ANTHROPIC_DEFAULT_OPUS_MODEL=<MODEL_ID>
export ANTHROPIC_DEFAULT_SONNET_MODEL=<MODEL_ID>
export ANTHROPIC_DEFAULT_HAIKU_MODEL=<LIGHTWEIGHT_MODEL_ID>
export API_TIMEOUT_MS=3000000
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1ANTHROPIC_API_KEY must be explicitly empty. If it's set to a real Anthropic key — from a previous direct-Anthropic setup, a CI secret, or a sourced dotfile — the SDK sends it as x-api-key next to your ANTHROPIC_AUTH_TOKEN, and we read x-api-key first. Every request then fails with 401 authentication_error. Blank it once, in the same place you set the other two.
If you've previously signed in with claude login, run /logout first to drop cached Anthropic credentials.
The five ANTHROPIC_*_MODEL lines decide which Melious model each slot runs. Without them, every name Claude Code sends still works — anything containing opus, sonnet, or haiku maps to our default for that tier — but you get our defaults, not your pick. Pick model IDs from melious.ai/hub/models.
For a repo-checkable config, drop the same values into .claude/settings.local.json (Claude Code reads this on startup):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.melious.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-mel-<YOUR_API_KEY>",
"ANTHROPIC_API_KEY": "",
"ANTHROPIC_MODEL": "<MODEL_ID>",
"ANTHROPIC_SMALL_FAST_MODEL": "<LIGHTWEIGHT_MODEL_ID>",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "<MODEL_ID>",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "<MODEL_ID>",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "<LIGHTWEIGHT_MODEL_ID>",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}Run a session
claudeAsk it something and watch the usual Claude Code surface come up — agent mode, file edits, slash commands, tool calls. What changed is where the inference runs.
Sanity-check the wiring with /status inside the session — the auth token and base URL lines should read:
Auth token: ANTHROPIC_AUTH_TOKEN
Anthropic base URL: https://api.melious.aiIf Anthropic base URL is empty or shows api.anthropic.com, the env vars didn't reach the process — check the same shell you launched claude from.
How model names are mapped
Claude Code hard-codes Anthropic model names (opus, sonnet, haiku). We match these names and route each tier to a Melious model so you don't need a patched client:
| Claude Code sends (anything containing) | Routes to |
|---|---|
opus | main model |
sonnet | secondary model |
haiku | lightweight model |
| anything else | the string as-is |
The response carries the original claude-sonnet-4 (or whichever name you sent) back in the model field — so Claude Code's internal checks don't trip.
Browse melious.ai/hub/models for the current model list.
Picking a specific model
Most current Claude Code releases accept arbitrary --model strings, so this works:
claude --model <MODEL_ID>If your version validates against Anthropic's allow-list, set the ANTHROPIC_DEFAULT_*_MODEL env vars instead — Claude Code passes whatever string you put there straight through to the API:
export ANTHROPIC_MODEL=<MODEL_ID>
export ANTHROPIC_SMALL_FAST_MODEL=<LIGHTWEIGHT_MODEL_ID>
export ANTHROPIC_DEFAULT_OPUS_MODEL=<MODEL_ID>
export ANTHROPIC_DEFAULT_SONNET_MODEL=<MODEL_ID>
export ANTHROPIC_DEFAULT_HAIKU_MODEL=<LIGHTWEIGHT_MODEL_ID>
export CLAUDE_CODE_SUBAGENT_MODEL=<MODEL_ID>Claude Code passes these through verbatim, and we run the string as a model ID — an ID from GET /v1/models works, anything else is a 404 not_found_error — so they're the most reliable way to lock in a specific model. Pin every slot — Claude Code uses *_HAIKU_* and SMALL_FAST_MODEL for background and agent-spawn calls, so leaving them unset can route quietly to whatever's mapped to haiku. Find current IDs at melious.ai/hub/models.
What's different
- No
environment_impactorbilling_costin responses. Claude Code talks to our Messages endpoint, which returns neither field, streamed or not — there's nothing for the SDK to pass along. Usage is still logged and surfaced in your usage dashboard. - Explicit
cache_controlblocks aren't exposed. There's no handle to mark a prefix as cacheable. Transparent prefix caching still happens on the provider side and shows up asusage.cache_read_input_tokens, billed at the cheaper cache-read rate — so repeated context within a session does benefit, even though Claude Code can't set cache breakpoints. See Models. - Extended thinking works on reasoning models. Send
thinking: {"type": "enabled", "budget_tokens": 8000}to turn it on,{"type": "disabled"}to turn it off, or leave it out for the model's default. Claude Code's effort setting reaches the model too — it's sent asoutput_config.effortand wins over the budget.xhighandmaxarrive as sent only onglm-5.3andglm-5.3-flash; on every other model they fold tohigh. Thinking comes back as athinkingcontent block before the text (signatureis always an empty string — don't send it back expecting Anthropic to verify it).
When it breaks
404on every request —ANTHROPIC_BASE_URLends in/v1. The SDK appends/v1/messagesitself, so the request goes to/v1/v1/messages, which doesn't exist. Set the base URL tohttps://api.melious.ai.401on every request — three causes. The token string lost itssk-mel-prefix when you copied it, or the key was rotated: paste the full 128-character key. OrANTHROPIC_API_KEYis set somewhere (shell, dotfile, CI secret): the SDK sends it asx-api-key, which we check before the bearer token. Blank it:export ANTHROPIC_API_KEY="". If you previously ranclaude login, also/logoutto drop cached creds./statusshows the wrong base URL — env vars didn't reach the process. Re-export in the same shell you launchedclaudefrom, or move the values into.claude/settings.local.jsonso they're read at startup regardless of shell state.- Tool loops feel different than with Claude — model-capability thing, not a protocol thing. Stronger models handle longer tool sequences; smaller ones give up earlier. Check
_meta.capabilities.function_callingonGET /v1/models?include_meta=trueand override the mapping withANTHROPIC_DEFAULT_*_MODELfor long agent sessions.
Errors and retry patterns: Errors.