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

Object Fields

id
string
A unique identifier for the chat completion. Each chunk has the same ID.
choices
array
A list of chat completion choices. Can be more than one if n is greater than 1.Each choice object contains:
  • index (integer): The index of the choice in the list
  • delta (object): The delta content generated by the model
    • role (string): The role of the message author (only in first chunk)
    • content (string): The content fragment of the message
  • finish_reason (string | null): The reason the model stopped generating, null if still streaming
created
integer
The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp.
model
string
The model that generated the completion.
system_fingerprint
string
This fingerprint represents the backend configuration that the model runs with.
object
string
The object type, which is always chat.completion.chunk.

Example

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion.chunk",
  "created": 1677652288,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "Hello"
      },
      "finish_reason": null
    }
  ],
  "system_fingerprint": "fp_44709d6fcb"
}

Streaming Format

When streaming is enabled (stream: true), the response is sent as Server-Sent Events (SSE). Each event contains a chunk object prefixed with data: :
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4o","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4o","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1677652288,"model":"gpt-4o","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]