Chat Completions
The Mixedbread Chat Completions API is an OpenAI Chat Completions-compatible endpoint for Mixedbread specialized models and agentic workflows. It supports text conversations, streaming, stored continuations, and client-executed function tools. It is the surface for bringing your own harness: your application owns the message list and the tool loop, and the API adds nothing you did not ask for; see Build Your Own Harness for the complete guide. The hosted store tools work here too, mirrored into the Chat shape.
You can use the OpenAI SDK by changing base_url and api_key, then selecting
a model from the supported models.
Prerequisite
Get a Mixedbread API key from the API Keys page. A scope-restricted key needs the Completions scope for these endpoints; see API keys. You can install the OpenAI SDK or use cURL directly.
pip install openaiMake your first request
Point base_url to Mixedbread, use your Mixedbread API key, and select one
supported model.
from openai import OpenAI
client = OpenAI(
base_url="https://api.mixedbread.com/v1",
api_key="YOUR_API_KEY",
)
completion = client.chat.completions.create(
model="toast-1",
messages=[
{
"role": "user",
"content": "What is a search agent?",
}
],
)
print(completion.choices[0].message.content)Read the generated message from choices[0].message.
OpenAI compatibility
Mixedbread accepts the OpenAI Chat Completions shape for supported fields. The tables below cover important Mixedbread behavior:
Request fields
| Field or value | Behavior |
|---|---|
previous_completion_id | Continues a stored completion and restores its prior model context, hosted tool calls and server-side context edits included, when the supplied messages extend the stored history. |
Function definitions in tools | Gives the model client-executed functions it can call. |
Hosted tool types in tools | Opts into server-executed store tools such as search_corpus; see Hosted Tools. |
tool_choice | Lets the model choose automatically, prevents function calls, requires one, or forces a named function or hosted tool. With hosted tools it applies to the first model turn; later turns of the server loop use auto. |
max_tool_calls | Caps the server-executed tool calls of one completion (default 16); ignored when no hosted tool is declared. |
context_management | Opts into server-side context editing; see managing the context window. |
store | Set to false to enable zero data retention. Completion content is not retained, and no retrievable completion is created. Operational model and token metadata is still recorded. |
include | Adds hidden fields to hosted call items, e.g. search_corpus_call.results. Unsupported values are ignored. |
Response fields
| Field | Behavior |
|---|---|
title | Returns the generated title of a stored conversation. |
choices[].message.tool_calls | Returns function calls your application must execute before continuing the conversation. |
choices[].message.reasoning_content | The model's reasoning content; always null for toast-1. See reasoning and thinking. |
hosted_tool_calls | Records the server-executed tool calls of a hosted run, in execution order. |
context_management | The context edits applied while serving the request; only present when at least one was applied. |
usage.completion_tokens_details.reasoning_tokens | Tokens spent on model reasoning; 0 for toast-1. |
See every request and response field in the API reference.
Hosted tools on Chat Completions
Declare a hosted store tool and the server runs the whole search loop inside one completion: the model searches your stores, reads the results, and answers in plain text.
completion = client.chat.completions.create(
model="toast-1",
messages=[{"role": "user", "content": "Which suppliers had recalls in 2023?"}],
tools=[{"type": "search_corpus", "store_identifiers": ["my-store"]}],
)
print(completion.choices[0].message.content)The answer arrives in choices[].message.content; the calls the server ran
are recorded in hosted_tool_calls beside choices. The tools behave the
same on both APIs: the Hosted Tools page documents
the tools, the store scope, context_management, and how a run ends, with
every request shown in the Chat shape as well.
Reasoning and thinking
Toast 1 has no thinking channel: thinking is disabled at the chat template,
and chat_template_kwargs is not a parameter of this API (unknown fields are
ignored). reasoning_content is therefore always null, and
usage.completion_tokens_details.reasoning_tokens is always 0.
A hosted run returns the model's answer in choices[].message.content; the
tools it ran to get there are recorded in hosted_tool_calls.