OpenAPI 3.1.0MITraw.githubusercontent.com2026-08-11967611.3 MB

b0e4c71ef36a

Chat

Create a chat completion

Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.

post/chat/completions

Headers

X-OpenRouter-Metadata'disabled' | 'enabled'

Opt-in level for surfacing routing metadata on the response under openrouter_metadata.

Example:enabled

Opt-in to surface routing metadata on the response under openrouter_metadata. Defaults to disabled. The legacy header X-OpenRouter-Experimental-Metadata is also accepted for backward compatibility.

Request body

ChatRequest required— unresolved $ref

Response

Successful chat completion response

createdinteger required

Unix timestamp of creation

idstring required

Unique completion identifier

modelstring required

Model used for completion

object'chat.completion' required
service_tierstring nullable

The service tier used by the upstream provider for this request

system_fingerprintstring nullable required

System fingerprint

Example response

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "The capital of France is Paris.",
        "role": "assistant"
      }
    }
  ],
  "created": 1677652288,
  "id": "chatcmpl-123",
  "model": "openai/gpt-4",
  "object": "chat.completion",
  "system_fingerprint": "fp_44709d6fcb",
  "usage": {
    "completion_tokens": 15,
    "prompt_tokens": 10,
    "total_tokens": 25
  }
}