Interface StepFinishedChunkPayload

Content of a STEP_FINISHED chunk.

interface StepFinishedChunkPayload {
    stepIndex: number;
    text: string;
    finishReason: null | string;
    providerId: string;
    modelId: string;
    hop: number;
    usage?: ModelUsage;
    responseModel?: string;
    serviceTier?: string;
    providerMessageId?: string;
    cacheDiagnostics?: unknown;
    structuredOutput?: unknown;
    thinkingBlocks?: ThinkingBlock[];
}

Properties

stepIndex: number

0-based index of the model step within the turn.

text: string

The step's text: its deltas joined, or the final message content when the provider sent no deltas.

finishReason: null | string
providerId: string
modelId: string
hop: number

0 for the primary, n for the n-th fallback hop.

usage?: ModelUsage
responseModel?: string

Model id the provider reported serving the step.

serviceTier?: string
providerMessageId?: string

Provider message id of the step's final chunk.

cacheDiagnostics?: unknown
structuredOutput?: unknown

The step's schema answer when the turn asked for structured output and a completion-gateway hop on Anthropic returned it, as JSON text on the JSON output format or as a forced schema tool call, and it parsed; other hops return the JSON as the step's text. An answer that does not parse, and any answer the output limit stopped (max_tokens), whose JSON can parse though it was cut, is not set here: it stays the step's text, with the step's own finish reason.

thinkingBlocks?: ThinkingBlock[]

The step's extended-thinking blocks (Anthropic), so a session store can replay the step.