FallbackSpec
Defined in: core/src/fallback.ts:65
A fallback named by PRESET id rather than hand-built: the endpoint, auth
style, effort dialect and every measured quirk come from the presets table,
so a consumer writes neither a baseUrl nor a model-spelling rule. A
hand-built Provider is still accepted wherever a spec is.
Extends
Section titled “Extends”Properties
Section titled “Properties”apiKey
Section titled “apiKey”apiKey: string;Defined in: core/src/providers/factory.ts:43
The credential: an API key for key/bearer presets, an ACCESS TOKEN
for oauth ones. @providerkit/core/auth signs in and renews it.
Inherited from
Section titled “Inherited from”baseUrl?
Section titled “baseUrl?”optional baseUrl?: string;Defined in: core/src/providers/factory.ts:53
Replaces the preset’s API root. For a vendor that gives each account its
own host (Copilot: credential.baseUrl from the sign-in).
Inherited from
Section titled “Inherited from”dataCollection?
Section titled “dataCollection?”optional dataCollection?: "allow" | "deny";Defined in: core/src/providers/factory.ts:94
OpenRouter-only: provider.data_collection. "deny" keeps the request
on hosts that don’t train on the prompt. Not zero retention: that is
OpenRouter’s separate zdr. Absent = the account’s own setting. Never
sent to another host.
Inherited from
Section titled “Inherited from”PresetProviderConfig.dataCollection
effort?
Section titled “effort?”optional effort?: "low" | "medium" | "high" | "none" | "max";Defined in: core/src/providers/factory.ts:54
Inherited from
Section titled “Inherited from”fallbackOptions?
Section titled “fallbackOptions?”optional fallbackOptions?: FallbackOptions<Provider>;Defined in: core/src/fallback.ts:109
Custom cooldown or telemetry options for the fallback pool.
Inherited from
Section titled “Inherited from”PresetProviderConfig.fallbackOptions
fallbacks?
Section titled “fallbacks?”optional fallbacks?: readonly FallbackCandidate[];Defined in: core/src/fallback.ts:103
Secondary and tertiary providers to try if this provider fails/exhausts:
hand-built Providers, preset-id FallbackSpecs, or both.
Inherited from
Section titled “Inherited from”PresetProviderConfig.fallbacks
fetchImpl?
Section titled “fetchImpl?”optional fetchImpl?: FetchLike;Defined in: core/src/providers/factory.ts:102
Inherited from
Section titled “Inherited from”PresetProviderConfig.fetchImpl
headers?
Section titled “headers?”optional headers?: Record<string, string>;Defined in: core/src/providers/factory.ts:59
Per-request headers (request ids, ChatGPT-Account-Id) on top of the
preset’s static protocol headers.
Inherited from
Section titled “Inherited from”instanceSessionId?
Section titled “instanceSessionId?”optional instanceSessionId?: string;Defined in: core/src/providers/factory.ts:70
The session id for a call without StreamOptions.sessionId, on a preset
that sends one (opencode-go, opencode-zen, chatgpt). Absent, the provider mints its
own when it is built. Pass one when you build the provider per attempt
(withKeyPool, withToken): each build would mint a new id, and a gateway
that pins a session to one upstream host then treats every call as a new
session, re-routes it and misses its prompt cache. Every model in a chain
sends the same one. A preset without a session header has nowhere to put
it and ignores it.
Inherited from
Section titled “Inherited from”PresetProviderConfig.instanceSessionId
maxTokens?
Section titled “maxTokens?”optional maxTokens?: number;Defined in: core/src/providers/factory.ts:56
Output ceiling. The Anthropic shape requires one; adapters default it.
Inherited from
Section titled “Inherited from”PresetProviderConfig.maxTokens
model?
Section titled “model?”optional model?: string;Defined in: core/src/providers/factory.ts:46
Which model to run. Absent = the preset’s defaultModel; a preset
without either throws rather than sending a request nobody chose.
Inherited from
Section titled “Inherited from”models?
Section titled “models?”optional models?: readonly string[];Defined in: core/src/providers/factory.ts:50
A model chain on this one endpoint and key: the first answers, the rest
take over in order when it fails (quota, rate, outage). Wins over model
and the preset’s rotation; fallbacks still run after the chain.
Inherited from
Section titled “Inherited from”preset
Section titled “preset”preset: | "openrouter" | "openai" | "anthropic" | "google" | "google-openai" | "deepseek" | "groq" | "mistral" | "xai" | "together" | "fireworks" | "cerebras" | "moonshot" | "zhipu" | "minimax" | "minimax-openai" | "nvidia" | "perplexity" | "deepinfra" | "nebius" | "novita" | "chutes" | "siliconflow" | "volcengine" | "stepfun" | "digitalocean" | "crusoe" | "baseten" | "huggingface" | "zai" | "zai-openai" | "opencode-go" | "qwen" | "opencode-zen" | "kimi" | "kimi-openai" | "alibaba-coding-plan" | "qwen-token-plan-openai" | "alibaba" | "qwen-api" | "ollama" | "lmstudio" | "vllm" | "claude" | "chatgpt" | "grok" | "kimi-plan" | "github-copilot" | "antigravity";Defined in: core/src/fallback.ts:66
projectId?
Section titled “projectId?”optional projectId?: string;Defined in: core/src/providers/factory.ts:72
Google Antigravity (Cloud Code Assist) project id for the request envelope.
Inherited from
Section titled “Inherited from”PresetProviderConfig.projectId
providerOrder?
Section titled “providerOrder?”optional providerOrder?: string[];Defined in: core/src/providers/factory.ts:89
OpenRouter-only: preferred upstream hosts, in order. OpenRouter’s cache lives on the upstream host’s account and default routing hops hosts between rounds. Pinning keeps a conversation’s rounds (and their cache) on one host. Empty/absent = default routing.
Inherited from
Section titled “Inherited from”PresetProviderConfig.providerOrder
redactErrors?
Section titled “redactErrors?”optional redactErrors?: boolean;Defined in: core/src/providers/factory.ts:112
Leave the provider’s words out of every error this provider throws. A vendor’s error can
quote what you sent, and message, body and cause carry it into your logs and into
every run an agent saves. With this on, an error keeps its kind, status, a code that
is one short word, and the retry hints, so retries and fallbacks make the same choices. A
context overflow keeps its token counts too, for parseContextOverflow. Off by default,
because the words usually name the fix. A models chain and fallbacks specs inherit it; a
provider you built yourself keeps its own setting.
Inherited from
Section titled “Inherited from”PresetProviderConfig.redactErrors
servesHostedTools?
Section titled “servesHostedTools?”optional servesHostedTools?: readonly ( | "web_search" | "web_fetch" | "code_execution" | "file_search" | "image_generation")[];Defined in: core/src/providers/factory.ts:101
For providers imported from @providerkit/core/hosted.
The hosted tools this endpoint runs, once you have checked it. Absent,
each adapter decides by host. See StreamOptions.hostedTools.
Inherited from
Section titled “Inherited from”PresetProviderConfig.servesHostedTools
serviceTier?
Section titled “serviceTier?”optional serviceTier?: ServiceTier;Defined in: core/src/providers/factory.ts:97
Default service_tier for every call on the OpenAI and Responses shapes;
StreamOptions.serviceTier wins. Anthropic and Gemini presets refuse it.
Inherited from
Section titled “Inherited from”PresetProviderConfig.serviceTier
siteName?
Section titled “siteName?”optional siteName?: string;Defined in: core/src/providers/factory.ts:84
App name for OpenRouter’s rankings, sent as X-Title. See siteUrl.
Inherited from
Section titled “Inherited from”siteUrl?
Section titled “siteUrl?”optional siteUrl?: string;Defined in: core/src/providers/factory.ts:80
App attribution for OpenRouter’s rankings. The site URL rides as
HTTP-Referer, the app name as X-Title. Public, not secret. Sent on
the OpenAI-compatible and Anthropic shapes (OpenRouter reads them for app
attribution); the Gemini and Responses shapes ignore them. An explicit
entry in headers always wins.
Inherited from
Section titled “Inherited from”watchdog?
Section titled “watchdog?”optional watchdog?: WatchdogOptions;Defined in: core/src/fallback.ts:107
Watch every candidate separately. A silent candidate then times out and rotates; wrapping the completed pool would abort the whole chain instead. Fallback specs inherit this unless they set their own watchdog.