ModelChunk

One item of a Model.send stream: a text delta, a finished output part, the final done chunk, or one terminal rejected chunk when the send failed before any content.

A union discriminated by kind.

delta

kind"delta"required

"delta": a piece of streamed text, shown live and not recorded on its own.

textstringrequired

The new text since the last delta.

part

kind"part"required

"part": one finished output part.

partOutputPartrequired

The finished part (text, tool call, reasoning or hosted tool result). Parts are recorded in the order they arrive.

done

kind"done"required

"done": the last chunk of a successful send, with its stop reason and usage.

stop_reasonModelResponseEvent.data.stop_reasonrequired

Only end_turn, stop_sequence and refusal complete a turn; tool_use dispatches; max_tokens continues; pause_turn re-requests with the paused content as-is, up to context.max_pause_continuations; context_window_exceeded ends the turn context_exhausted; other (a reason the adapter can't name) ends it error.

usageUsagerequired

Per-field measured-or-unknown usage.

rejected

kind"rejected"required

"rejected": the send failed before any content; always the stream's only and last chunk.

reason"rate_limited" | "overloaded" | "server_error" | "prompt_too_long" | "provider_error" | "stale_epoch" | "content_unsupported" | "continuation_unsupported" | "transport_fence_unsupported"required

The terminal error of a send: exactly Model.send returns.errors. Provider classes are recorded as model_attempt_abandoned{provider_outcome: failed}; stale_epoch appends nothing (the writer lost its lease); content_unsupported, continuation_unsupported and transport_fence_unsupported are recorded as not_sent and end the turn with that code, never retried.

http_statusnumber

The provider's HTTP status code (for example 429 or 529), recorded with the abandoned attempt. Omitted when there was no HTTP response.

retry_after_msnumber

The provider's retry-after hint in milliseconds. When present the retry waits this long instead of backing off, and a hint longer than the retry policy's max_retry_after_ms ends the turn. Omitted when the provider gave none.

billingModelAttemptAbandonedEvent.data.billing

not_billed only when provider_outcome is not_sent or the adapter's declared billing contract (in the system prompt adapter settings) states this rejection class is not billed; a status code alone is not proof.

Edit on GitHub

On this page