Skip to content

js-bao-wss-client


js-bao-wss-client / ExecutePromptResult

Interface: ExecutePromptResult<R> ​

Result from executing a prompt

Type Parameters ​

R ​

R = unknown

Properties ​

configId ​

configId: string


error? ​

optional error?: string


errorCode? ​

optional errorCode?: "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? ​

optional cost?: 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? ​

optional inputTokens?: number

outputTokens? ​

optional outputTokens?: number

reasoningTokens? ​

optional reasoningTokens?: 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? ​

optional totalTokens?: number


output ​

output: string


rawResponse ​

rawResponse: R


success ​

success: boolean


upstreamStatus? ​

optional upstreamStatus?: 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.

Documentation validated against js-bao-wss-client 3.4.0 · js-bao 0.11.0 · primitive-admin 1.0.62 · primitive-app 3.1.0 — 2026-09-30