GlobalRouter API quick start
Choose the right API surface first, then make your first call. New integrations should start with the GlobalRouter API, while migrations can keep using the compatible protocol that matches their current client.
Quick start
Choose the right API surface first, then make your first call. New integrations should start with the GlobalRouter API, while migrations can keep using the compatible protocol that matches their current client.
API Surface matrix
The four entry points match different integration paths. Use the GlobalRouter API for new features, and reserve compatible protocols for migrations or provider-style calls.
| Entry | Base Path | Role | Best for | |
|---|---|---|---|---|
| GlobalRouter APIRecommended primary API | /api/v1 | Primary long-term public API | New projects, a unified model catalog, audio, providers, credits, assets, and key management | View docs |
| OpenAI-compatible APISDK migration | /v1 | OpenAI-style compatible entry point | Projects already using OpenAI SDKs, APIs, or OpenAI-style tooling | View docs |
| OpenRouter-compatible APIOverseas aggregation | /api/v1 | OpenRouter-style compatible entry point | Overseas sites, OpenRouter provider routing, usage.cost settlement, and model/provider display | View docs |
| Seedance-compatible APIProvider-native protocol | /doubao/api/v3 | Seedance and Doubao compatible entry point | Migrations from Seedance, Doubao, or Volcengine video generation protocols | View docs |
Auth
All public HTTP APIs read the Bearer token from the Authorization header. Create an API key first, then send it with every request.
Authorization: Bearer $GR_API_KEY
First call
Calling `POST /api/v1/chat/completions` only requires a Bearer token, model ID, and messages. Set `stream` to true for SSE streaming responses.
Parameters
| Parameter | Type / Location | Required | Description |
|---|---|---|---|
Authorization | header | Yes | Bearer <GlobalRouter API Key>. |
model | string | Yes | GlobalRouter model ID, e.g. qwen3-32b. |
messages | array | Yes | OpenAI-style message array with role and content. |
stream | boolean | No | Set to true for SSE streaming responses. |
Request example
curl "https://api.globalrouter.com/api/v1/chat/completions" \
-H "Authorization: Bearer $GR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-32b",
"messages": [
{ "role": "user", "content": "Introduce GlobalRouter in three sentences." }
],
"stream": false
}'Response
Text models return OpenAI-compatible choices, message, finish_reason, and usage.
{
"id": "chatcmpl_01HV...",
"object": "chat.completion",
"created": 1716283200,
"model": "qwen3-32b",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "GlobalRouter 提供统一模型 API..." },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 18, "completion_tokens": 42, "total_tokens": 60 }
}