Follow these steps to obtain an API key for LLM-Router:
The LLM Router External API provides real-time Server-Sent Events (SSE) streaming with multi-provider routing across multiple specialized use cases. The router automatically selects optimal model endpoints and streams chunks in real-time.
| Header | Value | Status | Description |
|---|---|---|---|
| Authorization | string | Required | Bearer token:
Authorization: Bearer CSA15F2966.....50529
|
| Content-Type | string | Required | Must be application/json. |
| Accept | string | Required | Must be text/event-stream for real-time SSE streaming
chunks. |
| Parameter | Type | Status | Description |
|---|---|---|---|
| useCase | string | Required | One of: Reasoning, Coding,
Translation,
Embeddings, Vision.
|
| message | string | Optional | Single prompt text to send if not passing a full messages array. |
| messages | array | Required* | Array of conversation message objects:
[{"role": "user", "content": "..."}].
|
| images | array | Optional | Base64-encoded image string(s) for Vision use case. |
| mimeType | string | Optional | Image MIME type (e.g. image/jpeg, image/png).
Default:
image/jpeg.
|
Authenticate all API requests using the HTTP Authorization header with a
Bearer token. Do not include the API key in the request body.
Authorization: Bearer CSA15F2966.....50529
Content-Type: application/json
Accept: text/event-stream
Best for complex analytical reasoning, mathematical calculations, logic problems, step-by-step solutions, and general knowledge tasks.
{
"useCase": "Reasoning",
"messages": [
{
"role": "user",
"content": "A farmer has 17 sheep and all but 9 run away. How many sheep does the farmer have left? Explain your logic."
}
]
}
Optimized for writing clean algorithms, debugging runtime/syntax errors, code refactoring, SQL queries, REST APIs, and full functions.
{
"useCase": "Coding",
"messages": [
{
"role": "user",
"content": "Write a clean PHP function using PDO to fetch active users with pagination and return JSON."
}
]
}
Specialized in natural multi-language conversion and translation across languages (Spanish, French, Tagalog, German, Japanese, Chinese, etc.).
{
"useCase": "Translation",
"messages": [
{
"role": "user",
"content": "Translate the following welcome text into Spanish and Tagalog: 'Welcome to our platform! We are excited to help you optimize your business processes.'"
}
]
}
Produces vector embeddings or semantic representations suitable for semantic search, retrieval augmented generation (RAG), and vector databases.
{
"useCase": "Embeddings",
"messages": [
{
"role": "user",
"content": "Extract semantic embeddings vector representation for document: Artificial Intelligence in Modern Healthcare."
}
]
}
Routes to multimodal vision models. Requires Base64-encoded image string(s) passed in
the
images array and MIME type in mimeType.
{
"useCase": "Vision",
"messages": [
{
"role": "user",
"content": "Analyze this image and describe the objects and any text visible in it."
}
],
"images": [
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="
],
"mimeType": "image/png"
}
Test the external streaming endpoint directly from terminal using cURL. Choose the format for your shell:
curl.exe -k -N -X POST "https://router.coderstation.net/chat-stream" -H "Authorization: Bearer CSA15F2966.....50529" -H "Content-Type: application/json" -H "Accept: text/event-stream" -d "{\"useCase\":\"Reasoning\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain how an API gateway routes requests to microservices.\"}]}"
curl -N -X POST "https://router.coderstation.net/chat-stream" \
-H "Authorization: Bearer CSA15F2966.....50529" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{
"useCase": "Reasoning",
"messages": [
{
"role": "user",
"content": "Explain how an API gateway routes requests to microservices."
}
]
}'
$json = @'
{
"useCase": "Reasoning",
"messages": [
{
"role": "user",
"content": "Explain how an API gateway routes requests to microservices."
}
]
}
'@
$json | curl.exe -k -N -X POST "https://router.coderstation.net/chat-stream" `
-H "Authorization: Bearer CSA15F2966.....50529" `
-H "Content-Type: application/json" `
-H "Accept: text/event-stream" `
-d '@-'
The endpoint streams responses in standard Server-Sent Events protocol. It starts with
an initial
route telemetry packet, followed by delta text chunks, and completes with
data: [DONE].
event: route
data: {"provider":"Cohere","model":"command-r-plus-08-2024","use_case":"Reasoning"}
data: {"choices":[{"delta":{"content":"An"}}]}
data: {"choices":[{"delta":{"content":" API"}}]}
data: {"choices":[{"delta":{"content":" gateway acts as a single entry point..."}}]}
data: [DONE]