chat

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. 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 can replace the restored prefix after client-side context pruning. 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.

post/v1/chat/completions

Request body

modelstring

Public model ID. Defaults to toast-1

storeboolean

Whether to persist this completion for later retrieval

previous_completion_idstring nullable

ID of a stored completion this one continues (Mixedbread extension). Groups turns into a conversation for listing and deletion, and always restores the previous completion's full model context, including hosted tool calls and results

terminal_tool_namestring nullable

Function tool whose answer argument closes the stored transcript

streamboolean

Stream the completion as server-sent events

temperaturenumber nullable
top_pnumber nullable
max_completion_tokensinteger nullable
max_tokensinteger nullable

Deprecated alias of max_completion_tokens, honored when it is absent

max_tool_callsinteger nullable

Maximum number of hosted retrieval calls executed for this completion

parallel_tool_callsboolean

Whether the model may call multiple tools in one turn; when false, at most one is honored

metadataobject nullable
includestring[] nullable

Extra fields to include, e.g. store_search_call.results; unsupported values are ignored

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

idstring required
object'chat.completion'
createdinteger required
modelstring required
metadataobject nullable
titlestring nullable

Short display title of the conversation this completion belongs to (Mixedbread extension)