Skip to content
Start here

AI Gateway

List Gateways
client.aiGateway.list(AIGatewayListParams { account_id, page, per_page, search } params, RequestOptionsoptions?): V4PagePaginationArray<AIGatewayListResponse { id, cache_invalidate_on_update, cache_ttl, 22 more } >
GET/accounts/{account_id}/ai-gateway/gateways
Fetch a Gateway
client.aiGateway.get(stringid, AIGatewayGetParams { account_id } params, RequestOptionsoptions?): AIGatewayGetResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
GET/accounts/{account_id}/ai-gateway/gateways/{id}
Create a new Gateway
client.aiGateway.create(AIGatewayCreateParams { account_id, id, cache_invalidate_on_update, 15 more } params, RequestOptionsoptions?): AIGatewayCreateResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
POST/accounts/{account_id}/ai-gateway/gateways
Update a Gateway
client.aiGateway.update(stringid, AIGatewayUpdateParams { account_id, cache_invalidate_on_update, cache_ttl, 19 more } params, RequestOptionsoptions?): AIGatewayUpdateResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
PUT/accounts/{account_id}/ai-gateway/gateways/{id}
Delete a Gateway
client.aiGateway.delete(stringid, AIGatewayDeleteParams { account_id } params, RequestOptionsoptions?): AIGatewayDeleteResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
DELETE/accounts/{account_id}/ai-gateway/gateways/{id}
ModelsExpand Collapse
AIGatewayListResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
id: string

gateway id

