TemprTempr
Docs
Gateway API

Your AI plans

Last updated

Many developers pay a flat monthly price for their AI rather than per token: a Claude plan for Claude Code, a ChatGPT plan for Codex, or a coding plan from Z.AI, Kimi, MiniMax or one of 30 others. Tempr Gateway works with all of them. The plan keeps paying for the tokens, and you get what you get for an API key: request logs, key limits and guardrails, a dashboard of each plan's usage, and a model to carry on with when a plan runs out.

PlanToolHow it reaches the plan
Claude Pro, Max, Team or EnterpriseClaude CodeClaude Code keeps its claude.ai sign-in and sends it with each request; Tempr forwards it to Anthropic. Accepted only from Claude Code.
ChatGPT Plus, Pro, Business, Enterprise or EduCodexCodex keeps its ChatGPT sign-in; Tempr relays its requests to ChatGPT's own Codex backend. Accepted only from Codex.
30 coding plans: Z.AI GLM, Kimi Code, MiniMax, Alibaba Cloud, Volcengine, Tencent, Xiaomi MiMo, StepFun and moreThe tools each plan's vendor allows: which tools a plan acceptsThe plan's API key, stored in Tempr or sent with each request, used on the plan's own endpoints.

Claude Code on your Claude plan

Leave Claude Code signed in to claude.ai. Set only the base URL, and send your virtual key in its own header:

// ~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.temprhq.io",
    "ANTHROPIC_CUSTOM_HEADERS": "x-tempr-key: tvk_..."
  }
}

Don't set ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY: either one replaces your sign-in. Claude models go to Anthropic on your plan; pick an openai/… or other model with /model and Tempr uses your stored key for it. Tempr accepts a Claude plan's sign-in only from Claude Code, Anthropic's own tool; any other tool that sends one gets a plan_tool_not_allowed error. More in the Claude Code guide.

Codex on your ChatGPT plan

Sign Codex in with codex login, then add a provider that sends that login to Tempr, with your virtual key in an environment variable:

# ~/.codex/config.toml
model_provider = "tempr-chatgpt"

[model_providers.tempr-chatgpt]
name = "Tempr Gateway (ChatGPT plan)"
base_url = "https://api.temprhq.io/backend-api/codex"
requires_openai_auth = true
wire_api = "responses"
env_http_headers = { "x-tempr-key" = "TEMPR_API_KEY" }

The model list comes from ChatGPT, so Codex knows its models and tools. A ChatGPT login only ever goes to ChatGPT, works on this route only, and is accepted only from Codex, OpenAI's own tool. More in the Codex CLI guide.

Coding plans

Each coding plan is a provider of its own, and its models are named by the plan: zai-coding/glm-5.3, kimi-code/k3, minimax-plan/MiniMax-M3.1-Flash-Preview. Coding plans lists every plan's provider id, models and the tools Tempr accepts for it. Give Tempr the plan's key one of two ways:

  • Store it under Provider keys in the Portal, like any provider key. Then a tool the plan accepts calls its models with only your virtual key.
  • Send it with each request: the plan's key in Authorization, your virtual key in x-tempr-key. Tempr forwards it to that plan only, for that one request, and never stores it.

With a stored key, a tool the plan accepts needs nothing more than the usual setup. MiniMax's plan accepts any tool, so even a plain request works:

curl https://api.temprhq.io/v1/chat/completions \
  -H "Authorization: Bearer tvk_..." \
  -H "Content-Type: application/json" \
  -d '{ "model": "minimax-plan/MiniMax-M3.1-Flash-Preview", "messages": [{ "role": "user", "content": "Say hi" }] }'

Claude Code runs on a coding plan too. Where the plan has an Anthropic-compatible endpoint, Claude Code's requests go to it as they are. Point every model slot at the plan, so Claude Code's quick background calls don't need a Claude key:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.temprhq.io",
    "ANTHROPIC_AUTH_TOKEN": "tvk_...",
    "ANTHROPIC_MODEL": "zai-coding/glm-5.3",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "zai-coding/glm-5.3",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "zai-coding/glm-5.3",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "zai-coding/glm-5.3-flash"
  }
}

Tempr serves each plan only to the tools its vendor's terms allow. Many plans are sold for the coding tools their vendor supports, and bar scripts, app backends and other API use. Tempr recognises your tool by the User-Agent and headers it sends, never changes them, and refuses a request from a tool the plan doesn't accept. Which tools a plan accepts gives each plan's rule.

