Create chat completion
POST/chat/completions
Creates a model response for the given conversation. Set stream: true to receive the response as a stream of server-sent events; the final chunk carries the usage object when stream_options.include_usage is true.
Request
Responses
- 200
- 400
- 401
- 404
- 413
- 429
- 500
- 503
A chat completion. When stream is true the body is a text/event-stream of ChatCompletionChunk objects terminated by data: [DONE].
The request is malformed or a parameter is invalid. More images than the model reads, counted over the whole conversation (from 1 to 8 depending on the model: references.max in GET /v1/models), are refused with code: too_many_images and param: messages.
Missing or invalid API key.
The requested model does not exist or is not available to this key.
The request body is larger than the gateway accepts (4 MB).
Rate limit exceeded, or the service is temporarily at capacity for this model. Wait for the number of seconds in the Retry-After header before retrying.
Response Headers
Seconds to wait before retrying.
Unexpected server error: the model service returned an unexpected response (upstream_error), the request got no answer within 600 seconds (timeout), or an error in the gateway. Retry with backoff.
The model service is temporarily unavailable. Retry later and check the status page at https://status.serenityedge.ai.