> ## Documentation Index
> Fetch the complete documentation index at: https://friendli.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Dedicated Messages Chunk Object

> Schema reference for the streamed messages chunk object returned by Friendli Dedicated Endpoints when using the Messages API with streaming.

Represents a streamed chunk object of a Messages response returned by the model, based on the provided input.

<ResponseExample>
  ```json Response theme={null}
  event: message_start
  data: {
    "type": "message_start",
    "message": {
      "id": "msg_4b71d12c86d94e719c7e3984a7bb7941",
      "type": "message",
      "role": "assistant",
      "content": [],
      "stop_reason": null,
      "stop_sequence": null,
      "usage": { "input_tokens": 0, "output_tokens": 0, "cache_read_input_tokens": 0 }
    }
  }

  event: content_block_start
  data: {
    "type": "content_block_start",
    "index": 0,
    "content_block": { "type": "text", "text": "" }
  }

  event: content_block_delta
  data: {
    "type": "content_block_delta",
    "index": 0,
    "delta": { "type": "text_delta", "text": "Hello" }
  }

  event: content_block_delta
  data: {
    "type": "content_block_delta",
    "index": 0,
    "delta": { "type": "text_delta", "text": ", how can I help?" }
  }

  event: content_block_stop
  data: { "type": "content_block_stop", "index": 0 }

  event: message_delta
  data: {
    "type": "message_delta",
    "delta": { "stop_reason": "end_turn", "stop_sequence": null },
    "usage": { "output_tokens": 11 }
  }

  event: message_stop
  data: { "type": "message_stop" }
  ```

  ```json Tool delta example theme={null}
  event: message_start
  data: {
    "type": "message_start",
    "message": {
      "id": "msg_4b71d12c86d94e719c7e3984a7bb7941",
      "type": "message",
      "role": "assistant",
      "content": [],
      "stop_reason": null,
      "stop_sequence": null,
      "usage": { "input_tokens": 0, "output_tokens": 0, "cache_read_input_tokens": 0 }
    }
  }

  event: content_block_start
  data: {
    "type": "content_block_start",
    "index": 0,
    "content_block": { "type": "tool_use", "id": "toolu_01A", "name": "get_weather", "input": {} }
  }

  event: content_block_delta
  data: {
    "type": "content_block_delta",
    "index": 0,
    "delta": { "type": "input_json_delta", "partial_json": "{\"location\":\"Seoul\"" }
  }

  event: content_block_delta
  data: {
    "type": "content_block_delta",
    "index": 0,
    "delta": { "type": "input_json_delta", "partial_json": ",\"date\":\"2026-03-12\"}" }
  }

  event: content_block_stop
  data: { "type": "content_block_stop", "index": 0 }

  event: message_delta
  data: {
    "type": "message_delta",
    "delta": { "stop_reason": "tool_use", "stop_sequence": null },
    "usage": { "output_tokens": 19 }
  }

  event: message_stop
  data: { "type": "message_stop" }
  ```

  ```json Thinking delta example theme={null}
  event: message_start
  data: {
    "type": "message_start",
    "message": {
      "id": "msg_4b71d12c86d94e719c7e3984a7bb7941",
      "type": "message",
      "role": "assistant",
      "content": [],
      "stop_reason": null,
      "stop_sequence": null,
      "usage": { "input_tokens": 0, "output_tokens": 0, "cache_read_input_tokens": 0 }
    }
  }

  event: content_block_start
  data: {
    "type": "content_block_start",
    "index": 0,
    "content_block": { "type": "thinking", "thinking": "" }
  }

  event: content_block_delta
  data: {
    "type": "content_block_delta",
    "index": 0,
    "delta": { "type": "thinking_delta", "thinking": "I should answer briefly." }
  }

  event: content_block_delta
  data: {
    "type": "content_block_delta",
    "index": 0,
    "delta": { "type": "signature_delta", "signature": "sig_abc123" }
  }

  event: content_block_stop
  data: { "type": "content_block_stop", "index": 0 }

  event: message_delta
  data: {
    "type": "message_delta",
    "delta": { "stop_reason": "end_turn", "stop_sequence": null },
    "usage": { "output_tokens": 8 }
  }

  event: message_stop
  data: { "type": "message_stop" }
  ```
</ResponseExample>

### `event: message_start` chunk object

<ResponseField name="type" type="string" required="true">
  Always `message_start`.
</ResponseField>

