Create chat completion
Starting a new project? We recommend trying Responses to take advantage of the latest OpenAI platform features. Compare Chat Completions with Responses.
Creates a model response for the given chat conversation. Learn more in the text generation, vision, and audio guides.
Parameter support can differ depending on the model used to generate the response, particularly for newer reasoning models. Parameters that are only supported for reasoning models are noted below. For the current state of unsupported parameters in reasoning models, refer to the reasoning guide.
Returns a chat completion object, or a streamed sequence of chat completion chunk objects if the request is streamed.
Request body
Example request
{
"temperature": 1,
"top_p": 1,
"user": "user-1234",
"safety_identifier": "safety-identifier-1234",
"prompt_cache_key": "prompt-cache-key-1234",
"audio": {
"voice": {
"id": "voice_1234"
}
},
"stop": "\n",
"n": 1
}Response
Returns a Chat Completion object for a non-streaming request.
If stream is true, returns server-sent events (text/event-stream). Successful chunk frames contain a JSON Chat Completion chunk matching CreateChatCompletionStreamResponse. On normal completion, the final frame is:
data: [DONE]
The final frame ends with a blank line. [DONE] is literal text, not a JSON chunk, and this frame has no event: done field.
If a failure occurs after streaming has started, a data frame may contain a JSON object with an error field instead of a completion chunk. The streaming schema describes successful JSON chunks, not error frames or the completion marker. An interrupted stream may end without the marker.
Changes
Changed in 35 of the 163 revisions of this API.7857212
- ○
added the non-success response with the status
response-non-success-status-added
- ○
added the non-success response with the status
response-non-success-status-added
- ○
added the non-success response with the status
response-non-success-status-added
- ○
added the non-success response with the status
response-non-success-status-added
- ○
added the non-success response with the status
response-non-success-status-added
- ○
- ▲
the
/request property format changed from no format toint64request-property-type-changed
- ▲
- ○
added the new
gpt-6-lunaenum value to the request property//request-property-enum-value-added
- ○
added the new
gpt-6-solenum value to the request property//request-property-enum-value-added
- ○
- ○
added the new
gpt-5.1-minienum value to the request property//request-property-enum-value-added
- ○
- ▲
removed the enum value
gpt-5.1-miniof the request property//request-property-enum-value-removed
- ○
added the new
gpt-audio-minienum value to the request property//request-property-enum-value-added
- ○
added the new
gpt-audio-mini-2025-12-15enum value to the request property//request-property-enum-value-added
- ▲
- ○
added the new
gpt-6-astraenum value to the request property//request-property-enum-value-added
- ○
added the optional property
/to the response with the statusresponse-optional-property-added
- ○
added the optional property
/to the response with the statusresponse-optional-property-added
- ○
- ○
added the non-success response with the status
response-non-success-status-added
- ○
- ●
removed the optional property
/from the response with the status (media type: application/json)response-optional-property-removed
- ●
removed the optional property
/from the response with the status (media type: text/event-stream)response-optional-property-removed
- ●
- ○
added the optional property
/to the response with the status (media type: application/json)response-optional-property-added
- ○
added the optional property
/to the response with the status (media type: text/event-stream)response-optional-property-added
- ○
- ○
added the optional property
to the response with the statusresponse-optional-property-added
- ○