ChatCompletionChunk

@Serializable
class ChatCompletionChunk(val id: String, val choices: List<ChatChoiceChunk>, val created: Long, val model: String, val systemFingerprint: String? = null, val object: String, val usage: Usage? = null)

One chunk of a streamed chat completion response.

Streaming chat endpoints emit a kotlinx.coroutines.flow.Flow of these chunks; all chunks from the same response share id and created. Clients typically concatenate ChatCompletionDelta.content across chunks to reconstruct the full assistant message.

Constructors

Link copied to clipboard
constructor(id: String, choices: List<ChatChoiceChunk>, created: Long, model: String, systemFingerprint: String? = null, object: String, usage: Usage? = null)

Properties

Link copied to clipboard

List of incremental choice updates produced on this step.

Link copied to clipboard

Unix timestamp (seconds) of the response; identical across chunks.

Link copied to clipboard
val id: String

Unique identifier shared by every chunk of a single response.

Link copied to clipboard

Model that produced the response.

Link copied to clipboard

Object type discriminator; always chat.completion.chunk.

Link copied to clipboard

Backend configuration fingerprint, if the API returned one.

Link copied to clipboard
val usage: Usage?

Token usage statistics. Only populated on the final usage chunk when streamOptions.includeUsage is set; null on regular content chunks.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String