maxLength64
minLength1
cache_invalidate_on_update: boolean
cache_ttl: number | null
minimum0
collect_logs: boolean
created_at: string
formatdate-time
modified_at: string
formatdate-time
rate_limiting_interval: number | null
minimum0
rate_limiting_limit: number | null
minimum0
authentication?: boolean
dlp?: UnionMember0 { action, enabled, profiles } | UnionMember1 { enabled, policies }
One of the following:
UnionMember0 { action, enabled, profiles }
action: "BLOCK" | "FLAG"
One of the following:
"BLOCK"
"FLAG"
enabled: boolean
profiles: Array<string>
UnionMember1 { enabled, policies }
enabled: boolean
policies: Array<Policy>
id: string
action: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
check: Array<"REQUEST" | "RESPONSE">
One of the following:
"REQUEST"
"RESPONSE"
enabled: boolean
profiles: Array<string>
guardrails?: Guardrails | null
prompt: Prompt { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
response: Response { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
is_default?: boolean
log_management?: number | null
maximum10000000
minimum10000
log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush?: boolean
logpush_public_key?: string | null
maxLength1024
minLength16
otel?: Array<Otel> | null
authorization: string
maxLength256
headers: Record<string, string>
url: string
formaturi
maxLength2048
content_type?: "json" | "protobuf"
One of the following:
"json"
"protobuf"
rate_limiting_technique?: "fixed" | "sliding" | null
One of the following:
"fixed"
"sliding"
retry_backoff?: "constant" | "linear" | "exponential" | null

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay?: number | null

Delay between retry attempts in milliseconds (0-5000)

maximum5000
minimum0
retry_max_attempts?: number | null

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

maximum5
minimum1
store_id?: string | null
stripe?: Stripe | null
authorization: string
usage_events: Array<UsageEvent>
payload: string
workers_ai_billing_mode?: "postpaid"

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

zdr?: boolean
AIGatewayGetResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
id: string

gateway id

maxLength64
minLength1
cache_invalidate_on_update: boolean
cache_ttl: number | null
minimum0
collect_logs: boolean
created_at: string
formatdate-time
modified_at: string
formatdate-time
rate_limiting_interval: number | null
minimum0
rate_limiting_limit: number | null
minimum0
authentication?: boolean
dlp?: UnionMember0 { action, enabled, profiles } | UnionMember1 { enabled, policies }
One of the following:
UnionMember0 { action, enabled, profiles }
action: "BLOCK" | "FLAG"
One of the following:
"BLOCK"
"FLAG"
enabled: boolean
profiles: Array<string>
UnionMember1 { enabled, policies }
enabled: boolean
policies: Array<Policy>
id: string
action: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
check: Array<"REQUEST" | "RESPONSE">
One of the following:
"REQUEST"
"RESPONSE"
enabled: boolean
profiles: Array<string>
guardrails?: Guardrails | null
prompt: Prompt { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
response: Response { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
is_default?: boolean
log_management?: number | null
maximum10000000
minimum10000
log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush?: boolean
logpush_public_key?: string | null
maxLength1024
minLength16
otel?: Array<Otel> | null
authorization: string
maxLength256
headers: Record<string, string>
url: string
formaturi
maxLength2048
content_type?: "json" | "protobuf"
One of the following:
"json"
"protobuf"
rate_limiting_technique?: "fixed" | "sliding" | null
One of the following:
"fixed"
"sliding"
retry_backoff?: "constant" | "linear" | "exponential" | null

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay?: number | null

Delay between retry attempts in milliseconds (0-5000)

maximum5000
minimum0
retry_max_attempts?: number | null

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

maximum5
minimum1
store_id?: string | null
stripe?: Stripe | null
authorization: string
usage_events: Array<UsageEvent>
payload: string
workers_ai_billing_mode?: "postpaid"

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

zdr?: boolean
AIGatewayCreateResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
id: string

gateway id

maxLength64
minLength1
cache_invalidate_on_update: boolean
cache_ttl: number | null
minimum0
collect_logs: boolean
created_at: string
formatdate-time
modified_at: string
formatdate-time
rate_limiting_interval: number | null
minimum0
rate_limiting_limit: number | null
minimum0
authentication?: boolean
dlp?: UnionMember0 { action, enabled, profiles } | UnionMember1 { enabled, policies }
One of the following:
UnionMember0 { action, enabled, profiles }
action: "BLOCK" | "FLAG"
One of the following:
"BLOCK"
"FLAG"
enabled: boolean
profiles: Array<string>
UnionMember1 { enabled, policies }
enabled: boolean
policies: Array<Policy>
id: string
action: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
check: Array<"REQUEST" | "RESPONSE">
One of the following:
"REQUEST"
"RESPONSE"
enabled: boolean
profiles: Array<string>
guardrails?: Guardrails | null
prompt: Prompt { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
response: Response { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
is_default?: boolean
log_management?: number | null
maximum10000000
minimum10000
log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush?: boolean
logpush_public_key?: string | null
maxLength1024
minLength16
otel?: Array<Otel> | null
authorization: string
maxLength256
headers: Record<string, string>
url: string
formaturi
maxLength2048
content_type?: "json" | "protobuf"
One of the following:
"json"
"protobuf"
rate_limiting_technique?: "fixed" | "sliding" | null
One of the following:
"fixed"
"sliding"
retry_backoff?: "constant" | "linear" | "exponential" | null

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay?: number | null

Delay between retry attempts in milliseconds (0-5000)

maximum5000
minimum0
retry_max_attempts?: number | null

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

maximum5
minimum1
store_id?: string | null
stripe?: Stripe | null
authorization: string
usage_events: Array<UsageEvent>
payload: string
workers_ai_billing_mode?: "postpaid"

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

zdr?: boolean
AIGatewayUpdateResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
id: string

gateway id

maxLength64
minLength1
cache_invalidate_on_update: boolean
cache_ttl: number | null
minimum0
collect_logs: boolean
created_at: string
formatdate-time
modified_at: string
formatdate-time
rate_limiting_interval: number | null
minimum0
rate_limiting_limit: number | null
minimum0
authentication?: boolean
dlp?: UnionMember0 { action, enabled, profiles } | UnionMember1 { enabled, policies }
One of the following:
UnionMember0 { action, enabled, profiles }
action: "BLOCK" | "FLAG"
One of the following:
"BLOCK"
"FLAG"
enabled: boolean
profiles: Array<string>
UnionMember1 { enabled, policies }
enabled: boolean
policies: Array<Policy>
id: string
action: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
check: Array<"REQUEST" | "RESPONSE">
One of the following:
"REQUEST"
"RESPONSE"
enabled: boolean
profiles: Array<string>
guardrails?: Guardrails | null
prompt: Prompt { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
response: Response { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
is_default?: boolean
log_management?: number | null
maximum10000000
minimum10000
log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush?: boolean
logpush_public_key?: string | null
maxLength1024
minLength16
otel?: Array<Otel> | null
authorization: string
maxLength256
headers: Record<string, string>
url: string
formaturi
maxLength2048
content_type?: "json" | "protobuf"
One of the following:
"json"
"protobuf"
rate_limiting_technique?: "fixed" | "sliding" | null
One of the following:
"fixed"
"sliding"
retry_backoff?: "constant" | "linear" | "exponential" | null

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay?: number | null

Delay between retry attempts in milliseconds (0-5000)

maximum5000
minimum0
retry_max_attempts?: number | null

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

maximum5
minimum1
store_id?: string | null
stripe?: Stripe | null
authorization: string
usage_events: Array<UsageEvent>
payload: string
workers_ai_billing_mode?: "postpaid"

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

zdr?: boolean
AIGatewayDeleteResponse { id, cache_invalidate_on_update, cache_ttl, 22 more }
id: string

gateway id

maxLength64
minLength1
cache_invalidate_on_update: boolean
cache_ttl: number | null
minimum0
collect_logs: boolean
created_at: string
formatdate-time
modified_at: string
formatdate-time
rate_limiting_interval: number | null
minimum0
rate_limiting_limit: number | null
minimum0
authentication?: boolean
dlp?: UnionMember0 { action, enabled, profiles } | UnionMember1 { enabled, policies }
One of the following:
UnionMember0 { action, enabled, profiles }
action: "BLOCK" | "FLAG"
One of the following:
"BLOCK"
"FLAG"
enabled: boolean
profiles: Array<string>
UnionMember1 { enabled, policies }
enabled: boolean
policies: Array<Policy>
id: string
action: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
check: Array<"REQUEST" | "RESPONSE">
One of the following:
"REQUEST"
"RESPONSE"
enabled: boolean
profiles: Array<string>
guardrails?: Guardrails | null
prompt: Prompt { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
response: Response { P1, S1, S10, 11 more }
P1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S1?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S10?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S11?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S12?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S13?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S2?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S3?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S4?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S5?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S6?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S7?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S8?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
S9?: "FLAG" | "BLOCK"
One of the following:
"FLAG"
"BLOCK"
is_default?: boolean
log_management?: number | null
maximum10000000
minimum10000
log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush?: boolean
logpush_public_key?: string | null
maxLength1024
minLength16
otel?: Array<Otel> | null
authorization: string
maxLength256
headers: Record<string, string>
url: string
formaturi
maxLength2048
content_type?: "json" | "protobuf"
One of the following:
"json"
"protobuf"
rate_limiting_technique?: "fixed" | "sliding" | null
One of the following:
"fixed"
"sliding"
retry_backoff?: "constant" | "linear" | "exponential" | null

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay?: number | null

Delay between retry attempts in milliseconds (0-5000)

maximum5000
minimum0
retry_max_attempts?: number | null

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

maximum5
minimum1
store_id?: string | null
stripe?: Stripe | null
authorization: string
usage_events: Array<UsageEvent>
payload: string
workers_ai_billing_mode?: "postpaid"

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

zdr?: boolean

AI GatewayEvaluation Types

List Evaluators
client.aiGateway.evaluationTypes.list(EvaluationTypeListParams { account_id, order_by, order_by_direction, 2 more } params, RequestOptionsoptions?): V4PagePaginationArray<EvaluationTypeListResponse { id, created_at, description, 5 more } >
GET/accounts/{account_id}/ai-gateway/evaluation-types
ModelsExpand Collapse
EvaluationTypeListResponse { id, created_at, description, 5 more }
id: string
created_at: string
formatdate-time
description: string
enable: boolean
mandatory: boolean
modified_at: string
formatdate-time
name: string
type: string

AI GatewayLogs

List Gateway Logs
client.aiGateway.logs.list(stringgatewayId, LogListParams { account_id, cached, direction, 26 more } params, RequestOptionsoptions?): V4PagePaginationArray<LogListResponse { id, cached, created_at, 16 more } >
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs
Get Gateway Log Detail
client.aiGateway.logs.get(stringgatewayId, stringid, LogGetParams { account_id } params, RequestOptionsoptions?): LogGetResponse { id, cached, created_at, 22 more }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}
Patch Gateway Log
client.aiGateway.logs.edit(stringgatewayId, stringid, LogEditParams { account_id, feedback, metadata, score } params, RequestOptionsoptions?): LogEditResponse
PATCH/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}
Delete Gateway Logs
client.aiGateway.logs.delete(stringgatewayId, LogDeleteParams { account_id, filters, limit, 2 more } params, RequestOptionsoptions?): LogDeleteResponse { success }
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs
Get Gateway Log Request
client.aiGateway.logs.request(stringgatewayId, stringid, LogRequestParams { account_id } params, RequestOptionsoptions?): LogRequestResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/request
Get Gateway Log Response
client.aiGateway.logs.response(stringgatewayId, stringid, LogResponseParams { account_id } params, RequestOptionsoptions?): LogResponseResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/response
ModelsExpand Collapse
LogListResponse { id, cached, created_at, 16 more }
id: string
cached: boolean
created_at: string
formatdate-time
duration: number
model: string
path: string
provider: string
success: boolean
tokens_in: number | null
tokens_out: number | null
cost?: number
custom_cost?: boolean
metadata?: string
model_type?: string
request_content_type?: string
request_type?: string
response_content_type?: string
status_code?: number
step?: number
LogGetResponse { id, cached, created_at, 22 more }
id: string
cached: boolean
created_at: string
formatdate-time
duration: number
model: string
path: string
provider: string
success: boolean
tokens_in: number | null
tokens_out: number | null
cost?: number
custom_cost?: boolean
metadata?: string
model_type?: string
request_content_type?: string
request_head?: string
request_head_complete?: boolean
request_size?: number
request_type?: string
response_content_type?: string
response_head?: string
response_head_complete?: boolean
response_size?: number
status_code?: number
step?: number
LogEditResponse = unknown
LogDeleteResponse { success }
success: boolean
LogRequestResponse = unknown
LogResponseResponse = unknown

AI GatewayDatasets

List Datasets
client.aiGateway.datasets.list(stringgatewayId, DatasetListParams { account_id, enable, name, 3 more } params, RequestOptionsoptions?): V4PagePaginationArray<DatasetListResponse { id, created_at, enable, 4 more } >
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets
Fetch a Dataset
client.aiGateway.datasets.get(stringgatewayId, stringid, DatasetGetParams { account_id } params, RequestOptionsoptions?): DatasetGetResponse { id, created_at, enable, 4 more }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}
Create a new Dataset
client.aiGateway.datasets.create(stringgatewayId, DatasetCreateParams { account_id, enable, filters, name } params, RequestOptionsoptions?): DatasetCreateResponse { id, created_at, enable, 4 more }
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets
Update a Dataset
client.aiGateway.datasets.update(stringgatewayId, stringid, DatasetUpdateParams { account_id, enable, filters, name } params, RequestOptionsoptions?): DatasetUpdateResponse { id, created_at, enable, 4 more }
PUT/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}
Delete a Dataset
client.aiGateway.datasets.delete(stringgatewayId, stringid, DatasetDeleteParams { account_id } params, RequestOptionsoptions?): DatasetDeleteResponse { id, created_at, enable, 4 more }
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}
ModelsExpand Collapse
DatasetListResponse { id, created_at, enable, 4 more }
id: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
DatasetGetResponse { id, created_at, enable, 4 more }
id: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
DatasetCreateResponse { id, created_at, enable, 4 more }
id: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
DatasetUpdateResponse { id, created_at, enable, 4 more }
id: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
DatasetDeleteResponse { id, created_at, enable, 4 more }
id: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string

AI GatewayEvaluations

List Evaluations
client.aiGateway.evaluations.list(stringgatewayId, EvaluationListParams { account_id, name, page, 3 more } params, RequestOptionsoptions?): V4PagePaginationArray<EvaluationListResponse { id, created_at, datasets, 6 more } >
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations
Fetch a Evaluation
client.aiGateway.evaluations.get(stringgatewayId, stringid, EvaluationGetParams { account_id } params, RequestOptionsoptions?): EvaluationGetResponse { id, created_at, datasets, 6 more }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}
Create a new Evaluation
client.aiGateway.evaluations.create(stringgatewayId, EvaluationCreateParams { account_id, dataset_ids, evaluation_type_ids, name } params, RequestOptionsoptions?): EvaluationCreateResponse { id, created_at, datasets, 6 more }
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations
Delete a Evaluation
client.aiGateway.evaluations.delete(stringgatewayId, stringid, EvaluationDeleteParams { account_id } params, RequestOptionsoptions?): EvaluationDeleteResponse { id, created_at, datasets, 6 more }
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}
ModelsExpand Collapse
EvaluationListResponse { id, created_at, datasets, 6 more }
id: string
created_at: string
formatdate-time
datasets: Array<Dataset>
id: string
account_id: string
account_tag: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
processed: boolean
results: Array<Result>
id: string
created_at: string
formatdate-time
evaluation_id: string
evaluation_type_id: string
modified_at: string
formatdate-time
result: string
status: number
status_description: string
total_logs: number
total_logs: number
EvaluationGetResponse { id, created_at, datasets, 6 more }
id: string
created_at: string
formatdate-time
datasets: Array<Dataset>
id: string
account_id: string
account_tag: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
processed: boolean
results: Array<Result>
id: string
created_at: string
formatdate-time
evaluation_id: string
evaluation_type_id: string
modified_at: string
formatdate-time
result: string
status: number
status_description: string
total_logs: number
total_logs: number
EvaluationCreateResponse { id, created_at, datasets, 6 more }
id: string
created_at: string
formatdate-time
datasets: Array<Dataset>
id: string
account_id: string
account_tag: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
processed: boolean
results: Array<Result>
id: string
created_at: string
formatdate-time
evaluation_id: string
evaluation_type_id: string
modified_at: string
formatdate-time
result: string
status: number
status_description: string
total_logs: number
total_logs: number
EvaluationDeleteResponse { id, created_at, datasets, 6 more }
id: string
created_at: string
formatdate-time
datasets: Array<Dataset>
id: string
account_id: string
account_tag: string
created_at: string
formatdate-time
enable: boolean
filters: Array<Filter>
key: "created_at" | "request_content_type" | "response_content_type" | 10 more
One of the following:
"created_at"
"request_content_type"
"response_content_type"
"success"
"cached"
"provider"
"model"
"cost"
"tokens"
"tokens_in"
"tokens_out"
"duration"
"feedback"
operator: "eq" | "contains" | "lt" | "gt"
One of the following:
"eq"
"contains"
"lt"
"gt"
value: Array<string | number | boolean>
One of the following:
string
number
boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
name: string
processed: boolean
results: Array<Result>
id: string
created_at: string
formatdate-time
evaluation_id: string
evaluation_type_id: string
modified_at: string
formatdate-time
result: string
status: number
status_description: string
total_logs: number
total_logs: number

AI GatewayDynamic Routing

List all AI Gateway Dynamic Routes.
client.aiGateway.dynamicRouting.list(stringgatewayId, DynamicRoutingListParams { account_id } params, RequestOptionsoptions?): DynamicRoutingListResponse { data, success }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes
Get an AI Gateway Dynamic Route.
client.aiGateway.dynamicRouting.get(stringgatewayId, stringid, DynamicRoutingGetParams { account_id } params, RequestOptionsoptions?): DynamicRoutingGetResponse { id, created_at, deployment, 5 more }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}
Create a new AI Gateway Dynamic Route.
client.aiGateway.dynamicRouting.create(stringgatewayId, DynamicRoutingCreateParams { account_id, elements, name } params, RequestOptionsoptions?): DynamicRoutingCreateResponse { id, created_at, deployment, 5 more }
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes
Update an AI Gateway Dynamic Route.
client.aiGateway.dynamicRouting.update(stringgatewayId, stringid, DynamicRoutingUpdateParams { account_id, name } params, RequestOptionsoptions?): DynamicRoutingUpdateResponse { route, success }
PATCH/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}
Delete an AI Gateway Dynamic Route.
client.aiGateway.dynamicRouting.delete(stringgatewayId, stringid, DynamicRoutingDeleteParams { account_id } params, RequestOptionsoptions?): DynamicRoutingDeleteResponse { id, created_at, elements, 3 more }
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}
List all AI Gateway Dynamic Route Deployments.
client.aiGateway.dynamicRouting.listDeployments(stringgatewayId, stringid, DynamicRoutingListDeploymentsParams { account_id } params, RequestOptionsoptions?): DynamicRoutingListDeploymentsResponse { data, success }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments
Create a new AI Gateway Dynamic Route Deployment.
client.aiGateway.dynamicRouting.createDeployment(stringgatewayId, stringid, DynamicRoutingCreateDeploymentParams { account_id, version_id } params, RequestOptionsoptions?): DynamicRoutingCreateDeploymentResponse { id, created_at, elements, 3 more }
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments
List all AI Gateway Dynamic Route Versions.
client.aiGateway.dynamicRouting.listVersions(stringgatewayId, stringid, DynamicRoutingListVersionsParams { account_id } params, RequestOptionsoptions?): DynamicRoutingListVersionsResponse { data, success }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions
Create a new AI Gateway Dynamic Route Version.
client.aiGateway.dynamicRouting.createVersion(stringgatewayId, stringid, DynamicRoutingCreateVersionParams { account_id, elements } params, RequestOptionsoptions?): DynamicRoutingCreateVersionResponse { id, created_at, elements, 3 more }
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions
Get an AI Gateway Dynamic Route Version.
client.aiGateway.dynamicRouting.getVersion(stringgatewayId, stringid, stringversionId, DynamicRoutingGetVersionParams { account_id } params, RequestOptionsoptions?): DynamicRoutingGetVersionResponse { id, active, created_at, 6 more }
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}
ModelsExpand Collapse
DynamicRoutingListResponse { data, success }
data: Data { order_by, order_by_direction, page, 2 more }
order_by: string
order_by_direction: string
page: number
per_page: number
routes: Array<Route>
id: string
account_tag: string
created_at: string
formatdate-time
deployment: Deployment { created_at, deployment_id, version_id }
created_at: string
deployment_id: string
version_id: string
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
version: Version { active, created_at, data, version_id }
active: "true" | "false"
One of the following:
"true"
"false"
created_at: string
data: string
version_id: string
success: boolean
DynamicRoutingGetResponse { id, created_at, deployment, 5 more }
id: string
created_at: string
formatdate-time
deployment: Deployment { created_at, deployment_id, version_id }
created_at: string
deployment_id: string
version_id: string
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
version: Version { active, created_at, data, version_id }
active: "true" | "false"
One of the following:
"true"
"false"
created_at: string
data: string
version_id: string
DynamicRoutingCreateResponse { id, created_at, deployment, 5 more }
id: string
created_at: string
formatdate-time
deployment: Deployment { created_at, deployment_id, version_id }
created_at: string
deployment_id: string
version_id: string
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
version: Version { active, created_at, data, version_id }
active: "true" | "false"
One of the following:
"true"
"false"
created_at: string
data: string
version_id: string
DynamicRoutingUpdateResponse { route, success }
route: Route { id, account_tag, created_at, 6 more }
id: string
account_tag: string
created_at: string
formatdate-time
deployment: Deployment { created_at, deployment_id, version_id }
created_at: string
deployment_id: string
version_id: string
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
version: Version { active, created_at, data, version_id }
active: "true" | "false"
One of the following:
"true"
"false"
created_at: string
data: string
version_id: string
success: boolean
DynamicRoutingDeleteResponse { id, created_at, elements, 3 more }
id: string
created_at: string
formatdate-time
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
DynamicRoutingListDeploymentsResponse { data, success }
data: Data { deployments, order_by, order_by_direction, 2 more }
deployments: Array<Deployment>
created_at: string
deployment_id: string
version_id: string
order_by: string
order_by_direction: string
page: number
per_page: number
success: boolean
DynamicRoutingCreateDeploymentResponse { id, created_at, elements, 3 more }
id: string
created_at: string
formatdate-time
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
DynamicRoutingListVersionsResponse { data, success }
data: Data { order_by, order_by_direction, page, 2 more }
order_by: string
order_by_direction: string
page: number
per_page: number
versions: Array<Version>
active: "true" | "false"
One of the following:
"true"
"false"
created_at: string
data: string
version_id: string
success: boolean
DynamicRoutingCreateVersionResponse { id, created_at, elements, 3 more }
id: string
created_at: string
formatdate-time
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
DynamicRoutingGetVersionResponse { id, active, created_at, 6 more }
id: string
active: "true" | "false"
One of the following:
"true"
"false"
created_at: string
data: string
elements: Array<UnionMember0 { id, outputs, type } | UnionMember1 { id, outputs, properties, type } | UnionMember2 { id, outputs, type } | 3 more>
One of the following:
UnionMember0 { id, outputs, type }
id: string
outputs: Outputs { next }
type: "start"
UnionMember1 { id, outputs, properties, type }
id: string
outputs: Outputs { false, true }
false: False { elementId }
elementId: string
true: True { elementId }
elementId: string
properties: Properties { conditions }
conditions?: unknown
type: "conditional"
UnionMember2 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "percentage"
UnionMember3 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { key, limit, limitType, window }
key: string
limit: number
limitType: "count" | "cost"
One of the following:
"count"
"cost"
window: number
type: "rate"
UnionMember4 { id, outputs, properties, type }
id: string
outputs: Outputs { fallback, success }
fallback: Fallback { elementId }
elementId: string
success: Success { elementId }
elementId: string
properties: Properties { model, provider, retries, timeout }
model: string
provider: string
retries: number
timeout: number
type: "model"
UnionMember5 { id, outputs, type }
id: string
outputs: Record<string, Outputs>
elementId: string
type: "end"
gateway_id: string
modified_at: string
formatdate-time
name: string
version_id: string

