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

# OpenAI-compatible API

> Use Toqan Router as an OpenAI-compatible API proxy and access 500+ LLM models with the existing OpenAI SDK by changing only the base URL.

The **AI Gateway** exposes endpoints that are fully compatible with the OpenAI API, letting you use every model available in the **AI Gateway** without changing your application logic. Keep the existing OpenAI client, point it to the Toqan Router proxy baseURL, and continue as usual.

> [!NOTE]
>
> For the OpenAI API specification, see [the API Reference](https://platform.openai.com/docs/api-reference/chat)

> [!TIP]
>
> To move an existing application from the OpenAI SDK, the [**Anthropic SDK**](/docs/ai-gateway/features/anthropic-messages-api.md), **OpenRouter**, or **LiteLLM**, see [Migrate to Toqan Router](/docs/ai-gateway/get-started/migrate.md).

> [!TIP]
>
> **Drop-in Integration (No Code Changes)**
>
> 1. Keep your existing OpenAI SDK or HTTP integration.
> 2. Set the base URL to `https://router.toqan.ai/eu/v3/router`
> 3. Use the Toqan Router API Key in the Authorization header.
> 4. Call the same endpoints and payloads already used with OpenAI.

> [!NOTE]
>
> A **Model Fusion** answers each request with a panel of models and returns one judged response: pass its model ID as `model`. See [Model Fusion](/docs/ai-gateway/model-fusion.md).

## Base URL

OpenAI-compatible endpoint:

```text URL theme={"theme":{"light":"github-light","dark":"github-dark"}}
https://router.toqan.ai/eu/v3/router
```

All routes below are relative to this base URL. The OpenAI-compatible routes mirror OpenAI’s request and response formats.

## Authentication

Authenticate with the Toqan Router API key via the `Authorization: Bearer $TOQAN_API_KEY` header.

> [!NOTE]
>
> To learn more about Toqan Router API Key, see API Key.

Minimum headers:

* `Authorization: Bearer $TOQAN_API_KEY`
* `Content-Type: application/json`

## Supported Endpoints

### OpenAI-compatible

These routes match the OpenAI API: same schema, parameters, and response format. See the compatibility notes below for the exceptions.

* `GET /models`: List available models
* `POST /chat/completions`: Chat completions (supports streaming, images, files, and tool calls)
* `POST /completions`: Text completions
* `POST /embeddings`: Vector embeddings ([Embeddings](/docs/ai-gateway/features/embeddings.md))
* `POST /images/generations`: Image generation
* `POST /images/edits`: Image editing
* `POST /images/variations`: Image variations
* `POST /moderations`: Text moderation ([Rerank and Moderations](/docs/ai-gateway/features/rerank-and-moderations.md#moderations))
* `POST /audio/speech`: Text-to-speech
* `POST /audio/transcriptions`: Transcribe audio into the input language
* `POST /audio/translations`: Translate audio into English
* `POST /responses`: Create a model response with built-in tools ([Responses API](/docs/ai-gateway/features/responses-api.md), [Web Search](/docs/ai-gateway/features/web-search.md))
* `GET /responses/{response_id}`: Retrieve a stored response ([Responses API](/docs/ai-gateway/features/responses-api.md))
* `POST /batches`, `GET /batches`, `GET /batches/{batch_id}`, `GET /batches/{batch_id}/results`, `POST /batches/{batch_id}/cancel`: Batch processing ([Batches](/docs/ai-gateway/features/batches.md))

### Toqan Router routes

These routes are served on the same base URL but use their own request and response contracts, not the OpenAI ones.

* `POST /rerank`: Rerank results ([Rerank and Moderations](/docs/ai-gateway/features/rerank-and-moderations.md#rerank))
* `POST /decisions`: Run typed classification questions against a decision model ([Decisions](/docs/ai-gateway/features/decisions.md))
* `POST /classify`: Deprecated alias for `POST /decisions`
* `POST /ocr`: Extract text and structure from a document or image ([OCR](/docs/ai-gateway/features/ocr.md))

## Models

Use the model field exactly as you would with OpenAI, substituting the ID of any model available in the [AI Gateway Models](/docs/ai-gateway/using-the-router.md).

## Error Handling & Compatibility Notes

* HTTP status codes and error structures follow OpenAI’s conventions.
* Streaming, function/tool calls, and multimodal inputs (images/files) are supported on /chat/completions.
* Sending `tools` to `/chat/completions` with an OpenAI reasoning model such as `openai/gpt-5.6-sol` returns `400`. Use `/responses` instead, or set `reasoning_effort` to `none`, which drops the reasoning the model would otherwise do. See [Migrate to Toqan Router](/docs/ai-gateway/get-started/migrate.md#what-does-not-carry-over).
* The **AI Gateway** serves the current surface under `/v3/router`: target this path for new integrations. The earlier paths under `/v2/router/` remain published for backward compatibility.

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.