Type Alias: AIBatchResult<T>
AIBatchResult<
T> = {cachedInputTokens?:number;error?:undefined;id:string;inputTokens:number;outputTokens:number;prompt:string;reasoningTokens?:number;reportedCostUsd?:number;result:T;servedBy?:string;status:"succeeded";validated?:boolean; } | {cachedInputTokens?:number;error:string;id:string;inputTokens:number;outputTokens:number;prompt:string;reasoningTokens?:number;reportedCostUsd?:number;responseText?:string;result?:undefined;servedBy?:string;status:"failed";validated?:boolean; }
Defined in: packages/workflow-engine/src/ai/types.ts:544
Result of a single request in a batch
Type Parameters
T
T = string
Union Members
Type Literal
{ cachedInputTokens?: number; error?: undefined; id: string; inputTokens: number; outputTokens: number; prompt: string; reasoningTokens?: number; reportedCostUsd?: number; result: T; servedBy?: string; status: "succeeded"; validated?: boolean; }
cachedInputTokens?
optionalcachedInputTokens?:number
Input tokens served from the prompt cache, when reported.
error?
optionalerror?:undefined
id
id:
string
The request ID (matches the id from AIBatchRequest)
inputTokens
inputTokens:
number
Input tokens used
outputTokens
outputTokens:
number
Output tokens used
prompt
prompt:
string
Original prompt (may be empty if not available from provider)
reasoningTokens?
optionalreasoningTokens?:number
Reasoning tokens the model emitted, when reported.
reportedCostUsd?
optionalreportedCostUsd?:number
USD cost the transport reported for this request (OpenRouter with
usage accounting), when it reports one. Absent on the vendor
transports; recordResults then bills the batch estimate.
result
result:
T
The parsed result. When a schema was provided and validation succeeded,
validated is true. When no schema was available at retrieval time
(the default after suspend/resume), this is the unvalidated parsed JSON
or string output, and validated is false.
servedBy?
optionalservedBy?:string
The endpoint that served the request, when known.
status
status:
"succeeded"
validated?
optionalvalidated?:boolean
True only when a schema was available at retrieval time and the response was successfully parsed and validated against it. False/undefined when no schema was available (e.g. after a suspend/resume without re-supplying schemas).
Type Literal
{ cachedInputTokens?: number; error: string; id: string; inputTokens: number; outputTokens: number; prompt: string; reasoningTokens?: number; reportedCostUsd?: number; responseText?: string; result?: undefined; servedBy?: string; status: "failed"; validated?: boolean; }
cachedInputTokens?
optionalcachedInputTokens?:number
Input tokens served from the prompt cache, when reported.
error
error:
string
Error message describing why the request failed.
id
id:
string
inputTokens
inputTokens:
number
outputTokens
outputTokens:
number
prompt
prompt:
string
reasoningTokens?
optionalreasoningTokens?:number
Reasoning tokens the model emitted, when reported.
reportedCostUsd?
optionalreportedCostUsd?:number
USD cost the transport reported for this request. A response the
provider served but that failed local JSON parsing or schema
validation was still billed, so the figure is kept here for
recordResults. Absent when the provider itself failed the request.
responseText?
optionalresponseText?:string
The model's raw reply when the request reached the model but its output could not be parsed or validated (absent when the provider itself failed the request). Stored on the accounting row.
result?
optionalresult?:undefined
No result is available for a failed request.
servedBy?
optionalservedBy?:string
The endpoint that served the request, when known.
status
status:
"failed"
validated?
optionalvalidated?:boolean
Always false on failed requests.