Mixedbread

Create a Chat Completion

POST/v1/chat/completions

AuthorizationLink to section

Authorizationstringrequired

Your Mixedbread API key as a bearer token. Format: `Bearer YOUR_API_KEY`.

Request BodyLink to section

modelstringdefault: toast-1

Public model ID.

tool_choicestring | objectdefault: auto

Controls tool selection. Use `auto`, `none`, `required`, a named function, or a hosted tool type.

storebooleandefault: true

Persist the completion so it can be retrieved and continued later. Set to `false` to prevent completion content from being stored for later retrieval.

previous_completion_idstring | null

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.

streambooleandefault: false

Return the completion as server-sent events. Hosted tool executions arrive as chunks with empty choices.

temperaturenumber | null
top_pnumber | null
max_completion_tokensinteger | null

Maximum tokens to generate for the completion.

Constraints

Minimum: 16
max_tokensinteger | null

Deprecated alias for `max_completion_tokens`; used only when `max_completion_tokens` is absent.

Constraints

Minimum: 16
max_tool_callsinteger | null

Maximum number of hosted retrieval calls the agent may execute.

Constraints

Minimum: 1
parallel_tool_callsbooleandefault: true

Allow the model to request function tools in parallel.

metadataobject | null

Up to 16 string key-value pairs. Keys may contain up to 64 characters and values up to 512 characters.

includearray | null

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

idstringrequired

Unique completion ID, prefixed with `chatcmpl_`.

objectstringrequireddefault: chat.completion
createdintegerrequired

Unix timestamp when the completion was created.

modelstringrequired

The stable public model ID, `toast-1`.

metadataobject | null

Metadata copied from the request.

titlestring | null

Short display title for the stored conversation.

hosted_tool_callsarray

Server-side Store tool executions. Chunk results are present only for the requested `include` keys.

Request
POST/v1/chat/completions
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)
Response
JSON
{
  "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
    }
  ]
}