What you get

  • Request logs. Every request is logged like any other, with its tokens, latency and status. The cost shows as $0, and beside it what the tokens would have cost at the model's API prices. The request's page says which plan paid and, where the plan reports them, its usage windows (the 5-hour and weekly limits of a Claude plan, say).
  • A dashboard of your plans. The Gateway dashboard's Coding plans card shows each plan's requests, their value at API prices and its latest usage, and the logs filter by who paid (plan=claude, chatgpt, coding or one plan's id).
  • Your key's rules. The key's model allowlist, rate limits, guardrails, data-loss prevention and budget rules on requests and tokens apply as usual. Dollar budgets don't count plan-paid requests, since they cost you nothing. Prompt caching works as the plan provides it, and cached tokens show in the logs.
  • Your sign-in stays yours. A login or key you send is forwarded with that one request, only to the provider it belongs to, and is never stored or logged. Token refresh goes from your tool straight to the provider. The LLM guardrail check and response caching don't run on requests made with your own credentials, and the LLM guardrail check never runs on a coding plan's model, since it would be Tempr's own request on your plan.

When a plan runs out

Tempr uses your plan first and pay-as-you-go after it. When the plan paying for a request says it's used up, the request goes on to the same model on a pay-as-you-go key you've stored, at once, and the log shows both attempts:

  • Claude Code on a Claude plan carries on with the same Claude model on your Anthropic key.
  • Codex on a ChatGPT plan carries on with the same model on your OpenAI key, when OpenAI's API offers it. Reasoning from one account can't be read by the other, so the API gets the conversation without it.
  • A coding plan's model carries on with the same model on whichever of your provider keys serves it, the model maker's own API first (zai-coding/glm-5.3 carries on as zai/glm-5.3).
  • Any other error from the plan, such as a bad key, comes back as it is, so nothing is spent on the API by mistake. With no pay-as-you-go key for the model, the plan's own error comes back.

It works the other way too: a request for a pay-as-you-go model that one of your coding plans also serves goes to the plan first, when the plan's terms allow the tool you're using. Ask for zai/glm-5.3 with a Z.AI plan key stored, and the plan pays until it's used up.

To change what happens, set the key's used-up model: in the Portal's key settings ("When the plan or budget runs out"), or when_used_up_model on the management API. Name a model id such as openai/gpt-5 or one of the key's fallback aliases to carry on there instead, or stop to stay on the plan, so a used-up plan's requests stop with its error. When a dollar budget runs out, the request goes to the used-up model only if a plan pays for that model, since anything else would spend the budget it just ran out of. A key with a model allowlist uses only the models on it.

Details, and how this combines with fallback chains, are in Models, limits & logs.

For organizations

Personal keys accept a plan login or plan key sent with a request by default. An organization's keys accept them once an owner or admin turns on Plan logins in the organization's Gateway settings, or for one key in its settings, since it moves billing onto each member's own plan. A coding plan's key stored for the organization works for its keys only when the plan is sold as a team edition (Alibaba Cloud Token Plan, OpenCode Go, Ollama Cloud); other plans are for one person, so members send their own plan key with each request. See coding plans in an organization.

Check your plan's terms

A plan's terms are its vendor's, and Tempr can't change them. Tempr enforces each vendor's rule on which tools may use its plan (a Claude plan's sign-in from Claude Code only, a ChatGPT plan's from Codex only, and each coding plan's accepted tools), but the rest of the terms are yours to keep:

  • Claude. Anthropic's Claude Code terms allow you to use your own subscription with Claude Code, but bar third parties from routing Pro or Max credentials on their users' behalf. They don't say how that applies to a gateway that forwards your own, unmodified Claude Code, and Anthropic may act on its terms without notice.
  • ChatGPT. OpenAI documents signing Codex in with ChatGPT through a gateway for workspaces that run their own. Its docs don't yet say whether a hosted gateway may carry Plus or Pro logins.
  • Coding plans. Many limit the plan to interactive use in the coding tools they support, and some forbid proxies, aggregation, sharing a plan across people, or use from your own apps; Z.AI's, Kimi's, Alibaba's, Volcengine's, Tencent's and Xiaomi's terms all say so.

Read them for your plan before you rely on this, and keep each plan to the person who pays for it.

What's next

  • Coding plans: every plan and its provider id.
  • Your own credentials: how a login or key sent with a request is handled.
  • Budget rules: hourly to monthly limits on cost, tokens and requests, which plan-paid traffic counts toward too.