YouRouter exposes model APIs through a single gateway. Most integrations should start with the OpenAI-compatible Chat Completions endpoint.
Base URL
https://api.yourouter.ai/v1
OpenAI-compatible and provider-native model calls use this base URL. Video tasks and Custom Search use their own base paths, shown below.
Endpoint Families
| Family | Base path | Use it for |
|---|
| Model APIs | https://api.yourouter.ai/v1 | Chat Completions, Embeddings, Anthropic Messages, and Google generateContent paths. |
| Video tasks | https://api.yourouter.ai/api/v3 | Ark text-to-video and image-to-video task creation and polling. |
| Custom Search | https://api.yourouter.ai/customsearch/v1 | Google Programmable Search-compatible web search. |
Authentication
Send your YouRouter API key as a bearer token:
Authorization: Bearer <YOUROUTER_API_KEY>
For JSON requests, also send:
Content-Type: application/json
Use API keys only from server-side code, backend services, CI jobs, or trusted internal tools. Do not put API keys in browser-side code or mobile clients.
First API Call
curl https://api.yourouter.ai/v1/chat/completions \
-H "Authorization: Bearer $YOUROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Reply with exactly: connected"
}
]
}'
Read the generated text from:
choices[0].message.content
Core Concepts
| Concept | How to use it |
|---|
| Model selection | Set the model field in the request body. |
| Multimodal input | Send text and image content blocks in messages[].content, or use provider-native multimodal endpoints. |
| Automatic routing | Omit the vendor header, or send vendor: auto. |
| Provider pinning | Send vendor: openai, vendor: anthropic, vendor: google, or another supported provider. |
| Streaming | Set stream: true for incremental server-sent event chunks. |
| Provider-native APIs | Use /messages for Anthropic-compatible calls or Google generateContent paths for Gemini-compatible calls. |
Main Endpoints
| Endpoint | Purpose |
|---|
POST /chat/completions | OpenAI-compatible text and image-input model calls. Recommended for most integrations. |
POST /embeddings | Generate text embeddings with compatible embedding models. |
POST /messages | Anthropic Messages-compatible model calls. |
POST /projects/.../models/{model}:generateContent | Google Gemini generateContent-compatible model calls. |
POST /api/v3/contents/generations/tasks | Task-based video generation calls. |
Status Codes
| Status | Meaning |
|---|
200 | Request succeeded. |
400 | The request body, model, or parameter format is invalid. |
401 | The API key is missing or invalid. |
429 | A provider rate limit or concurrency limit was reached. |
500 | The gateway or upstream provider returned an internal error. |
See Create Chat Completion for the core request format, or Multimodal for image and video examples.