Skip to main content

ChatCompletionRequest

Request for chat completion with tool calling.

messages object[]required

List of messages in the conversation

  • Array [
  • roleRole (string)required

    Message role: 'user', 'assistant', 'system', or 'tool'

    content object

    Message content. Usually a string, but may be a multimodal content list (e.g. text + image_url) or null for assistant turns that only request tool calls.

    anyOf
    tool_call_id object

    For tool messages, the ID of the tool call

    anyOf
    string
    name object

    For tool messages, the tool name

    anyOf
    string
    tool_calls object

    For assistant messages replayed from prior turns, the OpenAI-format tool calls the model previously requested. Replaying these verbatim keeps the conversation prefix byte-for-byte identical so the model server's prompt cache hits on follow-up turns.

    anyOf
  • Array [
  • object
  • ]
  • ]
  • max_tool_iterationsMax Tool Iterations (integer)

    Maximum number of tool call iterations (default: 5)

    Possible values: >= 1 and <= 10

    Default value: 5
    streamStream (boolean)

    If true, stream the final assistant response in the body as newline-delimited JSON.

    Default value: false
    enable_thinking object

    Per-request thinking toggle. None means use the provider default. Ignored by providers that do not expose a per-request thinking switch.

    anyOf
    boolean
    ChatCompletionRequest
    {
    "messages": [
    {
    "role": "string",
    "tool_call_id": "string",
    "name": "string",
    "tool_calls": [
    {}
    ]
    }
    ],
    "max_tool_iterations": 5,
    "stream": false,
    "enable_thinking": true
    }