ReadonlycacheInput tokens served from the provider's prompt cache so far. A subset of inputTokens.
ReadonlycacheInput tokens written into the provider's prompt cache so far. A subset of inputTokens.
ReadonlydurationWall-clock milliseconds since the call began, on the same clock as AiCallResult.durationMillis.
ReadonlyinputInput tokens consumed so far by this call, cached ones included.
ReadonlyiterationWhich round-trip this is, counting from 1 across the whole call — every onTurn exchange included.
ReadonlyoutputOutput tokens consumed so far by this call.
ReadonlystopThe provider's stop reason for this round-trip, in its own spelling — AiCallResult.stopReason documents the vocabulary. Null when the provider sent none.
ReadonlytextThe text the model wrote on this round-trip. Empty when it only requested tools.
ReadonlytoolThe 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.
Where the call stands after one model round-trip, handed to
onIteration. The counts are running totals for the call;textandtoolCallsare what this round-trip produced.Example: ```javascript B.ai.call({ message: B.net.request.parameter("q"), tools: [lookup], onIteration: (state) => state.inputTokens > 100000 ? { stop: true, reason: "input budget reached" } : null, }); ```