OneModelKey

Build with OneModelKey

One OpenAI-compatible API for models from OpenAI, Anthropic and Google. Your users bring their own OneModelKey key and pay from their own prepaid balance.

Not building an app? You don’t need any of this. If an app asked you for a key, follow the three-step setup.

Make your first request

Create an API key, add credits, and point the client you already use at our base URL. Switch models by changing one string. Save your key as the ONEMODELKEY_API_KEY environment variable before running these examples.

Base URL
https://onemodelkey.com/v1
curl https://onemodelkey.com/v1/chat/completions \
  -H "Authorization: Bearer $ONEMODELKEY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-fable-5-1",
    "messages": [
      {"role": "user", "content": "Hello"}
    ]
  }'

Let your users bring their key

Add a setting in your app where people paste a OneModelKey key, and send their requests with that key. They create the key, add credits and watch their spending here, so you never handle their billing.

  1. Add a key field. Store each user’s key as a secret. Keep keys out of shared logs, analytics and client-side code.
  2. Offer the models you support. Fetch /v1/models and show the IDs your app can handle.
  3. Link to the setup guide. Send users who don’t have a key yet to https://onemodelkey.com/connect. It explains the steps without any code.

Authentication

Every request requires an API key in the Authorization header. Treat keys like passwords and never embed them in public client-side code.

Authorization: Bearer mq_live_...

Models

GET/v1/models
GET/v1/models/{id}

Returns the public aliases currently enabled for your account.

claude-fable-5-1Claude Fable 5.1

Anthropic

claude-haiku-5-5Claude Haiku 5.5

Anthropic

claude-opus-5-5Claude Opus 5.5

Anthropic

claude-sonnet-5-5Claude Sonnet 5.5

Anthropic

gemini-3.1-flash-liteGemini 3.1 Flash-Lite

Google

gemini-3.1-pro-previewGemini 3.1 Pro (Preview)

Google

gemini-3.5-flash-liteGemini 3.5 Flash-Lite

Google

gemini-3.8-flashGemini 3.8 Flash

Google

gpt-5-nanoGPT-5 Nano

OpenAI

gpt-6-astraGPT-6 Astra

OpenAI

gpt-6-lunaGPT-6 Luna

OpenAI

gpt-6.1-solGPT-6.1 Sol

OpenAI

Chat completions

POST/v1/chat/completions

The required model field selects an ID returned by /v1/models. Send messages in the same format for every provider; the gateway routes and translates the request. There is no default model. Tool definitions, tool choice, JSON response formats, and common sampling parameters are forwarded where supported. The optional n parameter must be 1; multiple candidates are not supported.

Omitting an output limit allows up to 4,096 tokens. Send either max_tokens or max_completion_tokens. Unsupported settings and malformed tool history are rejected before credits are reserved.

Tool conversations

Append the complete returned assistant message before sending tool results, preserving LiteLLM continuation fields such as reasoning_items, thinking_blocks, provider_specific_fields and tool-call extensions. This carries the signed reasoning state needed for subsequent requests. For streaming, merge tool-call and thinking-block deltas by index and retain reasoning items, signatures and provider metadata in the assembled assistant message. The old OpenAI response-items and Anthropic content envelopes are no longer supported. Return one string result for every tool call using its tool_call_id.

Streaming

Set "stream": true to receive text/event-stream chunks in the OpenAI chat.completion.chunk shape, ending with data: [DONE]. Add "stream_options": {"include_usage": true} to receive a final usage-only chunk. Streamed requests are billed from provider-reported usage exactly like non-streamed ones; if you disconnect, generation is still billed until the provider finishes. A completed usable response without valid usage is charged using a LiteLLM token estimate, marked by usage.estimated: true and an estimated status in request history. Non-streaming responses also include X-Usage-Source: estimated. These estimates treat unknown cache activity as uncached input and cannot reconstruct hidden reasoning. Lost output and unpriced usage remain pending for review.

cURL
curl -N https://onemodelkey.com/v1/chat/completions \
  -H "Authorization: Bearer $ONEMODELKEY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-fable-5-1",
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": true,
    "stream_options": {"include_usage": true}
  }'

Errors

Errors use an OpenAI-shaped error object.

StatusMeaning
400Invalid request or unsupported parameter
401Missing or invalid API key
402Insufficient API credits
429Rate or API-key spend limit reached
5xxGateway or upstream provider failure

Every gateway response carries an X-Request-ID header. Quote it when contacting support.

Data retention

The gateway records token counts, model alias, charge, latency, API-key identifier, and request identifier. It does not persist prompt or response bodies. Selected upstream providers may retain content under their own terms.

Read the privacy notice