OptionalbackgroundOptionalbackgroundPoll interval (ms) for the background submit-then-poll loop.
Defaults to 2000. Ignored unless backgroundMode is true.
OptionalbackgroundCombine OpenAI background mode with live SSE streaming:
the request is submitted with { background: true, stream: true, store: true } so it keeps generating server-side even if the
connection drops, and the SSE stream is consumed live while it
runs. This is independent of the stream option (foreground-
only streaming) and backgroundMode (poll-only).
When true, backgroundMode is ignored for this provider
instance. stream is also ignored (SSE is always used in this
mode). V1 supports the no-tools path only: a request that
sets backgroundStreamMode and carries tools throws
NonRetryableLlmError.
The response id is surfaced immediately from the submit POST
body (before any SSE bytes), making it available for durable
persistence by the caller. Defaults to false.
OptionalbaseOverride the default https://api.openai.com/v1/responses.
OptionalfetchInjectable fetch. Defaults to globalThis.fetch. Tests inject
mocks; runtimes without a global fetch (older Node) inject a
polyfill.
OptionalmaxCap on the number of round-trips the function-tool agent loop
can take before throwing ToolLoopExhaustedError. Defaults to
6. Built-in tools (web_search / file_search / mcp) don't
count against this cap — they run server-side.
OptionalstreamStream the foreground response over SSE and accumulate to the
terminal envelope inside the provider. Defaults to true —
gives connection-drop resilience. No data-retention implications
(unlike backgroundMode).
Set false to restore the blocking response.json() path.
Run long reasoning calls in OpenAI background mode (submit-then-poll) so the result does not depend on a continuously-held connection. Defaults to
false.Background mode requires
store: true, which retains the response server-side (~10 min, for polling) and is NOT ZDR-compatible. Enable only where that data-retention posture is acceptable. V1 supports the no-tools path only: a request that setsbackgroundModeand carriestoolsthrowsNonRetryableLlmError.