Quickstart: run Claude Code on it

The gateway speaks Anthropic’s message format, so the agent runs against it with no shim and no proxy in between.

The environment

export ANTHROPIC_BASE_URL=https://api.magmarouter.com
export ANTHROPIC_AUTH_TOKEN=rl-...
export ANTHROPIC_MODEL=qwen/qwen3-coder-30b-a3b-instruct
export ANTHROPIC_DEFAULT_HAIKU_MODEL=qwen/qwen3-30b-a3b-instruct-2507
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144

claude

The base URL carries no /v1. The Anthropic SDK appends /v1/messages itself, and adding it yourself produces a 404 that looks like an auth problem.

Why the Haiku variable matters

The agent uses its background model for session titles and other side calls. Leave ANTHROPIC_DEFAULT_HAIKU_MODEL unset and those go to a model you did not choose and may not be able to serve. Set it to something cheap and tool-capable; qwen/qwen3-30b-a3b-instruct-2507 is the default the guides use.

What a session actually costs

A coding agent re-sends its system prompt and every tool definition on each turn. For Claude Code that is roughly 25,000 tokens per call, so the cost floor of a session is the harness, not your question. A one-word message is never cheap.

Budget for the harness, not the prompt Pick a model by its input price, because on an agent session input dominates. A cheap input price with an expensive output price will usually beat the reverse.

What does not work

Anthropic’s server-side tools, web search among them, have no chat-completions equivalent upstream, so they are unavailable here regardless of model. Everything else, including local tool use and file edits, works.