AI GatewayProvider Configs

List Provider Configs
client.aiGateway.providerConfigs.list(stringgatewayId, ProviderConfigListParams { account_id, page, per_page } params, RequestOptionsoptions?): V4PagePaginationArray<ProviderConfigListResponse { id, alias, default_config, 7 more } >
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs
Create a new Provider Configs
client.aiGateway.providerConfigs.create(stringgatewayId, ProviderConfigCreateParams { account_id, alias, default_config, 5 more } params, RequestOptionsoptions?): ProviderConfigCreateResponse { id, alias, default_config, 7 more }
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs
ModelsExpand Collapse
ProviderConfigListResponse { id, alias, default_config, 7 more }
id: string
alias: string
default_config: boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
provider_slug: string
secret_id: string
secret_preview: string
rate_limit?: number
rate_limit_period?: number
ProviderConfigCreateResponse { id, alias, default_config, 7 more }
id: string
alias: string
default_config: boolean
gateway_id: string

gateway id

maxLength64
minLength1
modified_at: string
formatdate-time
provider_slug: string
secret_id: string
secret_preview: string
rate_limit?: number
rate_limit_period?: number

AI GatewayURLs

Get Gateway URL
client.aiGateway.urls.get(stringgatewayId, stringprovider, URLGetParams { account_id } params, RequestOptionsoptions?): URLGetResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}
ModelsExpand Collapse
URLGetResponse = string

