Guides

Claude Code

Point Claude Code at Anthropic directly and it only ever talks to Claude models — that's hardcoded into how Claude Code's client works. Point it at Tempr Gateway instead and Claude Code can run GPT-5, Gemini, DeepSeek, or any other model on your gateway allowlist, through the exact same Claude Code interface you already use. Tempr speaks Anthropic's Messages API natively at /v1/messages, so nothing about Claude Code itself changes — only where it connects and which model you tell it to use.

Why this matters

Claude Code has no built-in way to use a non-Anthropic model. Once it's pointed at Tempr, ANTHROPIC_MODEL (or the /model command inside a session) accepts any model id on your allowlist — swap between Claude, GPT-5, and Gemini mid-project without leaving Claude Code or touching its config beyond the model name.

Known limitation

Streaming responses report a placeholder 0 for input tokens in the very first event (Anthropic itself knows this number before generating; Tempr's internal pipeline only knows it once the response completes) — the real count is still used for billing and shows up correctly once the response finishes. This can make Claude Code's automatic context-compaction trigger later than it would against Anthropic directly on very long sessions.

  1. Create a virtual key

    In the Portal, create a Gateway virtual key. Keys are prefixed tvk_ and shown once at creation.

  2. Add a provider key

    Gateway is BYOK: add a key for at least one provider — typically Anthropic, though any model on your key's allowlist works — from the supported list.

  3. Point Claude Code at Tempr

    Set ANTHROPIC_BASE_URL to Tempr's API origin (no /v1 suffix — Claude Code appends the path itself) and ANTHROPIC_AUTH_TOKEN to your virtual key.

Environment variables

# bash / zsh
export ANTHROPIC_BASE_URL="https://api.temprhq.io"
export ANTHROPIC_AUTH_TOKEN="tvk_..."

# optional: run Claude Code on a model that isn't Claude at all
export ANTHROPIC_MODEL="openai/gpt-5"

Or: ~/.claude/settings.json

If you'd rather not export environment variables in every shell, the same configuration works as a settings file:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.temprhq.io",
    "ANTHROPIC_AUTH_TOKEN": "tvk_..."
  },
  "model": "openai/gpt-5"
}

Model ids — not just Claude

Use the fully-qualified provider/model form — anthropic/claude-sonnet-4-5 for an actual Claude model, but also openai/gpt-5, google/gemini-3-pro, or any other id from GET /v1/models. Only models on your virtual key's allowlist (if one is set) will resolve — Claude Code has no opinion about which provider a model belongs to, since as far as it knows it's still just talking to "Claude."

What's next