Skip to main content

Chat Completions

Generate text from a conversation. Supports streaming, vision, and structured output.

Request

Parameters

Message format

Each message has a role and content:

Vision (multimodal)

For vision models, content can be an array of parts:

Structured output

Use response_format to get JSON conforming to a schema:

Response

Streaming

Set "stream": true to receive Server-Sent Events:
Each event is a data: line with a JSON chunk:
The stream ends with data: [DONE].