Skip to content
Start here

AI Gateway

resource cloudflare_ai_gateway

required Expand Collapse
id: String

gateway id

account_id: String
cache_invalidate_on_update: Bool
cache_ttl: Int64
collect_logs: Bool
rate_limiting_interval: Int64
rate_limiting_limit: Int64
optional Expand Collapse
authentication?: Bool
log_management?: Int64
log_management_strategy?: String
logpush?: Bool
logpush_public_key?: String
rate_limiting_technique?: String
retry_backoff?: String

Backoff strategy for retry delays

retry_delay?: Int64

Delay between retry attempts in milliseconds (0-5000)

retry_max_attempts?: Int64

Maximum number of retry attempts for failed requests (1-5)

store_id?: String
zdr?: Bool
dlp?: Attributes
action?: String
enabled: Bool
profiles?: List[String]
policies?: List[Attributes]
id: String
action: String
check: List[String]
enabled: Bool
profiles: List[String]
stripe?: Attributes
authorization: String
usage_events: List[Attributes]
payload: String
workers_ai_billing_mode?: String

Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported.

otel?: List[Attributes]
authorization: String
headers: Map[String]
url: String
content_type?: String
computed Expand Collapse
created_at: Time
is_default: Bool
modified_at: Time

cloudflare_ai_gateway

resource "cloudflare_ai_gateway" "example_ai_gateway" {
  account_id = "3ebbcb006d4d46d7bb6a8c7f14676cb0"
  id = "my-gateway"
  cache_invalidate_on_update = true
  cache_ttl = 0
  collect_logs = true
  rate_limiting_interval = 0
  rate_limiting_limit = 0
  authentication = true
  log_management = 10000
  log_management_strategy = "STOP_INSERTING"
  logpush = true
  logpush_public_key = "xxxxxxxxxxxxxxxx"
  rate_limiting_technique = "fixed"
  retry_backoff = "constant"
  retry_delay = 0
  retry_max_attempts = 1
  workers_ai_billing_mode = "postpaid"
  zdr = true
}

data cloudflare_ai_gateway

required Expand Collapse
account_id: String
optional Expand Collapse
id?: String

gateway id

filter?: Attributes
computed Expand Collapse
authentication: Bool
cache_invalidate_on_update: Bool
cache_ttl: Int64
collect_logs: Bool
created_at: Time
is_default: Bool
log_management: Int64
log_management_strategy: String
logpush: Bool
logpush_public_key: String
modified_at: Time
rate_limiting_interval: Int64
rate_limiting_limit: Int64
rate_limiting_technique: String
retry_backoff: String

Backoff strategy for retry delays

retry_delay: Int64

Delay between retry attempts in milliseconds (0-5000)

retry_max_attempts: Int64

Maximum number of retry attempts for failed requests (1-5)

store_id: String
workers_ai_billing_mode: String

Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported.

zdr: Bool
dlp: Attributes
action: String
enabled: Bool
profiles: List[String]
policies: List[Attributes]
id: String
action: String
check: List[String]
enabled: Bool
profiles: List[String]
otel: List[Attributes]
authorization: String
headers: Map[String]
url: String
content_type: String
stripe: Attributes
authorization: String
usage_events: List[Attributes]
payload: String

cloudflare_ai_gateway

data "cloudflare_ai_gateway" "example_ai_gateway" {
  account_id = "3ebbcb006d4d46d7bb6a8c7f14676cb0"
  id = "my-gateway"
}

data cloudflare_ai_gateways

required Expand Collapse
account_id: String
optional Expand Collapse
max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String

gateway id

cache_invalidate_on_update: Bool
cache_ttl: Int64
collect_logs: Bool
created_at: Time
modified_at: Time
rate_limiting_interval: Int64
rate_limiting_limit: Int64
authentication: Bool
dlp: Attributes
action: String
enabled: Bool
profiles: List[String]
policies: List[Attributes]
id: String
action: String
check: List[String]
enabled: Bool
profiles: List[String]
is_default: Bool
log_management: Int64
log_management_strategy: String
logpush: Bool
logpush_public_key: String
otel: List[Attributes]
authorization: String
headers: Map[String]
url: String
content_type: String
rate_limiting_technique: String
retry_backoff: String

