Claude Code

Point Claude Code at a Tokenmaxer access token.

Before you start

  • Claude Code installed, with claude on your PATH. The setup script configures a harness; it does not install one. Install Claude Code →
  • Node.js 18 or newer, which the setup script runs on.
  • A Tokenmaxer API key. Create one →

Run the setup script

Run this, pick Claude Code, and paste your key when it asks. It writes the configuration below for you, backing up anything it touches.

Terminal
curl -fsSL https://tokenmaxer.dev/setup.sh | bash

To skip the menu, pass the harness: curl -fsSL https://tokenmaxer.dev/setup.sh | bash -s -- claude-code. Run it again after connecting another provider plan to refresh the available models, or curl -fsSL https://tokenmaxer.dev/setup.sh | bash -s -- --undo to put your files back.

Test it

Terminal
claude -p 'which model are you?'

The reply names a Tokenmaxer model id, and `/model` lists the Tokenmaxer models rather than stock Claude ones.

Configure it manually

This is what the setup script writes, for anyone who would rather edit the files themselves. Replace<YOUR_KEY> with your Tokenmaxer access token.

  • Map the alias slots, not `ANTHROPIC_MODEL`

    Setting `ANTHROPIC_MODEL` alone pins you to one model. Mapping the four alias slots instead makes `/model opus|sonnet|haiku` and `--model` resolve to Tokenmaxer models, so the picker keeps working.

  • `ANTHROPIC_SMALL_FAST_MODEL` is not an optimisation

    Claude Code runs background work on a small model, and without the override it requests a stock Haiku id the proxy does not serve.

  • `CLAUDE_CODE_ALWAYS_ENABLE_EFFORT` keeps the effort flag

    Claude Code gates the `--effort` selector on a hardcoded model list that these ids are not on. Without this, `--effort low|medium|high|xhigh|max` is unavailable.

  • The 1M models need a `[1m]` suffix

    Claude Code has no registry entry for these ids and falls back to a 200K window, so every Claude model compacts four fifths early. `[1m]` on the model name is its own opt-in for the full window and is stripped before the request is sent. `CLAUDE_CODE_DISABLE_1M_CONTEXT` turns this off again.

  • Codex models need an explicit context window

    Claude Code has no registry entry for these ids, assumes a 200K window, and starts auto-compacting 72K early. It warns on every run until `CLAUDE_CODE_MAX_CONTEXT_TOKENS` is set.

  • `CLAUDE_CODE_AUTO_MODE_SERVER=0` keeps auto mode from stalling

    Behind any gateway Claude Code asks the server to run auto mode's classifier by adding a `safeguards` field, which a subscription seat never sends and Tokenmaxer does not forward. Claude Code then shows a notice that holds the first checked action until you press Enter. Turning the server classifier off matches what a native Max session sends and skips the notice.

Claude models

~/.claude/settings.json

Points Claude Code at Tokenmaxer and maps its four model slots, so `/model` and `--model` keep working.

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tokenmaxer.dev",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_KEY>",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5-5[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-5-5[1m]",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "anthropic/claude-fable-5-1[1m]",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-5-5[1m]",
    "ANTHROPIC_SMALL_FAST_MODEL": "anthropic/claude-haiku-5-5[1m]",
    "CLAUDE_CODE_ALWAYS_ENABLE_EFFORT": "1",
    "CLAUDE_CODE_AUTO_MODE_SERVER": "0"
  }
}

ChatGPT models

~/.claude/settings.json

Points Claude Code at Tokenmaxer's Codex serviceId.

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tokenmaxer.dev",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_KEY>",
    "ANTHROPIC_MODEL": "openai/gpt-5.6-terra",
    "ANTHROPIC_SMALL_FAST_MODEL": "openai/gpt-6-luna",
    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "872000",
    "CLAUDE_CODE_AUTO_MODE_SERVER": "0"
  }
}