js-bao-wss-client / ExecutePromptResult
Interface: ExecutePromptResult<R>
Result from executing a prompt
Type Parameters
R
R = unknown
Properties
configId
configId:
string
error?
optionalerror?:string
errorCode?
optionalerrorCode?:"PROMPT_UPSTREAM_TIMEOUT"
"PROMPT_UPSTREAM_TIMEOUT" when the provider itself ran out of time, which is the one failure of the model call that carries a code. Absent on success and on every other provider failure, so error with no errorCode still means "the call failed for some other reason".
metrics
metrics:
object
cost?
optionalcost?:number
What this call cost, in USD, as the provider reported it.
A decisions model's case is largely economic — a fraction of a chat model's cost on the same workload — so a result that reported tokens and not price would leave the number the choice turns on off the wire. Absent when the provider reports none.
durationMs
durationMs:
number
inputTokens?
optionalinputTokens?:number
outputTokens?
optionaloutputTokens?:number
reasoningTokens?
optionalreasoningTokens?:number
The reasoning/thinking tokens the provider reports for this call, separately from outputTokens. It is how the effect of a config's reasoningEffort / reasoningBudget is measured: OpenRouter counts reasoning INSIDE its output tokens and Gemini counts it OUTSIDE, so neither headline number says how much of the decode was deliberation. Absent when the provider reports none.
totalTokens?
optionaltotalTokens?:number
output
output:
string
rawResponse
rawResponse:
R
success
success:
boolean
upstreamStatus?
optionalupstreamStatus?:number
The upstream provider's own HTTP status, on a failure where the call reached the provider and it answered. It does not depend on which provider the prompt's configuration names, and it is what a retry decision is made on without parsing error: retry on 408, 429, 502, 503 and 504; any other 4xx will fail the same way next time.
Absent on success, and absent on a failure where no provider answer was observed — an unset provider key, an oversized payload, a completion that came back empty — so a number here is always the provider's own.