Create a chat completion
Create a chat completion, optionally grounded in the caller's stores.
Supports the OpenAI Chat Completions API subset: a message list, function tools, streaming via server-sent events, and persistence via store. A request without hosted tools is one generation over exactly what was sent: no instructions, tools, or turns are added. The previous_completion_id groups stored turns into a conversation and restores the full model context; callers normally send only the new suffix. (previous_messages and terminal_tool_name are deprecated: resend the full edited history in messages instead.) Retrieval is opt-in: declare the hosted store tools (store_search, store_grep, store_list_chunks, store_metadata_facets, list_stores) in tools to let the model search, grep, filter, and read the caller's stores server-side, scoped by each declaration. Those executions are reported in the hosted_tool_calls extension field (and as extra streaming chunks), with chunk results included only for the requested include keys. A model call to a caller-declared function tool ends the completion with tool_calls on the choice message (finish_reason tool_calls); execute the functions and continue the conversation by appending the assistant message and the matching tool messages to the next request.
Request body
Example request
{
"tools": [
{
"filters": {
"all": [
{
"key": "price",
"operator": "gt",
"value": "100"
},
{
"key": "color",
"operator": "eq",
"value": "red"
}
],
"any": [
{
"key": "price",
"operator": "gt",
"value": "100"
},
{
"key": "color",
"operator": "eq",
"value": "red"
}
],
"none": [
{
"key": "price",
"operator": "gt",
"value": "100"
},
{
"key": "color",
"operator": "eq",
"value": "red"
}
]
}
}
]
}Response
The generated chat completion, or a server-sent event stream of completion chunks
Changes
Changed in 10 of the 30 revisions of this API.406455
- ▲
the
////request property type changed fromobjectto no typerequest-property-type-changed
- ▲
the
/////request property type changed fromobjectto no typerequest-property-type-changed
- ▲
added to the
/////response propertyoneOflist for the response statusresponse-property-one-of-added
- ▲
added to the
/////response propertyoneOflist for the response statusresponse-property-one-of-added
- ▲
the
/////response's property type changed fromobjectto no type for statusresponse-property-type-changed
- ▲
the
/////response's property type changed fromobjectto no type for statusresponse-property-type-changed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ●
removed the request property
/////request-property-removed
- ●
removed the request property
/////request-property-removed
- ●
removed the request property
/////request-property-removed
- ●
removed the request property
/////request-property-removed
- ●
removed the request property
/////request-property-removed
- ●
removed the request property
/////request-property-removed
- ●
removed the request property
//////request-property-removed
- ●
removed the request property
//////request-property-removed
- ●
removed the request property
//////request-property-removed
- ●
removed the request property
//////request-property-removed
- ●
removed the request property
//////request-property-removed
- ●
removed the request property
//////request-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ○
added discriminator to
////request propertyrequest-property-discriminator-added
- ○
added discriminator to
/////request propertyrequest-property-discriminator-added
- ○
added to the
////request propertyoneOflistrequest-property-one-of-added
- ○
added to the
/////request propertyoneOflistrequest-property-one-of-added
- ○
added discriminator to
/////response property for the response statusresponse-property-discriminator-added
- ○
added discriminator to
/////response property for the response statusresponse-property-discriminator-added
- ▲
- ○
added the new optional request property
new-optional-request-property
- ○
added the optional property
///to the response with the statusresponse-optional-property-added
- ○
- ○
added the new optional request property
///new-optional-request-property
- ○
added the new optional request property
////new-optional-request-property
- ○
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
- ○
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
This revision also has 3 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ●
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
///from the response with the statusresponse-optional-property-removed
This revision also has 31 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ●
- ▲
the
///request property's max was decreased to30.00request-property-max-decreased
- ▲
the
///request property's max was decreased to30.00request-property-max-decreased
- ▲
the
///request property's max was decreased to30.00request-property-max-decreased
- ▲
the
///request property's max was decreased to20.00request-property-max-decreased
- ▲
added to the
/response propertyoneOflist for the response statusresponse-property-one-of-added
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ▲
removed the required property
//////from the response with the statusresponse-required-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ●
removed the optional property
//////from the response with the statusresponse-optional-property-removed
- ○
added the new optional request property
new-optional-request-property
- ○
added to the
request propertyanyOflistrequest-property-any-of-added
- ○
the
request property default value changed from10to5request-property-default-value-changed
- ○
the
request property default value changed from30to10request-property-default-value-changed
- ○
the
request property default value changed from5to8request-property-default-value-changed
- ○
request property
/deprecatedrequest-property-deprecated
- ○
request property
/deprecatedrequest-property-deprecated
- ○
request property
/deprecatedrequest-property-deprecated
- ○
request property
/deprecatedrequest-property-deprecated
- ○
request property
//deprecatedrequest-property-deprecated
- ○
request property
//deprecatedrequest-property-deprecated
- ○
request property
//deprecatedrequest-property-deprecated
- ○
request property
//deprecatedrequest-property-deprecated
- ○
added
filter_chunksget_chunksgrepinspect_metadatasearch_corpusdiscriminator mapping keys to the/request propertyrequest-property-discriminator-mapping-added
- ○
added to the
/request propertyoneOflistrequest-property-one-of-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
- ○
response property
hosted_tool_calls/items/oneOf[subschema #1: StoreSearchCallItem -> subschema #6: StoreSearchCallItem]/deprecatedresponse-property-deprecated
- ○
response property
hosted_tool_calls/items/oneOf[subschema #2: StoreGrepCallItem -> subschema #7: StoreGrepCallItem]/deprecatedresponse-property-deprecated
- ○
response property
hosted_tool_calls/items/oneOf[subschema #3: StoreListChunksCallItem -> subschema #8: StoreListChunksCallItem]/deprecatedresponse-property-deprecated
- ○
response property
hosted_tool_calls/items/oneOf[subschema #4: MetadataFacetsCallItem -> subschema #9: MetadataFacetsCallItem]/deprecatedresponse-property-deprecated
- ○
added
filter_chunks_callget_chunks_callgrep_callinspect_metadata_callsearch_corpus_calldiscriminator mapping keys to the/response property for the response statusresponse-property-discriminator-mapping-added
This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲
- ○
request property
deprecatedrequest-property-deprecated
- ○
request property
deprecatedrequest-property-deprecated
- ○
- ○
added the new optional request property
///new-optional-request-property
- ○
added the new optional request property
new-optional-request-property
- ○
added the new optional request property
new-optional-request-property
- ○
added the optional property
to the response with the statusresponse-optional-property-added
- ○
- ▲
request property
list-of-types was narrowed by removing typesnullfrom media typeapplication/jsonrequest-property-list-of-types-narrowed
- ▲
the
////request property's minItems was increased to1request-property-min-items-increased
- ▲
the
////request property's minItems was increased to1request-property-min-items-increased
- ▲
the
////request property's minItems was increased to1request-property-min-items-increased
- ▲
the
////request property's minItems was increased to1request-property-min-items-increased
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ●
removed the request property
///request-property-removed
- ○
the
request property default valuetoast-1was addedrequest-property-default-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 required request body
request-body-added-required
- ▲
the response's body type changed from no type to
objectfor statusresponse-body-type-changed
- ○
api tag
chataddedapi-tag-added
- ○
api tag
completionsremovedapi-tag-removed
- ○
added the non-success response with the status
response-non-success-status-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 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 optional property
to the response with the statusresponse-optional-property-added
- ○
added the required property
to the response with the statusresponse-required-property-added
- ○
added the required property
to the response with the statusresponse-required-property-added
- ○
added the required property
to the response with the statusresponse-required-property-added
- ○
added the required property
to the response with the statusresponse-required-property-added
This revision also has 35 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