AI GatewayBilling

Get credit balance
client.aiGateway.billing.creditBalance(BillingCreditBalanceParams { account_id } params, RequestOptionsoptions?): BillingCreditBalanceResponse { balance, has_default_payment_method, payment_method, 2 more }
GET/accounts/{account_id}/ai-gateway/billing/credit-balance
Get usage history
client.aiGateway.billing.usageHistory(BillingUsageHistoryParams { account_id, value_grouping_window, end_time, start_time } params, RequestOptionsoptions?): BillingUsageHistoryResponse { history }
GET/accounts/{account_id}/ai-gateway/billing/usage-history
Get invoice history
client.aiGateway.billing.invoiceHistory(BillingInvoiceHistoryParams { account_id, type } params, RequestOptionsoptions?): BillingInvoiceHistoryResponse { invoices, pagination }
GET/accounts/{account_id}/ai-gateway/billing/invoice-history
Get invoice preview
client.aiGateway.billing.invoicePreview(BillingInvoicePreviewParams { account_id } params, RequestOptionsoptions?): BillingInvoicePreviewResponse { id, amount_due, amount_paid, 6 more }
GET/accounts/{account_id}/ai-gateway/billing/invoice-preview
ModelsExpand Collapse
BillingCreditBalanceResponse { balance, has_default_payment_method, payment_method, 2 more }
balance: number
has_default_payment_method: boolean
payment_method: PaymentMethod | null
brand?: string
last4?: string
topup_config: TopupConfig { amount, disabledReason, error, 2 more }
amount: number | null
disabledReason: string | null
error: string | null
lastFailedAt: number | null
threshold: number | null
first_topup_success?: boolean
BillingUsageHistoryResponse { history }
history: Array<History>
id: string
aggregated_value: number
end_time: number
start_time: number
BillingInvoiceHistoryResponse { invoices, pagination }
invoices: Array<Invoice>
amount_due: number
amount_paid: number
amount_remaining: number
currency: string
id?: string | null
attempt_count?: number
attempted?: boolean
auto_advance?: boolean | null
created?: number
created_by?: string
description?: string | null
invoice_origin?: string
invoice_pdf?: string | null
status?: string | null
BillingInvoicePreviewResponse { id, amount_due, amount_paid, 6 more }
id: string
amount_due: number
amount_paid: number
amount_remaining: number
currency: string
invoice_lines: Array<InvoiceLine>
amount: number
currency: string
description: string | null
period: Period { end, start }
end: number
start: number
pricing: Pricing { unit_amount_decimal }
unit_amount_decimal: string | null
quantity: number
pretax_credit_amounts?: Array<PretaxCreditAmount>
amount: number
type: string
credit_balance_transaction?: string | null
discount?: string | null
period_end: number
period_start: number
status: "draft" | "open" | "paid" | 2 more
One of the following:
"draft"
"open"
"paid"
"uncollectible"
"void"

