> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yourouter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API Overview

> Base URL, authentication, headers, and response conventions for model API calls.

YouRouter exposes model APIs through a single gateway. Most integrations should start with the OpenAI-compatible Chat Completions endpoint.

## Base URL

```text theme={null}
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:

```bash theme={null}
Authorization: Bearer <YOUROUTER_API_KEY>
```

For JSON requests, also send:

```bash theme={null}
Content-Type: application/json
```

<Warning>
  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.
</Warning>

## First API Call

```bash theme={null}
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:

```text theme={null}
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](/api-reference/chat/create) for the core request format, or [Multimodal](/guides/multimodal) for image and video examples.
