OpenAI-compatible API: one base URL, one key
An OpenAI-compatible API takes the request an OpenAI SDK sends, so a client built for OpenAI runs on it with a new base URL and key. RelaySwitch's is https://api.relayswitch.io/v1: 313 models answer chat completions on one prepaid key.
- Minimum top-up
- $10
- Pay with
- USDT, USDC, BTC, ETH, SOL, or card
- Sign-up
- An email address, or sign in with Google or GitHub. No phone number, no identity documents.
- Models
- 322 on one key, prices read live
- Base URL
https://api.relayswitch.io/v1OpenAI Chat Completions and Responses on 313 models, Anthropic Messages on 313, Gemini generateContent on 313- One message, example
- $0.00031 on Manta Flash 1.0; $0.0033 on Claude Sonnet 5.5 for one 2K-in / 300-out turn
- Subscription
- None. Prepaid credit, billed per token.
- Model check
- daily real-model check
https://api.relayswitch.io/v1POST https://api.relayswitch.io/v1/chat/completionsAuthorization: Bearer <key>Send the first request
Any OpenAI SDK works unchanged. Three ways to say hello.
curl https://api.relayswitch.io/v1/chat/completions \ -H "Authorization: Bearer $RELAYSWITCH_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-fable-5.2", "messages": [{"role": "user", "content": "Hello"}] }'from openai import OpenAI client = OpenAI( base_url="https://api.relayswitch.io/v1", api_key="YOUR_RELAYSWITCH_KEY",)reply = client.chat.completions.create( model="claude-fable-5.2", messages=[{"role": "user", "content": "Hello"}],)print(reply.choices[0].message.content)import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.relayswitch.io/v1", apiKey: process.env.RELAYSWITCH_KEY,});const reply = await client.chat.completions.create({ model: "claude-fable-5.2", messages: [{ role: "user", content: "Hello" }],});console.log(reply.choices[0].message.content);Code that already calls OpenAI
The Python and TypeScript SDKs read two environment variables, so a service switches with no code change.
export OPENAI_BASE_URL="https://api.relayswitch.io/v1"export OPENAI_API_KEY="YOUR_RELAYSWITCH_KEY"Streaming
Set stream: true and read server-sent events.
const stream = await client.chat.completions.create({ model: "claude-fable-5.2", messages: [{ role: "user", content: "Write a haiku" }], stream: true,});for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? "");}Paths on the base URL
Host api.relayswitch.io. The model id in the request picks the model; every path bills the same prepaid balance.
| Path | Format | Models |
|---|---|---|
/v1/chat/completions | OpenAI Chat Completions | 313 |
/v1/completions | OpenAI Completions | 313 |
/v1/messages | Anthropic Messages | 313 |
/v1/responses | OpenAI Responses | 313 |
/v1beta/models/{model}:generateContent | Gemini generateContent | 313 |
/v1/embeddings | OpenAI Embeddings | 8 |
/v1/rerank | Rerank | 1 |
Counted at render from the endpoints each catalog row lists. GET https://api.relayswitch.io/v1/models returns the ids.
Base URL
https://api.relayswitch.io/v1. Paste it with the /v1. The gateway also accepts the doubled /v1/v1 path a client builds when it appends its own.
Key
Sent as Authorization: Bearer, the header every OpenAI SDK writes. Keys start with sk-relay- and each can carry its own budget and rate limit.
Model ids
The developer's own ids, typed as the Models page prints them. An id the catalog does not list answers 404.
Streaming and tools
stream: true returns server-sent events. Tool calls keep the OpenAI shape in the request and in the answer.
Errors
401 for a missing or revoked key, 402 for an empty balance or a key at its budget, 429 for a key over its rate limit. The docs list each code.
Receipts
Every request has a signed receipt with the model, the billed tokens and the charge, fetched by the request id.
Where it drops in
Any client with a base URL field and a key field. Each guide fills in that client’s own settings.
| Client | What the guide sets |
|---|---|
| OpenClaw | a models.providers block in openclaw.json, a key for OpenClaw alone with a budget, the models to start with and the daily check |
| Hermes Agent | a providers entry in config.yaml with the key in .env, a key for Hermes alone with a budget, an agent turn priced live |
| OpenCode | an opencode.json custom provider with model limits from the catalog, a key for OpenCode alone with a budget |
| Cursor | the key as the OpenAI key with the base URL overridden |
| SDKs | OpenAI, Anthropic and Vercel AI SDK setup |
| LibreChat | a custom endpoint in librechat.yaml with the base URL, an env-var key, a models.default list and a small titleModel |
| Dify | the OpenAI-API-compatible provider: one entry per model with the id, key, endpoint URL and limits from the catalog |
| New API upstream | this key as the upstream channel of a New API or One API relay: type OpenAI, base URL, key, models, mapping; a capped key; approval for resale |
- Open WebUI on the key
- n8n on the key
- JanitorAI proxy on the key
- SillyTavern on the key
- Chub on the key
- RisuAI on the key
- Agnai Third-Party preset on the key
- WyvernChat custom provider on the key
- Sophia's LoreBary proxy with the key
- KoboldAI Lite on the key, no GPU
- Codex CLI on the key
- LangChain on the key
- OpenHands on the key
- Cline on the key
- Roo Code on the key
- Continue on the key
- Kilo Code on the key
- Pi coding agent on the key
- Aider on the key
- LiteLLM on the key
- Vercel AI SDK on the key
- GitHub Copilot on the key
Claude Code speaks Anthropic's Messages format, which the same base URL answers. The Claude Code guide has its two variables, and the Claude API page has every Claude rate.
Models behind the endpoint
USD per million tokens, read from the catalog at render, with the developer’s list price beside ours where the catalog has it.
| Model | Input | Cached | Output | Developer list in / out | Context |
|---|---|---|---|---|---|
| Claude Fable 5.2 | $4.00 (50% under) | $0.10 | $20.00 (50% under) | $8.00 / $40.00 | 1M tokens |
| Claude Opus 5.5 | $2.716 (32% under) | $0.1455 | $9.70 (51% under) | $4.00 / $20.00 | 1M tokens |
| DeepSeek V4.1 Flash 1017 | $0.2425 (19% under) | $0.0058 | $1.164 (3% under) | $0.30 / $1.20 | 1M tokens |
| GLM 5.3 Flash | $0.0873 (41% under) | $0.0109 | $0.1455 (70% under) | $0.15 / $0.50 | 1M tokens |
| GPT-6 Luna | $0.0625 (37% under) | $0.0125 | $0.20 (60% under) | $0.10 / $0.50 | 1.1M tokens |
| Qwen3.8 Max | $0.80 (60% under) | $0.60 | $2.40 (60% under) | $2.00 / $6.00 | 991K tokens |
| Minimax M3.1 Flash | $0.105 (30% under) | $0.0105 | $0.42 (30% under) | $0.15 / $0.60 | 1M tokens |
| Gemini 3.8 Flash | $0.4925 (34% under) | $0.0493 | $2.25 (40% under) | $0.75 / $3.75 | 1M tokens |
| Grok 4.7 | $0.60 (70% under) | $0.15 | $1.80 (70% under) | $2.00 / $6.00 | 500K tokens |
| Kimi K3 | $0.90 (70% under) | $0.12 | $4.50 (70% under) | $3.00 / $15.00 | 1M tokens |
USD per million tokens, read from the RelaySwitch catalog when this page was built. Developer list: the catalog's record of the developer's own price.
OpenAI-compatible API: questions
The base URL, the key, formats and cost.
One base URL, one key
Prepaid from $10 by card or in USDT, USDC, BTC, ETH, SOL. Two values change in your client.