Skip to Content
API ReferenceChatChat (streaming)

Chat Completion streaming chunk

Streaming chunk returned by the Chat Completion API.

Attributes

  • id string
    Generated chat response ID.
  • object string
    Response object type, always chat.completion.chunk.
  • created timestamp
    Unix timestamp (seconds) when the chunk was generated.
  • model string
    Model name.
  • choices object array
    List of streamed response alternatives. Each choice object:
    Expand/Collapse
    • finish_reason string
      Why generation stopped.
    • index int
      Choice index.
    • delta object
      Incremental response chunk.
    Expand/Collapse
    • role string
      Message role, always assistant.
    • content string
      Message text content.
    • reasoning string
      Reasoning content (only for step reasoning models).
    • tool_calls object array optional
      Toolcall content.
    Expand/Collapse
    • id string
      Function call ID generated by the model; unique in context.
    • type string
      Toolcall type, always function.
    • function object
      Function payload.
    Expand/Collapse
    • name string
      Function name, usually the name provided in the previous turn’s tools list.
    • arguments string
      Function arguments as a JSON string.
  • usage object
    Token usage statistics.
    Expand/Collapse
    • prompt_tokens int
      Prompt tokens used.
    • cached_tokens int optional
      Prompt tokens served from cache.
    • completion_tokens int
      Completion tokens generated.
    • total_tokens int
      Total tokens.

Example

data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-3.5-flash","choices":[{"index":0,"delta":{"role":"","content":"Hello"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":1,"total_tokens":84}} ... data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-3.5-flash","choices":[{"index":0,"delta":{"role":"","content":"value"},"finish_reason":""}],"usage":{"prompt_tokens":83,"completion_tokens":148,"total_tokens":231}} data: {"id":"d7ae7c4a-1524-4fe5-9d58-e4d59b89d8f0","object":"chat.completion.chunk","created":1709899323,"model":"step-3.5-flash","choices":[{"index":0,"delta":{"role":"","content":""},"finish_reason":"stop"}],"usage":{"prompt_tokens":83,"completion_tokens":150,"total_tokens":233}} data: [DONE]
Last updated on