StreamOptions
Defined in: core/src/types.ts:356
Properties
Section titled “Properties”effort?
Section titled “effort?”optional effort?: "none" | "low" | "medium" | "high" | "max";Defined in: core/src/types.ts:369
optional json?: JsonOutput;Defined in: core/src/types.ts:392
jsonWithTools?
Section titled “jsonWithTools?”optional jsonWithTools?: JsonWithTools;Defined in: core/src/types.ts:397
Overrides the provider’s own setting for this call, so probeJsonWithTools
asks the same model both ways. See JsonWithTools.
maxAttempts?
Section titled “maxAttempts?”optional maxAttempts?: number;Defined in: core/src/types.ts:368
Maximum attempts at each SDK recovery layer, including the first. Must
be a positive integer. Omit to keep normal recovery. 1 prevents another
inference request through model, key, host or token fallback, keeping the
original failure and normal cooldown or credential renewal for later calls.
Values above 1 are PER LAYER, not a total HTTP budget across nested pools.
Initial token acquisition and credential refresh are not inference attempts.
App-written outer retries need their own limit (RetryOptions.maxAttempts).
maxTokens?
Section titled “maxTokens?”optional maxTokens?: number;Defined in: core/src/types.ts:373
Output ceiling. On most providers thinking and answer SHARE it, so a task emitting a large artifact must raise it or the tool-call JSON is silently truncated mid-argument.
model?
Section titled “model?”optional model?: string;Defined in: core/src/types.ts:358
Override the provider’s bound model for this call.
onActivity?
Section titled “onActivity?”optional onActivity?: () => void;Defined in: core/src/types.ts:412
Called when the response headers arrive and on every read of the body
after, keep-alives included. withWatchdog sets it: a stream that is only
sending keep-alives is alive, which no chunk an adapter yields can show.
Every adapter here forwards it; a custom Provider that does not still
works, on the watchdog’s progress clock alone.
Returns
Section titled “Returns”void
onRateLimit?
Section titled “onRateLimit?”optional onRateLimit?: (reading) => void;Defined in: core/src/types.ts:424
Called once per response whose headers report how full a subscription
window is, whatever its status: utilization (1 is full), resetAtMs,
and window when the headers name it. A caller sees the window fill
turn by turn, instead of learning about it from the 429 that ends a run.
Every adapter forwards it. Two backends send the headers today: Claude
subscriptions (Anthropic’s unified 5h/7d headers) and the ChatGPT backend
(x-codex-*). A response that reports no window never calls it, which
covers API-key accounts on every vendor and all of Gemini.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
reading |
RateLimitReading |
Returns
Section titled “Returns”void
parallelToolCalls?
Section titled “parallelToolCalls?”optional parallelToolCalls?: boolean;Defined in: core/src/types.ts:431
false asks for at most one tool call per turn, for tools that must run
in order, or a backend lane that refuses parallel calls. Absent or true
is every vendor’s default and sends nothing. Gemini has no such switch,
so it refuses false rather than silently ignore it.
serviceTier?
Section titled “serviceTier?”optional serviceTier?: ServiceTier;Defined in: core/src/types.ts:439
Which service tier to buy this call on: priority is faster and costs
more, flex is slower and costs less. Sent as service_tier on the
OpenAI and Responses shapes. Anthropic and Gemini refuse it with an
invalid error: Anthropic’s own service_tier means something else, and
Gemini has no such switch. Overrides the provider’s own setting.
sessionId?
Section titled “sessionId?”optional sessionId?: string;Defined in: core/src/types.ts:404
Stable id for the conversation or job this call belongs to. Sent in the
sessionHeader of endpoints that name one (OpenCode Go routes and caches
by it), and as prompt_cache_key on the Responses shape. A call without
one sends the provider’s instanceSessionId in that header instead.
signal?
Section titled “signal?”optional signal?: AbortSignal;Defined in: core/src/types.ts:390
stopSequences?
Section titled “stopSequences?”optional stopSequences?: string[];Defined in: core/src/types.ts:389
Strings that end the turn when generated. The only four-shape sampling
field beyond these two; top_k, metadata and the rest are one vendor’s
each and stay off the seam, where a caller reaching for them is asking for
that vendor rather than for a provider.
Not sent on the Responses shape, which has no equivalent.
temperature?
Section titled “temperature?”optional temperature?: number;Defined in: core/src/types.ts:375
Not sent to Gemini, which fixes its own sampling. Same for topP.
toolChoice?
Section titled “toolChoice?”optional toolChoice?: ToolChoice;Defined in: core/src/types.ts:391
optional topP?: number;Defined in: core/src/types.ts:380
Nucleus sampling. Set this or temperature, not both. The vendors all
document them as alternatives and some reject the pair outright.