Bluestep JS Documentation
    Preparing search index...

    Interface AiIterationState

    Where the call stands after one model round-trip, handed to onIteration. The counts are running totals for the call; text and toolCalls are what this round-trip produced.

    interface AiIterationState {
        cacheReadTokens: number;
        cacheWriteTokens: number;
        durationMillis: number;
        inputTokens: number;
        iteration: number;
        outputTokens: number;
        stopReason: string;
        text: string;
        toolCalls: AiToolCallEvent[];
    }
    Index
    cacheReadTokens: number

    Input tokens served from the provider's prompt cache so far. A subset of inputTokens.

    cacheWriteTokens: number

    Input tokens written into the provider's prompt cache so far. A subset of inputTokens.

    durationMillis: number

    Wall-clock milliseconds since the call began, on the same clock as AiCallResult.durationMillis.

    inputTokens: number

    Input tokens consumed so far by this call, cached ones included.

    iteration: number

    Which round-trip this is, counting from 1 across the whole call — every onTurn exchange included.

    outputTokens: number

    Output tokens consumed so far by this call.

    stopReason: string

    The provider's stop reason for this round-trip, in its own spelling — AiCallResult.stopReason documents the vocabulary. Null when the provider sent none.

    text: string

    The text the model wrote on this round-trip. Empty when it only requested tools.

    toolCalls: AiToolCallEvent[]

    The tool calls the model requested on this round-trip. Empty when it answered instead. On the chat path none of them has run yet, and returning {stop: true} leaves them unexecuted; on a realtime audio turn they have already run — the provider streams each request ahead of the response completing — so a stop there withholds their results from the model and ends the session rather than preventing them.