Skip to main content

gateways

Creates, updates, deletes, gets or lists a gateways resource.

Overview

Namegateways
TypeResource
Idcloudflare.ai_gateway.gateways

Fields

The following fields are returned by SELECT queries:

Returns a single object if found

NameDatatypeDescription
idstringgateway id
store_idstring
authenticationboolean
cache_invalidate_on_updateboolean
cache_ttlinteger
collect_logsboolean
created_atstring (date-time)
dlpobject
is_defaultboolean
log_managementinteger
log_management_strategystring (STOP_INSERTING, DELETE_OLDEST)
logpushboolean
logpush_public_keystring
modified_atstring (date-time)
otelarray
rate_limiting_intervalinteger
rate_limiting_limitinteger
rate_limiting_techniquestring (fixed, sliding)
retry_backoffstringBackoff strategy for retry delays (constant, linear, exponential)
retry_delayintegerDelay between retry attempts in milliseconds (0-5000)
retry_max_attemptsintegerMaximum number of retry attempts for failed requests (1-5)
stripeobject
workers_ai_billing_modestringControls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. (postpaid) (default: postpaid)
zdrboolean

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, idRetrieves details for a specific AI Gateway dataset.
listselectaccount_idpage, per_page, searchLists all AI Gateway evaluator types configured for the account.
createinsertaccount_id, id, rate_limiting_interval, rate_limiting_limit, collect_logs, cache_ttl, cache_invalidate_on_updateCreates a new AI Gateway.
updatereplaceaccount_id, id, rate_limiting_interval, rate_limiting_limit, collect_logs, cache_ttl, cache_invalidate_on_updateUpdates an existing AI Gateway dataset.
deletedeleteaccount_id, idDeletes an AI Gateway dataset.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
idstringResource ID.
pageinteger
per_pageinteger

SELECT examples

Retrieves details for a specific AI Gateway dataset.

SELECT
id,
store_id,
authentication,
cache_invalidate_on_update,
cache_ttl,
collect_logs,
created_at,
dlp,
is_default,
log_management,
log_management_strategy,
logpush,
logpush_public_key,
modified_at,
otel,
rate_limiting_interval,
rate_limiting_limit,
rate_limiting_technique,
retry_backoff,
retry_delay,
retry_max_attempts,
stripe,
workers_ai_billing_mode,
zdr
FROM cloudflare.ai_gateway.gateways
WHERE account_id = '{{ account_id }}' -- required
AND id = '{{ id }}' -- required
;

INSERT examples

Creates a new AI Gateway.

INSERT INTO cloudflare.ai_gateway.gateways (
authentication,
cache_invalidate_on_update,
cache_ttl,
collect_logs,
id,
log_management,
log_management_strategy,
logpush,
logpush_public_key,
rate_limiting_interval,
rate_limiting_limit,
rate_limiting_technique,
retry_backoff,
retry_delay,
retry_max_attempts,
workers_ai_billing_mode,
zdr,
account_id
)
SELECT
{{ authentication }},
{{ cache_invalidate_on_update }} /* required */,
{{ cache_ttl }} /* required */,
{{ collect_logs }} /* required */,
'{{ id }}' /* required */,
{{ log_management }},
'{{ log_management_strategy }}',
{{ logpush }},
'{{ logpush_public_key }}',
{{ rate_limiting_interval }} /* required */,
{{ rate_limiting_limit }} /* required */,
'{{ rate_limiting_technique }}',
'{{ retry_backoff }}',
{{ retry_delay }},
{{ retry_max_attempts }},
'{{ workers_ai_billing_mode }}',
{{ zdr }},
'{{ account_id }}'
RETURNING
result,
success
;

REPLACE examples

Updates an existing AI Gateway dataset.

REPLACE cloudflare.ai_gateway.gateways
SET
authentication = {{ authentication }},
cache_invalidate_on_update = {{ cache_invalidate_on_update }},
cache_ttl = {{ cache_ttl }},
collect_logs = {{ collect_logs }},
dlp = '{{ dlp }}',
log_management = {{ log_management }},
log_management_strategy = '{{ log_management_strategy }}',
logpush = {{ logpush }},
logpush_public_key = '{{ logpush_public_key }}',
otel = '{{ otel }}',
rate_limiting_interval = {{ rate_limiting_interval }},
rate_limiting_limit = {{ rate_limiting_limit }},
rate_limiting_technique = '{{ rate_limiting_technique }}',
retry_backoff = '{{ retry_backoff }}',
retry_delay = {{ retry_delay }},
retry_max_attempts = {{ retry_max_attempts }},
store_id = '{{ store_id }}',
stripe = '{{ stripe }}',
workers_ai_billing_mode = '{{ workers_ai_billing_mode }}',
zdr = {{ zdr }}
WHERE
account_id = '{{ account_id }}' --required
AND id = '{{ id }}' --required
AND rate_limiting_interval = '{{ rate_limiting_interval }}' --required
AND rate_limiting_limit = '{{ rate_limiting_limit }}' --required
AND collect_logs = {{ collect_logs }} --required
AND cache_ttl = '{{ cache_ttl }}' --required
AND cache_invalidate_on_update = {{ cache_invalidate_on_update }} --required
RETURNING
result,
success;

DELETE examples

Deletes an AI Gateway dataset.

DELETE FROM cloudflare.ai_gateway.gateways
WHERE account_id = '{{ account_id }}' --required
AND id = '{{ id }}' --required
;