Backoff strategy for retry delays

retry_delay: Int64

Delay between retry attempts in milliseconds (0-5000)

retry_max_attempts: Int64

Maximum number of retry attempts for failed requests (1-5)

store_id: String
stripe: Attributes
authorization: String
usage_events: List[Attributes]
payload: String
workers_ai_billing_mode: String

Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported.

zdr: Bool

cloudflare_ai_gateways

data "cloudflare_ai_gateways" "example_ai_gateways" {
  account_id = "3ebbcb006d4d46d7bb6a8c7f14676cb0"
  search = "search"
}

AI GatewayDynamic Routing

resource cloudflare_ai_gateway_dynamic_routing

required Expand Collapse
account_id: String
gateway_id: String
elements: List[Attributes]
id: String
outputs: Attributes
false?: Attributes
element_id: String
true?: Attributes
element_id: String
element_id?: String
fallback?: Attributes
element_id: String
success?: Attributes
element_id: String
type: String
properties?: Attributes
conditions?: JSON
key?: String
limit?: Float64
limit_type?: String
window?: Float64
model?: String
ai_gateway_dynamic_routing_provider?: String
retries?: Float64
timeout?: Float64
name: String
computed Expand Collapse
id: String
created_at: Time
modified_at: Time
success: Bool
deployment: Attributes
created_at: String
deployment_id: String
version_id: String
route: Attributes
id: String
account_tag: String
created_at: Time
deployment: Attributes
created_at: String
deployment_id: String
version_id: String
elements: List[Attributes]
id: String
outputs: Attributes
false: Attributes
element_id: String
true: Attributes
element_id: String
element_id: String
fallback: Attributes
element_id: String
success: Attributes
element_id: String
type: String
properties: Attributes
conditions: JSON
key: String
limit: Float64
limit_type: String
window: Float64
model: String
ai_gateway_dynamic_routing_provider: String
retries: Float64
timeout: Float64
gateway_id: String
modified_at: Time
name: String
version: Attributes
active: String
created_at: String
data: String
version_id: String
version: Attributes
active: String
created_at: String
data: String
version_id: String

cloudflare_ai_gateway_dynamic_routing

resource "cloudflare_ai_gateway_dynamic_routing" "example_ai_gateway_dynamic_routing" {
  account_id = "0d37909e38d3e99c29fa2cd343ac421a"
  gateway_id = "54442216"
  elements = [{
    id = "id"
    outputs = {
      next = {
        element_id = "elementId"
      }
    }
    type = "start"
  }]
  name = "name"
}

data cloudflare_ai_gateway_dynamic_routing

required Expand Collapse
account_id: String
gateway_id: String
id: String
computed Expand Collapse
created_at: Time
modified_at: Time
name: String
deployment: Attributes
created_at: String
deployment_id: String
version_id: String
elements: List[Attributes]
id: String
outputs: Attributes
false: Attributes
element_id: String
true: Attributes
element_id: String
element_id: String
fallback: Attributes
element_id: String
success: Attributes
element_id: String
type: String
properties: Attributes
conditions: JSON
key: String
limit: Float64
limit_type: String
window: Float64
model: String
ai_gateway_dynamic_routing_provider: String
retries: Float64
timeout: Float64
version: Attributes
active: String
created_at: String
data: String
version_id: String

cloudflare_ai_gateway_dynamic_routing

data "cloudflare_ai_gateway_dynamic_routing" "example_ai_gateway_dynamic_routing" {
  account_id = "0d37909e38d3e99c29fa2cd343ac421a"
  gateway_id = "54442216"
  id = "54442216"
}