API Reference

OpenAI-Compatible REST API

Base URL: https://api.1router.com/v1

Authentication

All requests require a Bearer token in the Authorization header. Get your API key from the dashboard.

Authorization: Bearer router_sk_...

Endpoints

POST/v1/chat/completions

Create a chat completion with any model

ParameterTypeRequiredDescription
modelstringYesModel ID, e.g. openai/gpt-4o
messagesarrayYesArray of message objects
temperaturenumberNo0–2, default 1
max_tokensintegerNoMax output tokens
streambooleanNoStream response via SSE
response_formatobjectNoJSON mode: { type: "json_object" }
POST/v1/completions

Create a text completion (legacy)

ParameterTypeRequiredDescription
modelstringYesModel ID
promptstringYesInput text
max_tokensintegerNoMax output tokens
GET/v1/models

List all available models

POST/v1/embeddings

Generate text embeddings

ParameterTypeRequiredDescription
modelstringYesEmbedding model ID
inputstringYesText to embed
GET/v1/usage

Get usage statistics for your API key

ParameterTypeRequiredDescription
start_datestringNoISO 8601 date
end_datestringNoISO 8601 date

Example

Request
POST /v1/chat/completions
Authorization: Bearer router_sk_...

{
  "model": "openai/gpt-4o",
  "messages": [
    {"role": "user", "content": "Hi"}
  ]
}
Response (200)
{
  "id": "chatcmpl_abc123",
  "model": "openai/gpt-4o",
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 8,
    "completion_tokens": 7,
    "total_tokens": 15
  }
}