Skip to main content

Cloudflare/ai Gateway

@swamp/cloudflare/ai-gatewayv2026.11.19.1· AGPL-3.0-or-later· 2d agoBEHAVIORS
01README

Cloudflare ai-gateway infrastructure models

02Release Notes
  • Updated: gateways
03Behaviors3
costs.tsv2026.10.23.1

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
namestringInstance name for this resource (used as the unique identifier in the factory pattern)
cost_in?number
cost_out?number
cost_type?string
enable?boolean
model?string
model_rule?enum
token_pricing?object
account_provider_id?stringID of the custom provider that the pricing rule applies to.
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Costs
fn get(id: string)
Get a Costs
ArgumentTypeDescription
idstringThe ID of the Costs
fn lookup(allowMissing?: boolean)
Look up an existing Costs by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Costs by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Costs to import
fn update(identifier?: string)
Update Costs attributes
ArgumentTypeDescription
identifier?stringTarget a specific Costs by id (e.g. one discovered by list)
fn delete(id: string)
Delete the Costs
ArgumentTypeDescription
idstringThe ID of the Costs
fn sync(identifier?: string)
Sync Costs state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Costs by id (e.g. one discovered by list)

Resources

state(infinite)— Costs resource state
lookupResult(infinite)— Outcome of the most recent lookup
custom-providers.tsv2026.11.16.1

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
base_url?string
beta?boolean
curl_example?string
description?string
enable?boolean
headers?stringJSON object of extra HTTP headers that AI Gateway sends to the provider. Values can contain credentials. Sensitive: wire with a vault.get(...) expression to source it from a vault.
js_example?string
link?string
logo?string
name?string
position?number
slug?string
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Custom-providers
fn get(id: string)
Get a Custom-providers
ArgumentTypeDescription
idstringThe ID of the Custom-providers
fn lookup(allowMissing?: boolean)
Look up an existing Custom-providers by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Custom-providers by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Custom-providers to import
fn update(identifier?: string)
Update Custom-providers attributes
ArgumentTypeDescription
identifier?stringTarget a specific Custom-providers by id (e.g. one discovered by list)
fn delete(id: string)
Delete the Custom-providers
ArgumentTypeDescription
idstringThe ID of the Custom-providers
fn sync(identifier?: string)
Sync Custom-providers state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Custom-providers by id (e.g. one discovered by list)

Resources

state(infinite)— Custom-providers resource state
lookupResult(infinite)— Outcome of the most recent lookup
gateways.tsv2026.11.19.1

Global Arguments

ArgumentTypeDescription
account_idstringCloudflare account ID
namestringInstance name for this resource (used as the unique identifier in the factory pattern)
authentication?booleanRequire authentication for gateway access. New gateways must have authentication enabled. Once enabled, authentication cannot be disabled.
byok_only?booleanRequires customer-provided provider credentials and prevents fallback to Unified Billing.
cache_invalidate_on_update?boolean
cache_ttl?number
collect_logs?boolean
dlp?object
guardrails?object
log_classification?boolean
log_management?number
log_management_strategy?enum
logpush?boolean
logpush_public_key?string
multiprovider_enabled?booleanLets requests to a model use every provider that serves it. When off, a model uses only the providers it launched with, so a provider added later receives none of its traffic. A request that names providers (the cf-aig-allowed-providers header or routing.allowedProviders) can still use any of them. Model aliases (custom/) are not restricted.
otel?array
rate_limiting_interval?number
rate_limiting_limit?number
rate_limiting_technique?enum
retry_backoff?enumBackoff strategy for retry delays
retry_delay?numberDelay between retry attempts in milliseconds (0-60000)
retry_max_attempts?numberMaximum number of retry attempts for failed requests (1-5)
spend_limits?object
store_id?stringSecrets Store used by this gateway. Omit on update to keep the current store. Cannot be cleared while stored keys or secret references depend on it.
stripe?object
workers_ai_billing_mode?enumControls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.
zdr?boolean
id?stringUnique identifier of the AI Gateway within the account.
apiToken?stringCloudflare API token; overrides the CLOUDFLARE_API_TOKEN environment variable. Wire with a vault.get(...) expression to source it from a vault.
apiKey?stringCloudflare API key for the legacy key+email auth path; overrides the CLOUDFLARE_API_KEY environment variable. Wire with a vault.get(...) expression. Requires email.
email?stringCloudflare account email for the legacy key+email auth path; overrides the CLOUDFLARE_EMAIL environment variable. Requires apiKey.
fn create()
Create a Gateways
fn get(id: string)
Get a Gateways
ArgumentTypeDescription
idstringThe ID of the Gateways
fn lookup(allowMissing?: boolean)
Look up an existing Gateways by matching global argument values and import it into state
ArgumentTypeDescription
allowMissing?booleanSucceed and record found: false in lookupResult when nothing matches, instead of failing
fn adopt(id: string)
Import an existing Gateways by ID into state for management
ArgumentTypeDescription
idstringThe ID of the Gateways to import
fn update(identifier?: string)
Update Gateways attributes
ArgumentTypeDescription
identifier?stringTarget a specific Gateways by id (e.g. one discovered by list)
fn delete(id: string)
Delete the Gateways
ArgumentTypeDescription
idstringThe ID of the Gateways
fn sync(identifier?: string)
Sync Gateways state from Cloudflare
ArgumentTypeDescription
identifier?stringTarget a specific Gateways by id (e.g. one discovered by list)

Resources

state(infinite)— Gateways resource state
lookupResult(infinite)— Outcome of the most recent lookup
04Previous Versions19
2026.11.17.1AGPL-3.0-or-later
  • Updated: gateways

Added 1, removed 3 behaviors

2026.11.16.1AGPL-3.0-or-later
  • Updated: custom-providers
2026.11.14.1AGPL-3.0-or-later
  • Updated: gateways
2026.10.30.1AGPL-3.0-or-later
  • Updated: gateways
2026.10.23.1AGPL-3.0-or-later
  • Updated: custom-providers
  • Updated: costs
  • Updated: gateways
2026.10.22.1AGPL-3.0-or-later
  • Updated: gateways
2026.10.21.1AGPL-3.0-or-later
  • Updated: gateways
2026.10.20.1AGPL-3.0-or-later
  • Updated: custom-providers
  • Updated: costs
  • Updated: gateways

Modified 3 behaviors

2026.10.16.1AGPL-3.0-or-later(was none)
2026.10.13.1
  • Updated: custom-providers
  • Updated: costs
  • Updated: gateways
2026.10.01.1
  • Updated: gateways
2026.09.29.2
  • Updated: gateways
2026.09.29.1
  • Updated: custom-providers
  • Updated: costs
  • Updated: gateways
2026.09.26.1
  • Updated: custom-providers
  • Updated: costs
  • Updated: gateways
2026.09.11.1
  • Updated: gateways
2026.08.25.2
  • Updated: custom-providers
  • Updated: gateways
2026.08.25.1
  • Updated: custom-providers
  • Updated: gateways
2026.08.15.1
  • Updated: gateways
2026.08.11.1
  • Updated: gateways
05Stats
A
100 / 100
Downloads
45
Archive size
24.4 KB
Verified by Swamp
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
06Platforms
07Labels