Documentation

API reference
POST/v1/chat/completions

Create Chat Completion

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

ProtocolOpenAI Chat Completions
Reference categoryChat Completion

Compatible model examples

gpt-4ogpt-4.1gpt-5o3o4-mini
Keep the format. Choose your model.
cURL
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
}'
Example only · no request is sent
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.
Your applicationRouteKeyOpenAI

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.