Developer Documentation

Build with RouteAll.ai

One API key. 50+ frontier AI models. OpenAI-compatible. Deploy in 5 minutes.

OpenAI Compatible Credits Never Expire Global Low Latency

Quickstart

1
Create an account

2
Generate an API key

3
Make your first request

Python
from openai import OpenAI
client = OpenAI(api_key="your-routeall-api-key", base_url="https://api.routeall.ai/v1")
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
4
Choose a subscription

Authentication

HTTP Header
Authorization: Bearer YOUR_API_KEY
⚠️

Using Environment Variables

Python
import os
client = OpenAI(api_key=os.environ["ROUTEALL_API_KEY"], base_url="https://api.routeall.ai/v1")

Base URL & Endpoints

Base URL
https://api.routeall.ai/v1
🌏

Available Endpoints

POST/v1/chat/completions
GET/v1/models
POST/v1/embeddings
POST/v1/images/generations

Chat Completions

Request Parameters

ParameterTypeRequiredDescription
modelstringModel ID e.g. gpt-4o, claude-opus-4-6
messagesarrayArray of role + content objects
streambooleanEnable streaming. Default: false
temperaturenumberRandomness 0–2. Default: 1
max_tokensintegerMax tokens in response

Example Request

cURL
curl https://api.routeall.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'

Example Response

200 OK
{
  "id": "chatcmpl-abc123",
  "model": "gpt-4o",
  "choices": [{"message": {"role": "assistant", "content": "Hello! How can I help?"}, "finish_reason": "stop"}],
  "usage": {"prompt_tokens": 10, "completion_tokens": 8, "total_tokens": 18}
}

Streaming

Python
from openai import OpenAI
client = OpenAI(api_key="YOUR_KEY", base_url="https://api.routeall.ai/v1")
stream = client.chat.completions.create(
    model="claude-sonnet-4-6", stream=True,
    messages=[{"role":"user","content":"Tell me a story"}]
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
Node.js
const client = new OpenAI({apiKey:'YOUR_KEY',baseURL:'https://api.routeall.ai/v1'});
const stream = await client.chat.completions.create({
  model:'gpt-4o', stream:true,
  messages:[{role:'user',content:'Tell me a story'}]
});
for await (const chunk of stream)
  process.stdout.write(chunk.choices[0]?.delta?.content||'');
cURL
curl https://api.routeall.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","stream":true,"messages":[{"role":"user","content":"Hello"}]}'

List Models

cURL
curl https://api.routeall.ai/v1/models -H "Authorization: Bearer YOUR_API_KEY"

Python SDK

Shell
pip install openai
Python
from openai import OpenAI
import os
client = OpenAI(api_key=os.getenv("ROUTEALL_API_KEY"), base_url="https://api.routeall.ai/v1")
resp = client.chat.completions.create(model="gpt-4o", messages=[{"role":"user","content":"Hi"}])
print(resp.choices[0].message.content)

Node.js SDK

Shell
npm install openai
TypeScript
import OpenAI from 'openai';
const client = new OpenAI({apiKey: process.env.ROUTEALL_API_KEY, baseURL: 'https://api.routeall.ai/v1'});
const res = await client.chat.completions.create({model:'claude-opus-4-6', messages:[{role:'user',content:'Hello!'}]});
console.log(res.choices[0].message.content);

cURL

cURL
curl https://api.routeall.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'

Go

Shell
go get github.com/sashabaranov/go-openai
Go
package main
import ("context";"fmt"; openai "github.com/sashabaranov/go-openai")
func main() {
    cfg := openai.DefaultConfig("YOUR_API_KEY"); cfg.BaseURL = "https://api.routeall.ai/v1"
    client := openai.NewClientWithConfig(cfg)
    resp, _ := client.CreateChatCompletion(context.Background(), openai.ChatCompletionRequest{
        Model:"gpt-4o", Messages:[]openai.ChatCompletionMessage{{Role:"user",Content:"Hello!"}},
    })
    fmt.Println(resp.Choices[0].Message.Content)
}

Supported Models

OpenAI

OpenAIgpt-4o
OpenAIgpt-4.1
OpenAIgpt-4.1-mini
OpenAIgpt-5
OpenAIo1
OpenAIo4-mini

Anthropic Claude

Anthropicclaude-opus-4-6
Anthropicclaude-sonnet-4-6
Anthropicclaude-haiku-4-5-20251001
Anthropicclaude-opus-4-6-thinking

Google Gemini

Geminigemini-2.5-pro
Geminigemini-2.5-flash
Geminigemini-3-pro-preview
Geminigemini-2.0-flash

xAI Grok

xAIgrok-4
xAIgrok-3
xAIgrok-3-mini
xAIgrok-4-fast-reasoning
💡

Pricing

PlanMonthly FeeCreditsDiscountgpt-4o Input
DefaultFree$1.875/1M
Starter$8$85% off$1.781/1M
Builder$35$4015% off$1.594/1M
Pro ⭐$130$16025% off$1.406/1M
Scale$450$60030% off$1.313/1M
♾️

Error Handling

HTTP CodeError TypeDescription
400invalid_request_errorBad request
401authentication_errorInvalid or missing API key
402payment_requiredInsufficient credits
404model_not_foundModel ID not recognized
429rate_limit_errorToo many requests
500server_errorInternal error — retry
503service_unavailableUpstream provider unavailable

Python Error Handling

Python
from openai import OpenAI, APIError, RateLimitError, AuthenticationError
client = OpenAI(api_key="YOUR_KEY", base_url="https://api.routeall.ai/v1")
try:
    response = client.chat.completions.create(model="gpt-4o", messages=[...])
except AuthenticationError: print("Invalid API key")
except RateLimitError: print("Rate limit hit")
except APIError as e: print(f"Error {e.status_code}: {e.message}")

Rate Limits

PlanRequests / MinTokens / Min
Default60100,000
Starter120200,000
Builder300500,000
Pro6001,000,000
Scale1,2002,000,000
🏢

FAQ

Do I need to change my existing code?

Do credits expire?

Which region will my requests be served from?

Can I use the Anthropic or Gemini SDK directly?

Model ratio vs group ratio?

How do I get enterprise pricing?