Create a Chat Completion
POST/v1/chat/completions
AuthorizationLink to section
Your Mixedbread API key as a bearer token. Format: `Bearer YOUR_API_KEY`.
Request BodyLink to section
toast-1Public model ID.
autoControls tool selection. Use `auto`, `none`, `required`, a named function, or a hosted tool type.
truePersist the completion so it can be retrieved and continued later. Set to `false` to prevent completion content from being stored for later retrieval.
ID of a stored completion this turn continues. Groups turns into one conversation and restores the previous hosted-tool context when the supplied messages extend the stored history unchanged.
falseReturn the completion as server-sent events. Hosted tool executions arrive as chunks with empty choices.
Maximum tokens to generate for the completion.
Constraints
Deprecated alias for `max_completion_tokens`; used only when `max_completion_tokens` is absent.
Constraints
Maximum number of hosted retrieval calls the agent may execute.
Constraints
trueAllow the model to request function tools in parallel.
Up to 16 string key-value pairs. Keys may contain up to 64 characters and values up to 512 characters.
Hosted-tool result payloads to include. Supported keys: `store_search_call.results`, `store_grep_call.results`, and `store_list_chunks_call.results`.
Response BodyLink to section
Unique completion ID, prefixed with `chatcmpl_`.
chat.completionUnix timestamp when the completion was created.
The stable public model ID, `toast-1`.
Metadata copied from the request.
Short display title for the stored conversation.
Server-side Store tool executions. Chunk results are present only for the requested `include` keys.
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 do my documents say about onboarding?",
}
],
extra_body={
"tools": [
{
"type": "store_search",
"store_identifiers": ["my-knowledge-base"],
}
]
},
)
print(completion.choices[0].message.content){
"id": "chatcmpl_abc123",
"object": "chat.completion",
"created": 1786622400,
"model": "toast-1",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The onboarding documents require account setup, a security review, and manager approval.",
"tool_calls": null,
"reasoning_content": null
},
"finish_reason": "stop",
"logprobs": null
}
],
"usage": {
"prompt_tokens": 184,
"completion_tokens": 22,
"total_tokens": 206
},
"metadata": null,
"title": "Onboarding requirements",
"hosted_tool_calls": [
{
"type": "store_search_call",
"id": "call_abc123",
"status": "completed",
"queries": [
"onboarding requirements"
],
"metadata_filters": null,
"filter_mode": "all",
"store": "my-knowledge-base",
"results": null,
"error": null,
"reasoning_offset": 0
}
]
}