Claude Code
Last updated
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.
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.
On an anthropic/… model, Tempr passes Claude Code's requests to Anthropic unchanged and relays the answers as they come back. Extended thinking, web search, prompt caching, and the beta features Claude Code turns on through anthropic-beta all work exactly as they do against Anthropic directly.
On a non-Anthropic model, Tempr translates each request to that provider's API and back. Claude Code's thinking setting becomes the model's own reasoning setting, and the reasoning a model returns shows up as Claude Code's thinking, but Anthropic's server tools, such as web search, aren't available there. Streaming responses also report a placeholder 0 for input tokens in the very first event: the real count is used for billing and shows up once the response finishes, but Claude Code's automatic context compaction can trigger later than usual on very long sessions.
-
Create a virtual key
In the Portal, create a Gateway virtual key. Keys are prefixed
tvk_and shown once at creation. -
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.
-
Point Claude Code at Tempr
Set
ANTHROPIC_BASE_URLto Tempr's API origin (no/v1suffix — Claude Code appends the path itself) andANTHROPIC_AUTH_TOKENto 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.1-pro-preview, 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
- Authentication & virtual keys — scoping keys with model allowlists, budgets, and rate limits.
- Models, limits & logs — request logs and analytics apply identically whether traffic comes in via
/v1/chat/completionsor/v1/messages.