Skip to content
Relaykit

Gateway

One key for Claude, GPT, Grok and DeepSeek.

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 $RELAYKIT_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: $RELAYKIT_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 512,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
Protocols
OpenAI + Anthropic
Models
11 across 4 families
Lowest input rate
$0.24 / 1M tokens
Smallest top-up
$3

Request flow

What happens between your code and the model

The gateway is a thin, strict layer. It checks the key and its limits, forwards your request unchanged in meaning, streams the answer back and writes one line to your usage log. Nothing else sits in the path.

Your code or agentPOST /v1/messages or /v1/chat/…Authorization: Bearer sk-…requeststreamedRelaykit gatewayapi.oneaiapikey.com01Verify the keyUnknown, revoked or expired: 401.02Check scope and balanceModel, IP, spend limit and credit left.03Route to the modelForwarded with our upstream credentials.04Meter and logTokens × published rate, deducted, logged.forwardtokensModel providerAnthropic, OpenAI, xAI or Zhipu AIreports token usage
Every check runs before a token is spent. Billing uses the token counts the provider reports for that request.

Protocols

Both request formats, same key

Claude models answer on both formats. GPT, Grok and DeepSeek models answer on the OpenAI format. Keep the SDK you already use and change two values: the base URL and the key.

Full API reference
Endpoints
EndpointFormatUsed for
POST /v1/chat/completionsOpenAIChat with any model. Cursor, Cline, Kilo Code, OpenCode, Aider, Zed and the OpenAI SDKs.
POST /v1/responsesOpenAIResponses API, used by Codex CLI with GPT models.
POST /v1/messagesAnthropicMessages API for Claude Opus 5.5, Claude Sonnet 5, Claude Haiku 4.5 and Claude Sonnet 5.5. Claude Code and the Anthropic SDKs.
GET /v1/modelsOpenAILists the model ids your key is allowed to call.

Base URLs

  • OpenAI SDKs and OpenAI-compatible tools

    https://api.oneaiapikey.com/v1

    Include /v1.

  • Anthropic SDKs and Claude Code

    https://api.oneaiapikey.com

    No /v1: the client appends /v1/messages.

Authentication on both: Authorization: Bearer sk-…. The Anthropic route also accepts x-api-key.

Streaming

Tokens as they are written

  • Set "stream": true on either format and read text/event-stream. The SDKs parse it for you.
  • On the OpenAI format, stream_options.include_usage adds a final chunk with the token counts you are billed for.
  • Coding agents stream by default, which is why long agent turns do not time out.
When to stream, and when not to
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.oneaiapikey.com/v1", api_key=os.environ["RELAYKIT_API_KEY"])

stream = client.chat.completions.create(
    model="claude-sonnet-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.

01Create a keyName it after the projector agent that uses it.02Set its scope03Call the APISent as a Bearer token,checked per request.04Watch usagePer-request log withmodel, tokens and cost.05RevokeLater callsfail with 401.Modelsonly the ids you allowLimita credit cap, or noneExpirya date, or neverIPan allow-list, or any
Scope is set per key, so a leaked key for one project cannot spend beyond its own limit, models or IP range.
Allowed models
Restrict a key to the model ids it needs. Anything else is refused before it reaches a provider.
Spend limit
Cap how many credits a key can use. When it is spent, the key stops; your balance and other keys are untouched.
Expiry
Give short-lived keys to contractors, demos and CI jobs. After the date they fail with 401.
IP allow-list
Accept a key only from your servers’ addresses, so a copied key is useless elsewhere.
How to split keys by project

Billing

Prepaid credits, metered per token

  • No subscription required, 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. Packs start at 10 credits.
  • Every request is a line in your usage log: model, input and output tokens, cost.
01Top up credits02Meter the request03Deduct04Log the linePrepaid. 1 credit = $1 of usage.balance $10.00claude-sonnet-5in 12,000 × $2.20/1Mout 800 × $11/1M= $0.0264 + $0.0088−$0.0352Settled from the reported token counts.claude-sonnet-512,000 in · 800 out · cost $0.0352balance $9.9648
Worked example: one Claude Sonnet 5 request at current rates ($2.20 in, $11 out per 1M tokens), starting from a 10-credit top-up.

Reliability

What to expect, plainly

  1. 01

    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.

  2. 02

    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.

  3. 03

    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.

  4. 04

    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.

  5. 05

    Models change.

    Providers retire models on their own schedule. Removals and new ids are announced in Product Updates with dates.

Try it from a $3 top-up.

Create an account, make a key, and send the request above. The first line in your usage log tells you exactly what it cost.