Skip to content

Quickstart

The gateway is one HTTP host that speaks the OpenAI, Anthropic and Gemini wire formats. You keep your SDK, change the base URL and the key, and every model in the catalog is available through every chat format.

The examples on this site use https://api.test.whocare.xyz as the gateway address. Use the address your operator gave you (it is the GATEWAY_PUBLIC_URL of the deployment).

  1. Create an API key on the API keys page. The secret (sk- followed by 48 characters) is shown once. Copy it.
  2. Put some balance on the account: balance and top-ups. A request is refused with 402 insufficient_balance when the balance cannot cover the worst case of that request (see Billing basis).
Terminal window
export GATEWAY_API_KEY="sk-..."
Terminal window
curl https://api.test.whocare.xyz/v1/models \
-H "Authorization: Bearer $GATEWAY_API_KEY"

Use the id of an entry as model. The same list, with prices and capabilities, is in the model catalog.

Terminal window
curl https://api.test.whocare.xyz/v1/chat/completions \
-H "Authorization: Bearer $GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say hello in one word."}]
}'

The response is the normal OpenAI response with one addition: usage.cost, the USD amount this request was charged.

Point the official SDK at the gateway. Nothing else changes.

import os
from openai import OpenAI
client = OpenAI(base_url="https://api.test.whocare.xyz/v1", api_key=os.environ["GATEWAY_API_KEY"])
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Say hello in one word."}],
)
print(resp.choices[0].message.content)
print("cost (USD):", resp.usage.model_extra["cost"])
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.test.whocare.xyz/v1",
apiKey: process.env.GATEWAY_API_KEY,
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Say hello in one word." }],
});
console.log(resp.choices[0].message.content);
console.log("cost (USD):", resp.usage.cost);