ReferenceAPI ReferenceOpen A I Compatible

Create chat completion

Creates a chat completion for the given messages. Drop-in replacement for the OpenAI Chat Completions API — accepts the same request schema and returns the same response format, including usage with token counts.

The router resolves the requested model to an upstream provider, forwards the request, and returns the response. Supports both synchronous and streaming modes.

When stream: true, the response is sent as Server-Sent Events (SSE) where each data line contains a ChatCompletionChunk JSON object. The stream ends with data: [DONE].

POST
/v1/chat/completions

Authorization

x-api-key<token>

Anthropic-style API key header.

In: header

Request Body

application/json

Chat completion request. The router forwards a slightly enriched version of this body to the resolved upstream provider.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://api.bitrouter.ai/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "messages": [      null    ],    "model": "string"  }'
{
  "choices": [
    null
  ],
  "created": 0,
  "id": "string",
  "model": "string",
  "object": "string",
  "usage": null
}
{
  "error": null
}
{
  "error": null
}
{
  "error": null
}

How is this guide?