TemprTempr
Docs
Getting Started

Quickstart: Gateway API

Last updated

Tempr Gateway is an OpenAI-compatible API in front of your own provider keys. If you can point an SDK at a custom base_url, you can use it. The Gateway has no models of its own: every request runs on a provider key you add, or on a plan you already pay for.

  1. Sign up free

    Create an account on the Free plan and verify your email. No card required.

  2. Add a provider key

    On the Portal's Gateway provider keys page, add a key for at least one provider from the supported list, such as OpenAI, Anthropic, Google or Groq. Your requests run on it, and the provider bills you at its own rates.

  3. Make a virtual key

    On Gateway keys, create a key. Keys are prefixed tvk_ and shown once, so store it somewhere safe. The screen that shows it also gives you the base URL and snippets to copy.

  4. Send a request

    Set the base URL to https://api.temprhq.io/v1 and the API key to your virtual key. Everything else about the OpenAI SDK stays the same. Use <provider>/<model> for a provider you added, e.g. openai/gpt-5 with an OpenAI key.

See what your keys can call

GET /v1/models lists the models your provider keys can call (and, if the virtual key has an allowlist, only those on it). If it lists only tempr/add-a-provider-key, the account has no provider key yet: add one, then refresh your tool's model list.

curl https://api.temprhq.io/v1/models \
  -H "Authorization: Bearer tvk_..."

Try it with curl

# Replace tvk_... with your virtual key, and openai/gpt-5 with a model
# of a provider you added (openai/gpt-5 needs an OpenAI key)
curl https://api.temprhq.io/v1/chat/completions \
  -H "Authorization: Bearer tvk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5",
    "messages": [{"role": "user", "content": "Say hi in one sentence."}]
  }'

Python (OpenAI SDK)

# pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://api.temprhq.io/v1",
    api_key="tvk_...",
)

response = client.chat.completions.create(
    model="openai/gpt-5",
    messages=[{"role": "user", "content": "Say hi in one sentence."}],
)
print(response.choices[0].message.content)

Node / TypeScript (OpenAI SDK)

// npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.temprhq.io/v1",
  apiKey: "tvk_...",
});

const response = await client.chat.completions.create({
  model: "openai/gpt-5",
  messages: [{ role: "user", content: "Say hi in one sentence." }],
});
console.log(response.choices[0].message.content);

Streaming

Pass "stream": true (or stream: true in the SDKs) and Tempr forwards the upstream provider's OpenAI-shaped SSE stream (chat.completion.chunk lines) straight through, with stream_options.include_usage automatically enabled so you still get token counts on the final chunk.

If you get a 402

A 402 with the code provider_key_required means your account has no key for the model's provider. The error names that provider, links to Gateway provider keys, and lists the providers you do have keys for. To fix it, add a key for that provider, or switch to a model of one you have: GET /v1/models lists them. A 401 (missing_api_key or invalid_api_key) means the virtual key didn't arrive or isn't valid. Every code is in Errors.

No provider key? Use a plan you pay for

A plan login or a plan's key works without a provider key stored in Tempr: send the virtual key in x-tempr-key and your own credential in Authorization, and the plan pays for the tokens (how it works).

What's next