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
- 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.
Missing or invalid API key.
The requested model does not exist or is not available to this key.
Rate limit exceeded. Wait for the number of seconds in the Retry-After header before retrying.
Response Headers
Retry-After
Seconds to wait before retrying.
The server encountered an unexpected error.
The service is temporarily at capacity. Retry with backoff.
Response Headers
Retry-After
Seconds to wait before retrying.