Skip to main content
Pioneer exposes an Anthropic-compatible API. Claude Code can use it like a custom gateway: set ANTHROPIC_BASE_URL, authenticate with your Pioneer API key, and switch models with /model or pioneer/auto.

Quick setup

1

Install Claude Code

Download and set up Claude Code.
2

Persist Pioneer env vars

Create ~/.pioneer/env with these contents:
3

Clear stale Claude.ai auth

Sign out of Claude.ai so Claude Code uses your Pioneer key:
If Claude Code previously asked whether to trust this API key and you chose No, move the key tail from customApiKeyResponses.rejected to approved in ~/.claude.json, or rerun setup from the Pioneer dashboard integration guide (it repairs this automatically).
4

Install the routed-savings hook

When you use pioneer/auto, Pioneer stamps pioneer_savings on each response — the per-1M-token price difference between the model the router picked and a frontier reference model. Claude Code does not surface that by default, so install a Stop hook (Claude Code’s end-of-turn hook) that multiplies those rate differences by your actual token usage, sums them across the session, and ends each turn with a line like:
5

Seed the /model picker cache

Claude Code reads gateway models from ~/.claude/cache/gateway-models.json. Seed it once after setup (and again if the catalog changes):
6

Launch Claude Code

Use /model inside Claude Code to pick a specific Pioneer model, or keep pioneer/auto to use the Code Router.
The Pioneer dashboard Integrations guide copies a single shell block that runs all of the steps above with your API key filled in.

Use the Code Router (pioneer/auto)

pioneer/auto sends each turn through Pioneer’s Code Router. The router picks the cheapest model that meets your quality bar for that specific prompt.
  • Set ANTHROPIC_CUSTOM_MODEL_OPTION=pioneer/auto so Claude Code treats it as a first-class custom model.
  • Launch with claude --model pioneer/auto, or select it from /model.
  • After each turn, the Stop hook shows how much pioneer/auto routing has saved you this session.

What does Stop says: mean?

Claude Code has a hooks system. Stop is one hook event — it runs after the assistant finishes a turn (not when you exit the session). The Pioneer setup registers a Stop hook in ~/.claude/settings.json. That script reads the pioneer_savings rate differences and the per-turn token usage from the session transcript, sums the savings across the session, and emits a short message. Claude Code labels hook output with the hook name, so the UI shows:
This is informational. Stop is Claude Code’s name for the end-of-turn hook — not a warning and not a command to halt. The amount is cumulative for the session and only appears once the Code Router has actually saved money versus the frontier reference model. Pioneer also includes pioneer_routed_model and pioneer_savings on Anthropic-compatible responses (streaming message_start frames and non-streaming bodies) if you want to build your own tooling around routing metadata.

Full model list in /model

Claude Code only shows third-party gateway models whose IDs start with claude or anthropic. Pioneer publishes discovery aliases such as anthropic/pioneer/gpt-5.4 on GET /v1/models so non-Claude decoder models appear in the picker while still resolving to the canonical Pioneer model ID at inference time. Requirements:
  • CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
  • ANTHROPIC_BASE_URL pointing at Pioneer
  • A populated ~/.claude/cache/gateway-models.json (see setup step above)
If ~/.claude/settings.json sets CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, Claude Code skips live gateway discovery. Remove that flag or rerun the cache seed step whenever you need an updated /model list.

Troubleshooting

This usually means Claude Code did not pick up a usable Pioneer API key for the current shell. It is not asking you to sign in to Claude.ai.
  1. Run . ~/.pioneer/env, then restart Claude Code.
  2. If Claude Code asks whether to use the environment API key, accept it.
  3. Run /status and confirm:
    • API key is ANTHROPIC_API_KEY
    • Anthropic base URL is your Pioneer endpoint
    • Auth token is none
  4. If /status points at Pioneer but the error persists, check ~/.claude.json. Under customApiKeyResponses, make sure the suffix for your current Pioneer key is in approved, not rejected.
  5. If you are using a non-production Pioneer endpoint, make sure the API key comes from the same environment.
If you see Both claude.ai and ANTHROPIC_API_KEY set · auth may not work as expected, Claude Code is still using Claude.ai OAuth instead of your Pioneer key.
  1. Run claude auth logout (or /logout inside Claude Code).
  2. Relaunch with claude --model pioneer/auto. When prompted about the environment API key, accept it.
  3. Verify with /status:
    • Auth token should be none
    • API key should be ANTHROPIC_API_KEY
    • Anthropic base URL should be your Pioneer endpoint
On macOS, if the warning persists, open Keychain Access, search for Claude Code, delete stored credentials, and relaunch.
  1. Confirm CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 is set in ~/.pioneer/env and sourced.
  2. Check that ~/.claude/cache/gateway-models.json exists and its baseUrl matches ANTHROPIC_BASE_URL.
  3. Remove CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 from ~/.claude/settings.json if present.
  4. Rerun the cache seed step from setup.
Install the Stop hook from the setup section. It only runs when ANTHROPIC_BASE_URL points at Pioneer, and the line appears only once pioneer/auto routing has actually saved money versus the frontier reference model this session. A brand-new session, or one where the router picked the frontier model itself, will show nothing until there are positive savings to report.