API Reference
Relai provides an OpenAI-compatible API. If you're familiar with the OpenAI API, you already know how to use Relai.
Base URLs
| Region | Base URL |
|---|---|
| EU | https://eu.api.llmrelai.com/v1 |
| US | https://us.api.llmrelai.com/v1 |
Authentication
All API requests require an API key in the Authorization header:
Authorization: Bearer rk-eu-your-api-keyEndpoints
POST /v1/chat/completions
Create a chat completion.
Request Body:
{
"model": "smart",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 1000,
"stream": false
}Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID or alias (smart, fast, cheap) |
| messages | array | Yes | Array of message objects |
| temperature | number | No | Sampling temperature (0-2, default: 1) |
| max_tokens | integer | No | Maximum tokens to generate |
| stream | boolean | No | Enable streaming (default: false) |
| tools | array | No | Function calling tools |
Response:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1715000000,
"model": "claude-sonnet-4.6",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 8,
"total_tokens": 18
}
}GET /v1/models
List available models.
Response:
{
"object": "list",
"data": [
{
"id": "claude-opus-4.7",
"object": "model",
"owned_by": "anthropic"
},
{
"id": "gpt-5.5",
"object": "model",
"owned_by": "openai"
}
]
}GET /v1/balance
Get current credit balance.
Response:
{
"credits_micro": 4500000,
"credits_dollars": 4.50
}GET /v1/keys
List API keys.
Response:
{
"keys": [
{
"id": "key_abc123",
"name": "Production",
"prefix": "rk-eu-abc",
"region": "eu",
"rpm_limit": 60,
"created_at": "2026-05-01T10:00:00Z",
"last_used_at": "2026-05-08T12:30:00Z"
}
]
}POST /v1/keys
Create a new API key.
Request Body:
{
"name": "Production Key",
"rpm_limit": 60
}DELETE /v1/keys/{id}
Revoke an API key.
Streaming
Enable streaming by setting stream: true. Responses use Server-Sent Events:
data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":"Hello"}}]}
data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":" there"}}]}
data: {"id":"chatcmpl-abc","choices":[{"delta":{},"finish_reason":"stop"}]}
data: [DONE]Rate Limits
Rate limits are per API key:
- Default: 60 requests per minute
- Configurable up to 1000 RPM per key
- Organization-wide limits available on request
SDKs
Use any OpenAI-compatible SDK by setting the base URL:
TypeScript:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.RELAI_API_KEY,
baseURL: "https://eu.api.llmrelai.com/v1",
});Python:
from openai import OpenAI
client = OpenAI(
api_key=os.environ["RELAI_API_KEY"],
base_url="https://eu.api.llmrelai.com/v1",
)