Gateway
One key, two request formats.
Point any OpenAI or Anthropic client at api.oneaiapikey.com. You pay per token from prepaid credits, at the rates on the models page, and every request shows up in your usage log.
curl \
https://api.oneaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer $ONEAIAPIKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"messages": [{"role": "user", "content": "Hello"}]
}'curl \
https://api.oneaiapikey.com/v1/messages \
-H "x-api-key: $ONEAIAPIKEY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"max_tokens": 512,
"messages": [{"role": "user", "content": "Hello"}]
}'Request path
The path of one request.
Every call is checked before the model is reached, and the cost is in your log as soon as it finishes.
Your code sends the request
OpenAI or Anthropic format to api.oneaiapikey.com, with your key.
Verify the key
Unknown, revoked or expired keys get a 401.
Rejected: 401, not billed
Check scope and balance
Allowed model, IP, spend limit, credit left. A refused request is not billed.
Rejected: refused, not billed
Route to the model
The model name picks the channel; tokens stream back as they are generated.
Meter and log
Tokens × published rate, deducted from your credit and written as one row in your log.
Ledger row · sample
req_4f9a1c · claude-sonnet-5-5
18,420 in + 1,206 out
$0.034230
- Models now
- 48 across 22 families
- Lowest input
- $0.00 / 1M tokens
Protocols
Endpoints and base URLs
Claude models answer on both formats. Every other family answers on the OpenAI format. Keep the SDK you already use and change two values: the base URL and the key.
| Endpoint | Format | Used for |
|---|---|---|
| POST /v1/chat/completions | OpenAI | Chat with any model. Cursor, Cline, Kilo Code, OpenCode, Aider, Zed and the OpenAI SDKs. |
| POST /v1/responses | OpenAI | Responses API, used by Codex CLI with GPT models. |
| POST /v1/messages | Anthropic | Messages API for . Claude Code and the Anthropic SDKs. |
| GET /v1/models | OpenAI | Lists the model ids your key is allowed to call. |
Both formats take Authorization: Bearer sk-…; the Anthropic route also accepts x-api-key.
Base URLs for the endpoints above
OpenAI SDKs and OpenAI-compatible tools
https://api.oneaiapikey.com/v1
Set the base URL with the /v1 suffix.
Anthropic SDKs and Claude Code
https://api.oneaiapikey.com
Leave off /v1; the client adds /v1/messages itself.
Streaming
Tokens as they are written
- Wire formatSet
"stream": trueon either format and readtext/event-stream. The SDKs parse it for you. - Billed usageOn the OpenAI format,
stream_options.include_usageadds a final chunk with the token counts you are billed for. - AgentsCoding agents stream by default, which is why long agent turns do not time out.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.oneaiapikey.com/v1",
api_key=os.environ["ONEAIAPIKEY_API_KEY"],
)
stream = client.chat.completions.create(
model="claude-sonnet-5-5",
messages=[{"role": "user", "content": "Explain SSE in one paragraph."}],
stream=True,
stream_options={"include_usage": True}, # token counts in the last chunk
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)data: {"choices":[{"index":0,"delta":{"role":"assistant","content":""}}]}
data: {"choices":[{"index":0,"delta":{"content":"Server-sent"}}]}
data: {"choices":[{"index":0,"delta":{"content":" events"}}]}
data: {"choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: {"choices":[],"usage":{"prompt_tokens":14,"completion_tokens":96,"total_tokens":110}}
data: [DONE]Keys and limits
A key per project, each with its own fence
Create as many keys as you need in the console. Each one carries its own scope, so a mistake in one project stays in that project.
Checked before the request reaches a provider. Refused, not billed.
- Allowed models
claude-sonnet-5-5, gpt-6.1-sol
Restrict a key to the model ids it needs. Anything else is refused before it reaches a provider.
- Spend limit
$25.00
Cap how many credits a key can use. When it is spent, the key stops; your balance and other keys are untouched.
- Expiry
2026-12-31
Give short-lived keys to contractors, demos and CI jobs. After the date they fail with 401.
- IP allow-list
203.0.113.0/24
Accept a key only from your servers’ addresses, so a copied key is useless elsewhere.
- Pay as you go has no subscription and no overage bill. At zero balance requests stop; top up and the same keys work again.
- 1 credit = $1 of usage at the published per-model rates.
- Every request is a line in your usage log: model, input and output tokens, cost.
Balance
$49.93
after a $50 Builder top-up
| top-up · Builder | +$50.00 |
| req_4f9a1c | −$0.0342 |
| req_4f9a0b | −$0.0231 |
| req_4f99f3 | −$0.0095 |
Reliability
What to expect, plainly
Provider incidents reach you.
When a provider is down or throttling a model, requests to that model fail with 429 or 5xx. We do not answer with a different model than the one you asked for.
- Retry 429 and 503 with backoff.
- The official OpenAI and Anthropic SDKs already do this. Requests the gateway rejects (invalid key, no balance, unknown model) are not charged.
- Stream long outputs.
- Proxies on the internet close connections that stay silent for about 100 seconds. A non-streaming request for a long answer can fail even while the model is still working; with stream: true tokens keep the connection alive.
- No uptime percentage, on purpose.
- We do not publish an uptime figure or an SLA until we have a measured history to back one. Current state and incidents are on the status page.
- Models change.
- Providers retire models on their own schedule. Removals and new ids are announced in Product Updates with dates.
Try it with $10 of sign-up credit.
Create an account, make a key, and send the request above. The sign-up credit pays for any model at its listed price; when it runs out, add prepaid credit. The first line in your usage log tells you exactly what it cost.
Not ready to write code?
- Chat in the browserThe same balance works there.
- Cost calculatorSize a workload first.
- Who runs the gatewayRead the About page.