Skip to content

Quick Start

RouteAPI gives your application one authenticated entry point for OpenAI-compatible, Claude Messages, and Google Gemini APIs. This guide takes you from an account to a verified request, then points you to the right integration path for production.

  1. Register an account. Visit the RouteAPI Console and register with email or Google. The dashboard shows your balance, usage, and account status.
  2. Create a token. Open Token Management → Create Key. Give the token a recognizable name, set an expiration date, and optionally add quota and model limits.
  3. Send a test request. Set ROUTEAPI_KEY to the new token, choose an available model, and run the cURL example below.

The OpenAI-compatible endpoint is the shortest path for a first test. It accepts the same basic chat format used by many existing clients.

Terminal window
export ROUTEAPI_KEY="sk-your-routeapi-token"
curl https://api.routeapi.ai/v1/chat/completions \
-H "Authorization: Bearer $ROUTEAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [
{"role": "user", "content": "Hello RouteAPI"}
]
}'

The response contains the assistant message and usage information. Keep the request ID returned by the API or client when available; it is useful for troubleshooting. If the model name is not available for your token, replace it with an ID returned by GET /v1/models.

RouteAPI is compatible with the official OpenAI SDKs. Choose your runtime, install its SDK, then set the RouteAPI Base URL:

Terminal window
# Node.js
bun add openai
# Python
pip install openai
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.ROUTEAPI_KEY,
baseURL: 'https://api.routeapi.ai/v1',
});
const response = await client.chat.completions.create({
model: 'gpt-5.5',
messages: [{ role: 'user', content: 'Introduce RouteAPI in one sentence' }],
});
console.log(response.choices[0].message.content);

See the complete Node.js, Python, and OpenAI SDK examples.

Set stream to true to receive Server-Sent Events (SSE) as the model produces output. Read each data: event and stop when you receive data: [DONE].

Terminal window
curl https://api.routeapi.ai/v1/chat/completions \
-H "Authorization: Bearer $ROUTEAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"stream": true,
"messages": [
{"role": "user", "content": "Explain RouteAPI in three points"}
]
}'

Streaming support and final usage events depend on the selected model. See Streaming Responses for SSE handling and mid-stream errors.

Before integrating a larger application, use the same token to verify the model list and a real request:

Terminal window
curl https://api.routeapi.ai/v1/models \
-H "Authorization: Bearer $ROUTEAPI_KEY"
  • 401 — verify the token and the Authorization header.
  • 402 — check the account balance or token quota.
  • 429 — reduce request frequency and review rate limits.
  • 502/503 — check model service availability, try a supported model, or retry with a limit.
  • Model unavailable — confirm the exact model ID and its capabilities.

Use Request Debugging and Common Errors for a deeper diagnosis. The console usage log includes status, latency, tokens, cost, and error details.

For production, keep tokens server-side, pin model IDs, record request IDs, and test optional features such as streaming, tool calling, structured outputs, and multimodal input with the exact model you plan to use.