GatewayproviderOptions.gateway

providerOptions.gateway

All gateway-specific options are passed inside providerOptions.gateway in the request body. These are stripped before forwarding to providers.

Full schema

interface GatewayOptions {
  // Bring Your Own Key
  byok?: Record<string, Array<{ apiKey: string }>>
 
  // Compliance routing
  zeroDataRetention?: boolean
  disallowPromptTraining?: boolean
 
  // Caching
  caching?: 'auto' | false
  cache?: false  // disable response caching
 
  // Provider routing
  order?: string[]   // provider priority
  only?: string[]    // provider allowlist
 
  // Model fallbacks
  models?: string[]  // tried in order after primary model
 
  // Timeouts (1s-120s, clamped)
  timeout?: number | Record<string, number>
}

Options reference

OptionTypeDefaultDescription
byokRecord<string, Array<{apiKey}>>Per-request provider credentials. Details
zeroDataRetentionbooleanfalseRoute only to ZDR-verified providers. Details
disallowPromptTrainingbooleanfalseRoute only to no-train providers. Details
caching'auto'Auto-inject prompt cache markers. Details
cachefalseSet false to skip response cache for this request.
orderstring[]Provider priority order. Details
onlystring[]Restrict to these providers only.
modelsstring[]Fallback model list. Details
timeoutnumber | Record<string, number>30000Timeout in ms. Details

Example: everything at once

{
  "model": "anthropic/claude-sonnet-4-6",
  "messages": [{"role": "user", "content": "Hello"}],
  "providerOptions": {
    "gateway": {
      "byok": {
        "anthropic": [{"apiKey": "sk-ant-..."}]
      },
      "zeroDataRetention": true,
      "caching": "auto",
      "models": ["openai/gpt-4o"],
      "timeout": {"anthropic": 10000, "openai": 5000},
      "order": ["anthropic", "openai"]
    }
  }
}