AI GatewayBillingTopup

Create a top-up
client.aiGateway.billing.topup.create(TopupCreateParams { account_id, amount } params, RequestOptionsoptions?): TopupCreateResponse { client_secret, onboarding, payment_intent_id, 2 more }
POST/accounts/{account_id}/ai-gateway/billing/topup
Check top-up status
client.aiGateway.billing.topup.status(TopupStatusParams { account_id, payment_intent_id } params, RequestOptionsoptions?): TopupStatusResponse { payment_intent_id, status }
POST/accounts/{account_id}/ai-gateway/billing/topup/status
ModelsExpand Collapse
TopupCreateResponse { client_secret, onboarding, payment_intent_id, 2 more }
client_secret: string | null

Stripe PaymentIntent client secret.

onboarding: boolean

Whether the user was already onboarded.

payment_intent_id: string

Stripe invoice ID.

brand?: string

Card brand (visa, mastercard, etc.).

last4?: string

Last 4 digits of card.

TopupStatusResponse { payment_intent_id, status }
payment_intent_id: string
status: "completed" | "pending"
One of the following:
"completed"
"pending"

AI GatewayBillingTopupConfig

Get auto top-up configuration
client.aiGateway.billing.topup.config.get(ConfigGetParams { account_id } params, RequestOptionsoptions?): ConfigGetResponse { amount, disabledReason, error, 2 more }
GET/accounts/{account_id}/ai-gateway/billing/topup/config
Set auto top-up configuration
client.aiGateway.billing.topup.config.create(ConfigCreateParams { account_id, amount, threshold } params, RequestOptionsoptions?): ConfigCreateResponse { amount, threshold }
POST/accounts/{account_id}/ai-gateway/billing/topup/config
Delete auto top-up configuration
client.aiGateway.billing.topup.config.delete(ConfigDeleteParams { account_id } params, RequestOptionsoptions?): ConfigDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/billing/topup/config
ModelsExpand Collapse
ConfigGetResponse { amount, disabledReason, error, 2 more }
amount: number | null
disabledReason: string | null
error: string | null
lastFailedAt: number | null
threshold: number | null
ConfigCreateResponse { amount, threshold }
amount: number
threshold: number
ConfigDeleteResponse = unknown

AI GatewayBillingSpending Limit

Get spending limit
client.aiGateway.billing.spendingLimit.get(SpendingLimitGetParams { account_id } params, RequestOptionsoptions?): SpendingLimitGetResponse { config, enabled }
GET/accounts/{account_id}/ai-gateway/billing/spending-limit
Set spending limit
client.aiGateway.billing.spendingLimit.create(SpendingLimitCreateParams { account_id, amount, duration, strategy } params, RequestOptionsoptions?): SpendingLimitCreateResponse
POST/accounts/{account_id}/ai-gateway/billing/spending-limit
Delete spending limit
client.aiGateway.billing.spendingLimit.delete(SpendingLimitDeleteParams { account_id } params, RequestOptionsoptions?): SpendingLimitDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/billing/spending-limit
ModelsExpand Collapse
SpendingLimitGetResponse { config, enabled }
config: Config { amount, duration, strategy }
amount: number | null
duration: string | null
strategy: string | null
enabled: boolean
SpendingLimitCreateResponse = unknown
SpendingLimitDeleteResponse = unknown