Skip to main content

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 last chunk before data: [DONE] carries the usage object on every stream, whether or not stream_options.include_usage is set. An error after the stream has started (the API commits a stream that the model has not answered within 2 seconds, and keeps it alive with : ping comment lines) arrives as a final data: event whose JSON has an error member, the usual error object, followed by data: [DONE]; see the streaming guide.

Request​

Responses​

A chat completion. When stream is true the body is a text/event-stream of ChatCompletionChunk objects terminated by data: [DONE].