Skip to main content

One command →

curl -fsSL https://get.aireserve.com/install.sh | sh installs the aireserve CLI and configures Claude Code with the full gateway model catalog in its native /model picker — plus a session-cost status line and a one-command undo.

Or connect in one click →

The guided connect page creates a managed key for your account and writes the env block of ~/.claude/settings.json for you — no terminal work.
Everything below is the manual equivalent. Claude Code is configured entirely through environment variables — no code change, no plugin. Set the base URL to the host root (no /v1), pass your AI Reserve key as the auth token, and make sure ANTHROPIC_API_KEY is empty so the CLI doesn’t prefer it:
Add the exports to your shell profile (or the env block of ~/.claude/settings.json) to make the routing permanent. Requests hit /v1/messages — including count_tokens — so the full agent loop, tool use, and prompt caching work unchanged.
Neither the one-click flow nor aireserve configure claude-code touches .mcp.json, ~/.claude.json, or the environment your MCP servers start with — your own MCP servers run exactly as they do first-party. See MCP servers behind the gateway for the one kind that does not (claude.ai Connectors) and for the optional environment isolation.
Short-lived tokens with the CLI. aireserve configure claude-code no longer puts your key in settings.json. It sets Claude Code’s apiKeyHelper to aireserve token claude-code and CLAUDE_CODE_API_KEY_HELPER_TTL_MS to the five minutes. Every helper invocation validates or renews its cached token at the gateway, and every session authenticates with a token that expires within the hour — the long-lived key stays in ~/.config/aireserve/credentials.json. The manual environment-variable flow above still authenticates with the key itself via ANTHROPIC_AUTH_TOKEN; both work, and pausing or revoking the key in the portal stops both on the next request. See the CLI page.

Why the [1m] suffix?

When Claude Code talks to a gateway it can’t verify 1M support, so it budgets a 200K window by default — the context meter fills five times faster than first-party even though the gateway serves the full window. The [1m] id form tells Claude Code to budget the same 1M-token context it has first-party. It works on every extended-context model (claude-sonnet-4-6, claude-sonnet-5, claude-opus-5, fable-5, opus-4-8):
Claude Code strips the suffix before sending and adds the anthropic-beta: context-1m-2025-08-07 opt-in, which the gateway relays to Anthropic — and the gateway also accepts the [1m] id form directly, so either convention works. Selecting a 1M variant from the /model picker is known not to stick behind a custom base URL; pin it through the environment variable instead. Tokens are billed at the model’s normal rates.

Full model catalog in the /model picker

Claude Code (≥ 2.1.118) can populate its native /model picker straight from the gateway:
At startup Claude Code fetches /v1/models and lists every model your key can serve, with real display names. Models outside the Claude family appear under self-naming ids like claude-air-gpt-5.6-sol[1m] (Claude Code only lists claude/anthropic-prefixed ids) — the id always names the model that serves the request, and the response’s x-aireserve-served-model header records it. Add X-Gateway-Model-View: all on a second line of ANTHROPIC_CUSTOM_HEADERS to list the full catalog instead of the recommended compact set. The aireserve CLI sets all of this up (and undoes it) for you.

MCP servers behind the gateway

claude.ai Connectors stop working behind the gateway. The moment ANTHROPIC_AUTH_TOKEN is set, Claude Code drops your claude.ai login for the session — and Connectors (Gmail, Google Drive, Google Calendar, Linear, …) ride on that login. This is a Claude Code limitation (anthropics/claude-code#48011, closed “not planned”); no gateway can work around it.
Most Connectors have a native MCP server you can add directly — same tools, one-time OAuth in your browser, and it keeps working whether the gateway is configured or not:
After switching between gateway and first-party auth, a native MCP server may ask you to re-authenticate once (/mcp → select → authenticate) — a known Claude Code token-refresh issue (#59460, #61214), not data loss. Your server registrations are never removed.

Optional: isolate MCP server environments

Claude Code can start stdio MCP servers with only a safe baseline environment plus each server’s own env block, instead of your full shell environment (CLAUDE_CODE_MCP_ALLOWLIST_ENV=1 in Anthropic’s environment-variable reference). AI Reserve does not turn this on for you: any server that reads a token from your shell rather than its own env stops starting, which looks like “my MCP servers disappeared behind the gateway”. If you want the isolation anyway — for example so gateway credentials never reach a third-party MCP process — declare each server’s credentials in its own env first, then opt in:
If MCP servers went missing after an earlier AI Reserve setup that enabled this by default, re-running aireserve configure claude-code (or the next session-start refresh) releases it; on the manual or one-click flow, remove the line or set it to 0.

Claude Agent SDK

The embeddable agent runtime takes the same three variables via options.env: