Developer documentation

Connect once, route every model.

Use Route Key with provider-compatible request formats for OpenAI, Anthropic, Gemini, Qwen, DeepSeek, Grok, MiniMax, and more.

Demo mode5 models indexedUpdated 00:00:00
30model API endpoints
8provider categories
API keyAuthentication
Integration guideConnect apps and coding agentsOne API key and compatible gateway for SDKs, Codex, Claude Code, Gemini CLI, and Cursor.Open guide
POSTOpenAI/chat/completions

Create Chat Completion

Creates a model response from conversation history with streaming, tools, and usage accounting.

Authorization header
Add this value to the HTTP request headers.
Add Authorization: Bearer sk-your-key to the request headers.
Content-Type

application/json

Model

gpt-4o, gpt-4.1, gpt-5, o3, o4-mini

Request example
curl -X POST https://api.routekey.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": "Hello from Route Key"
    }
  ],
  "stream": false
}'
Response example
{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "created": 0,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello!"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 3,
    "total_tokens": 11
  }
}
cURL Example
curl -X POST 'https://api.routekey.ai/v1/chat/completions' \
  -H 'Add Authorization: Bearer sk-your-key to the request headers.'
  -H 'Content-Type: application/json'
  -d '{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": "Hello from Route Key"
    }
  ],
  "stream": false
}'
Parameters
NameTypeRequiredDescription
modelstringYesTarget model name from the Models page or model-list response.
messagesarray<object>YesOpenAI-compatible chat messages for text endpoints.
temperaturenumberNoSampling temperature.
top_pnumberNoNucleus sampling value.
streambooleanNoEnable server-sent streaming responses when supported.
max_tokensintegerNoMaximum tokens for completion output.
toolsarray<object>NoTool definitions or function schemas supported by the selected model.
response_formatobjectNoOptional output format or response encoding.
Response
NameTypeRequiredDescription
idstring-Response, task, or resource ID.
objectstring-Response object type.
createdinteger-Creation timestamp.
modelstring-Model used for the request.
choicesarray<object>-Candidate model outputs.
usageobject-Token usage statistics.
Notes
  • OpenAI Chat Completions
  • Use the same request shape as the matching provider API when the backend channel is enabled.

Core Concepts

These are the pieces new users usually need to understand before debugging an integration.

API key: An account token authenticates requests to supported upstream models and is shown in your Dashboard.

Base URL: Route Key keeps OpenAI-style request shapes and changes where the SDK sends traffic.

Model name: Keep the requested model in the payload. Routing and availability are resolved by the backend channel setup.

Usage and billing: Costs, token counts and latency appear in usage endpoints after requests complete.

Choosing a Model

Starter choices derived from the pricing endpoint currently loaded by the app.

General chat: Start here for smoke tests, chatbots and low-cost traffic.

Reasoning or coding: Use after the basic request works and you need stronger task quality.

Move up for reasoning

Check group pricing before production

Common Errors

Most first-run failures are caused by authentication, model names, quota, or request shape.

401

Authentication failed

Check that Authorization uses Bearer plus your Route Key API key.

403

No access or balance

Check key status, account balance, model access, and billing settings.

429

Quota or rate limit

Reduce concurrency, retry with backoff, or review account limits.

5xx

Upstream or routing failure

Retry later and inspect Usage Logs for route status and provider errors.