<ResponseField name="message" type="object" required="true">
  Initial response envelope for this streamed message.

  <Expandable title="child attributes">
    <ResponseField name="id" type="string" required="true">
      Unique ID of the response message.
    </ResponseField>

    <ResponseField name="type" type="string" required="true">
      Object type, always `message`.
    </ResponseField>

    <ResponseField name="role" type="string" required="true">
      Author role of streamed output, always `assistant`.
    </ResponseField>

    <ResponseField name="content" type="object[]" required="true">
      Initialized as an empty array at start. Populated by subsequent block events.
    </ResponseField>

    <ResponseField name="stop_reason" type="enum<string> | null">
      Stop reason placeholder at start.

      Available options: `end_turn`, `max_tokens`, `tool_use`, `stop_sequence`
    </ResponseField>

    <ResponseField name="stop_sequence" type="string | null">
      Matched stop sequence placeholder at start.
    </ResponseField>

    <ResponseField name="usage" type="object" required="true">
      Running usage object.

      <Expandable title="child attributes">
        <ResponseField name="input_tokens" type="integer" required="true">
          Number of billed input tokens.
        </ResponseField>

        <ResponseField name="output_tokens" type="integer" required="true">
          Number of billed output tokens currently emitted.
        </ResponseField>

        <ResponseField name="cache_read_input_tokens" type="integer | null">
          Number of cached input tokens read, when applicable.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="model" type="string | null">
      Model identifier for this response, when available.
    </ResponseField>
  </Expandable>
</ResponseField>

### `event: content_block_start` chunk object

<ResponseField name="type" type="string" required="true">
  Always `content_block_start`.
</ResponseField>

<ResponseField name="index" type="integer" required="true">
  Index of the content block in the response `content` array.
</ResponseField>

<ResponseField name="content_block" type="object" required="true">
  Initial content block payload.

  <Expandable title="child attributes">
    <ResponseField name="type" type="enum<string>" required="true">
      Content block type.

      Available options: `text`, `thinking`, `tool_use`
    </ResponseField>

    <ResponseField name="text" type="string">
      Text content when `type=text`.
    </ResponseField>

    <ResponseField name="thinking" type="string">
      Reasoning content when `type=thinking`.
    </ResponseField>

    <ResponseField name="signature" type="string | null">
      Optional signature when `type=thinking`.
    </ResponseField>

    <ResponseField name="id" type="string">
      Tool call ID when `type=tool_use`.
    </ResponseField>

    <ResponseField name="name" type="string">
      Tool name when `type=tool_use`.
    </ResponseField>

    <ResponseField name="input" type="object">
      Parsed tool input object when `type=tool_use`.
    </ResponseField>
  </Expandable>
</ResponseField>

### `event: content_block_delta` chunk object

<ResponseField name="type" type="string" required="true">
  Always `content_block_delta`.
</ResponseField>

<ResponseField name="index" type="integer" required="true">
  Index of the content block being updated.
</ResponseField>

<ResponseField name="delta" type="object" required="true">
  Incremental delta payload.

  <Expandable title="child attributes">
    <ResponseField name="type" type="enum<string>" required="true">
      Delta type.

      Available options: `text_delta`, `thinking_delta`, `signature_delta`, `input_json_delta`
    </ResponseField>

    <ResponseField name="text" type="string">
      Text fragment when `type=text_delta`.
    </ResponseField>

    <ResponseField name="thinking" type="string">
      Reasoning fragment when `type=thinking_delta`.
    </ResponseField>

    <ResponseField name="signature" type="string">
      Signature fragment when `type=signature_delta`.
    </ResponseField>

    <ResponseField name="partial_json" type="string">
      Partial JSON fragment for tool arguments when `type=input_json_delta`.
    </ResponseField>
  </Expandable>
</ResponseField>

### `event: content_block_stop` chunk object

<ResponseField name="type" type="string" required="true">
  Always `content_block_stop`.
</ResponseField>

<ResponseField name="index" type="integer" required="true">
  Index of the block that has finished streaming.
</ResponseField>

### `event: message_delta` chunk object

<ResponseField name="type" type="string" required="true">
  Always `message_delta`.
</ResponseField>

<ResponseField name="delta" type="object" required="true">
  Final message-level delta.

  <Expandable title="child attributes">
    <ResponseField name="stop_reason" type="enum<string> | null">
      Why generation stopped.

      Available options: `end_turn`, `max_tokens`, `tool_use`, `stop_sequence`
    </ResponseField>

    <ResponseField name="stop_sequence" type="string | null">
      Matched stop sequence when `stop_reason=stop_sequence`.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="usage" type="object | null">
  Usage delta object that may be emitted near stream completion.

  <Expandable title="child attributes">
    <ResponseField name="input_tokens" type="integer | null">
      Input token count delta when included.
    </ResponseField>

    <ResponseField name="output_tokens" type="integer | null">
      Output token count delta when included.
    </ResponseField>

    <ResponseField name="cache_read_input_tokens" type="integer | null">
      Cached input token count delta when included.
    </ResponseField>
  </Expandable>
</ResponseField>

### `event: message_stop` chunk object

<ResponseField name="type" type="string" required="true">
  Always `message_stop`. Indicates stream completion.
</ResponseField>

### `event: error` chunk object

<ResponseField name="type" type="string" required="true">
  Always `error`.
</ResponseField>

<ResponseField name="error" type="object" required="true">
  Error payload object.

  <Expandable title="child attributes">
    <ResponseField name="type" type="string" required="true">
      Error category, such as `invalid_request_error`.
    </ResponseField>

    <ResponseField name="message" type="string" required="true">
      Human-readable error message.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="request_id" type="string | null">
  Request identifier for debugging and support.
</ResponseField>
