Skip to content
Start here

AI Gateway

List gateways
ai_gateway.list(AIGatewayListParams**kwargs) -> SyncV4PagePaginationArray[AIGatewayListResponse]
GET/accounts/{account_id}/ai-gateway/gateways
Get a gateway
ai_gateway.get(strid, AIGatewayGetParams**kwargs) -> AIGatewayGetResponse
GET/accounts/{account_id}/ai-gateway/gateways/{id}
Create a gateway
ai_gateway.create(AIGatewayCreateParams**kwargs) -> AIGatewayCreateResponse
POST/accounts/{account_id}/ai-gateway/gateways
Update a gateway
ai_gateway.update(strid, AIGatewayUpdateParams**kwargs) -> AIGatewayUpdateResponse
PUT/accounts/{account_id}/ai-gateway/gateways/{id}
Delete a gateway
ai_gateway.delete(strid, AIGatewayDeleteParams**kwargs) -> AIGatewayDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/gateways/{id}
ModelsExpand Collapse
class AIGatewayListResponse: …
id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
cache_invalidate_on_update: bool
cache_ttl: Optional[int]
minimum0
collect_logs: bool
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
rate_limiting_interval: Optional[int]
minimum0
rate_limiting_limit: Optional[int]
minimum0
authentication: Optional[bool]
byok_only: Optional[bool]

Requires customer-provided provider credentials and prevents fallback to Unified Billing.

dlp: Optional[DLP]
One of the following:
class DLPUnionMember0: …
action: Literal["BLOCK", "FLAG"]
One of the following:
"BLOCK"
"FLAG"
enabled: bool
profiles: List[str]
class DLPUnionMember1: …
enabled: bool
policies: List[DLPUnionMember1Policy]
id: str
action: Literal["FLAG", "BLOCK"]
One of the following:
"FLAG"
"BLOCK"
check: List[Literal["REQUEST", "RESPONSE"]]
One of the following:
"REQUEST"
"RESPONSE"
enabled: bool
profiles: List[str]
guardrails: Optional[Guardrails]
prompt: GuardrailsPrompt
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
response: GuardrailsResponse
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
is_default: Optional[bool]
log_classification: Optional[bool]
log_management: Optional[int]
maximum10000000
minimum10000
log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush: Optional[bool]
logpush_public_key: Optional[str]
maxLength1024
minLength16
otel: Optional[List[Otel]]
headers: Dict[str, str]
url: str
formaturi
maxLength2048
authorization: Optional[str]
maxLength256
content_type: Optional[Literal["json", "protobuf"]]
One of the following:
"json"
"protobuf"
rate_limiting_technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
retry_backoff: Optional[Literal["constant", "linear", "exponential"]]

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay: Optional[int]

Delay between retry attempts in milliseconds (0-60000)

maximum60000
minimum0
retry_max_attempts: Optional[int]

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

maximum5
minimum1
spend_limits: Optional[SpendLimits]
enabled: Optional[bool]
rules: Optional[List[SpendLimitsRule]]
limit: float
exclusiveMinimum
minimum0
limit_type: Literal["cost"]
window: int
exclusiveMinimum
minimum0
id: Optional[str]
minLength1
enabled: Optional[bool]
metadata: Optional[Dict[str, SpendLimitsRuleMetadata]]
One of the following:
class SpendLimitsRuleMetadataMode: …
mode: Literal["partition"]
class SpendLimitsRuleMetadataUnionMember1: …
mode: Literal["filter"]
values: List[str]
model: Optional[SpendLimitsRuleModel]
mode: Literal["filter"]
values: List[str]
provider: Optional[SpendLimitsRuleProvider]
mode: Literal["filter"]
values: List[str]
technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
store_id: Optional[str]
stripe: Optional[Stripe]
authorization: str
usage_events: List[StripeUsageEvent]
payload: str
workers_ai_billing_mode: Optional[Literal["postpaid", "unified"]]

Controls 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.

One of the following:
"postpaid"
"unified"
zdr: Optional[bool]
class AIGatewayGetResponse: …
id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
cache_invalidate_on_update: bool
cache_ttl: Optional[int]
minimum0
collect_logs: bool
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
rate_limiting_interval: Optional[int]
minimum0
rate_limiting_limit: Optional[int]
minimum0
authentication: Optional[bool]
byok_only: Optional[bool]

Requires customer-provided provider credentials and prevents fallback to Unified Billing.

dlp: Optional[DLP]
One of the following:
class DLPUnionMember0: …
action: Literal["BLOCK", "FLAG"]
One of the following:
"BLOCK"
"FLAG"
enabled: bool
profiles: List[str]
class DLPUnionMember1: …
enabled: bool
policies: List[DLPUnionMember1Policy]
id: str
action: Literal["FLAG", "BLOCK"]
One of the following:
"FLAG"
"BLOCK"
check: List[Literal["REQUEST", "RESPONSE"]]
One of the following:
"REQUEST"
"RESPONSE"
enabled: bool
profiles: List[str]
guardrails: Optional[Guardrails]
prompt: GuardrailsPrompt
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
response: GuardrailsResponse
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
is_default: Optional[bool]
log_classification: Optional[bool]
log_management: Optional[int]
maximum10000000
minimum10000
log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush: Optional[bool]
logpush_public_key: Optional[str]
maxLength1024
minLength16
otel: Optional[List[Otel]]
headers: Dict[str, str]
url: str
formaturi
maxLength2048
authorization: Optional[str]
maxLength256
content_type: Optional[Literal["json", "protobuf"]]
One of the following:
"json"
"protobuf"
rate_limiting_technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
retry_backoff: Optional[Literal["constant", "linear", "exponential"]]

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay: Optional[int]

Delay between retry attempts in milliseconds (0-60000)

maximum60000
minimum0
retry_max_attempts: Optional[int]

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

maximum5
minimum1
spend_limits: Optional[SpendLimits]
enabled: Optional[bool]
rules: Optional[List[SpendLimitsRule]]
limit: float
exclusiveMinimum
minimum0
limit_type: Literal["cost"]
window: int
exclusiveMinimum
minimum0
id: Optional[str]
minLength1
enabled: Optional[bool]
metadata: Optional[Dict[str, SpendLimitsRuleMetadata]]
One of the following:
class SpendLimitsRuleMetadataMode: …
mode: Literal["partition"]
class SpendLimitsRuleMetadataUnionMember1: …
mode: Literal["filter"]
values: List[str]
model: Optional[SpendLimitsRuleModel]
mode: Literal["filter"]
values: List[str]
provider: Optional[SpendLimitsRuleProvider]
mode: Literal["filter"]
values: List[str]
technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
store_id: Optional[str]
stripe: Optional[Stripe]
authorization: str
usage_events: List[StripeUsageEvent]
payload: str
workers_ai_billing_mode: Optional[Literal["postpaid", "unified"]]

Controls 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.

One of the following:
"postpaid"
"unified"
zdr: Optional[bool]
class AIGatewayCreateResponse: …
id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
cache_invalidate_on_update: bool
cache_ttl: Optional[int]
minimum0
collect_logs: bool
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
rate_limiting_interval: Optional[int]
minimum0
rate_limiting_limit: Optional[int]
minimum0
authentication: Optional[bool]
byok_only: Optional[bool]

Requires customer-provided provider credentials and prevents fallback to Unified Billing.

dlp: Optional[DLP]
One of the following:
class DLPUnionMember0: …
action: Literal["BLOCK", "FLAG"]
One of the following:
"BLOCK"
"FLAG"
enabled: bool
profiles: List[str]
class DLPUnionMember1: …
enabled: bool
policies: List[DLPUnionMember1Policy]
id: str
action: Literal["FLAG", "BLOCK"]
One of the following:
"FLAG"
"BLOCK"
check: List[Literal["REQUEST", "RESPONSE"]]
One of the following:
"REQUEST"
"RESPONSE"
enabled: bool
profiles: List[str]
guardrails: Optional[Guardrails]
prompt: GuardrailsPrompt
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
response: GuardrailsResponse
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
is_default: Optional[bool]
log_classification: Optional[bool]
log_management: Optional[int]
maximum10000000
minimum10000
log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush: Optional[bool]
logpush_public_key: Optional[str]
maxLength1024
minLength16
otel: Optional[List[Otel]]
headers: Dict[str, str]
url: str
formaturi
maxLength2048
authorization: Optional[str]
maxLength256
content_type: Optional[Literal["json", "protobuf"]]
One of the following:
"json"
"protobuf"
rate_limiting_technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
retry_backoff: Optional[Literal["constant", "linear", "exponential"]]

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay: Optional[int]

Delay between retry attempts in milliseconds (0-60000)

maximum60000
minimum0
retry_max_attempts: Optional[int]

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

maximum5
minimum1
spend_limits: Optional[SpendLimits]
enabled: Optional[bool]
rules: Optional[List[SpendLimitsRule]]
limit: float
exclusiveMinimum
minimum0
limit_type: Literal["cost"]
window: int
exclusiveMinimum
minimum0
id: Optional[str]
minLength1
enabled: Optional[bool]
metadata: Optional[Dict[str, SpendLimitsRuleMetadata]]
One of the following:
class SpendLimitsRuleMetadataMode: …
mode: Literal["partition"]
class SpendLimitsRuleMetadataUnionMember1: …
mode: Literal["filter"]
values: List[str]
model: Optional[SpendLimitsRuleModel]
mode: Literal["filter"]
values: List[str]
provider: Optional[SpendLimitsRuleProvider]
mode: Literal["filter"]
values: List[str]
technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
store_id: Optional[str]
stripe: Optional[Stripe]
authorization: str
usage_events: List[StripeUsageEvent]
payload: str
workers_ai_billing_mode: Optional[Literal["postpaid", "unified"]]

Controls 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.

One of the following:
"postpaid"
"unified"
zdr: Optional[bool]
class AIGatewayUpdateResponse: …
id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
cache_invalidate_on_update: bool
cache_ttl: Optional[int]
minimum0
collect_logs: bool
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
rate_limiting_interval: Optional[int]
minimum0
rate_limiting_limit: Optional[int]
minimum0
authentication: Optional[bool]
byok_only: Optional[bool]

Requires customer-provided provider credentials and prevents fallback to Unified Billing.

dlp: Optional[DLP]
One of the following:
class DLPUnionMember0: …
action: Literal["BLOCK", "FLAG"]
One of the following:
"BLOCK"
"FLAG"
enabled: bool
profiles: List[str]
class DLPUnionMember1: …
enabled: bool
policies: List[DLPUnionMember1Policy]
id: str
action: Literal["FLAG", "BLOCK"]
One of the following:
"FLAG"
"BLOCK"
check: List[Literal["REQUEST", "RESPONSE"]]
One of the following:
"REQUEST"
"RESPONSE"
enabled: bool
profiles: List[str]
guardrails: Optional[Guardrails]
prompt: GuardrailsPrompt
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
response: GuardrailsResponse
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
is_default: Optional[bool]
log_classification: Optional[bool]
log_management: Optional[int]
maximum10000000
minimum10000
log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush: Optional[bool]
logpush_public_key: Optional[str]
maxLength1024
minLength16
otel: Optional[List[Otel]]
headers: Dict[str, str]
url: str
formaturi
maxLength2048
authorization: Optional[str]
maxLength256
content_type: Optional[Literal["json", "protobuf"]]
One of the following:
"json"
"protobuf"
rate_limiting_technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
retry_backoff: Optional[Literal["constant", "linear", "exponential"]]

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay: Optional[int]

Delay between retry attempts in milliseconds (0-60000)

maximum60000
minimum0
retry_max_attempts: Optional[int]

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

maximum5
minimum1
spend_limits: Optional[SpendLimits]
enabled: Optional[bool]
rules: Optional[List[SpendLimitsRule]]
limit: float
exclusiveMinimum
minimum0
limit_type: Literal["cost"]
window: int
exclusiveMinimum
minimum0
id: Optional[str]
minLength1
enabled: Optional[bool]
metadata: Optional[Dict[str, SpendLimitsRuleMetadata]]
One of the following:
class SpendLimitsRuleMetadataMode: …
mode: Literal["partition"]
class SpendLimitsRuleMetadataUnionMember1: …
mode: Literal["filter"]
values: List[str]
model: Optional[SpendLimitsRuleModel]
mode: Literal["filter"]
values: List[str]
provider: Optional[SpendLimitsRuleProvider]
mode: Literal["filter"]
values: List[str]
technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
store_id: Optional[str]
stripe: Optional[Stripe]
authorization: str
usage_events: List[StripeUsageEvent]
payload: str
workers_ai_billing_mode: Optional[Literal["postpaid", "unified"]]

Controls 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.

One of the following:
"postpaid"
"unified"
zdr: Optional[bool]
class AIGatewayDeleteResponse: …
id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
cache_invalidate_on_update: bool
cache_ttl: Optional[int]
minimum0
collect_logs: bool
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
rate_limiting_interval: Optional[int]
minimum0
rate_limiting_limit: Optional[int]
minimum0
authentication: Optional[bool]
byok_only: Optional[bool]

Requires customer-provided provider credentials and prevents fallback to Unified Billing.

dlp: Optional[DLP]
One of the following:
class DLPUnionMember0: …
action: Literal["BLOCK", "FLAG"]
One of the following:
"BLOCK"
"FLAG"
enabled: bool
profiles: List[str]
class DLPUnionMember1: …
enabled: bool
policies: List[DLPUnionMember1Policy]
id: str
action: Literal["FLAG", "BLOCK"]
One of the following:
"FLAG"
"BLOCK"
check: List[Literal["REQUEST", "RESPONSE"]]
One of the following:
"REQUEST"
"RESPONSE"
enabled: bool
profiles: List[str]
guardrails: Optional[Guardrails]
prompt: GuardrailsPrompt
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
response: GuardrailsResponse
p1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s1: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s10: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s11: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s12: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s13: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s2: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s3: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s4: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s5: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s6: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s7: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s8: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
s9: Optional[Literal["FLAG", "BLOCK"]]
One of the following:
"FLAG"
"BLOCK"
is_default: Optional[bool]
log_classification: Optional[bool]
log_management: Optional[int]
maximum10000000
minimum10000
log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]
One of the following:
"STOP_INSERTING"
"DELETE_OLDEST"
logpush: Optional[bool]
logpush_public_key: Optional[str]
maxLength1024
minLength16
otel: Optional[List[Otel]]
headers: Dict[str, str]
url: str
formaturi
maxLength2048
authorization: Optional[str]
maxLength256
content_type: Optional[Literal["json", "protobuf"]]
One of the following:
"json"
"protobuf"
rate_limiting_technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
retry_backoff: Optional[Literal["constant", "linear", "exponential"]]

Backoff strategy for retry delays

One of the following:
"constant"
"linear"
"exponential"
retry_delay: Optional[int]

Delay between retry attempts in milliseconds (0-60000)

maximum60000
minimum0
retry_max_attempts: Optional[int]

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

maximum5
minimum1
spend_limits: Optional[SpendLimits]
enabled: Optional[bool]
rules: Optional[List[SpendLimitsRule]]
limit: float
exclusiveMinimum
minimum0
limit_type: Literal["cost"]
window: int
exclusiveMinimum
minimum0
id: Optional[str]
minLength1
enabled: Optional[bool]
metadata: Optional[Dict[str, SpendLimitsRuleMetadata]]
One of the following:
class SpendLimitsRuleMetadataMode: …
mode: Literal["partition"]
class SpendLimitsRuleMetadataUnionMember1: …
mode: Literal["filter"]
values: List[str]
model: Optional[SpendLimitsRuleModel]
mode: Literal["filter"]
values: List[str]
provider: Optional[SpendLimitsRuleProvider]
mode: Literal["filter"]
values: List[str]
technique: Optional[Literal["fixed", "sliding"]]
One of the following:
"fixed"
"sliding"
store_id: Optional[str]
stripe: Optional[Stripe]
authorization: str
usage_events: List[StripeUsageEvent]
payload: str
workers_ai_billing_mode: Optional[Literal["postpaid", "unified"]]

Controls 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.

One of the following:
"postpaid"
"unified"
zdr: Optional[bool]

AI GatewayEvaluation Types

List evaluator types (deprecated)
ai_gateway.evaluation_types.list(EvaluationTypeListParams**kwargs) -> SyncV4PagePaginationArray[EvaluationTypeListResponse]
GET/accounts/{account_id}/ai-gateway/evaluation-types
ModelsExpand Collapse
class EvaluationTypeListResponse: …
id: str
created_at: datetime
formatdate-time
description: str
enable: bool
mandatory: bool
modified_at: datetime
formatdate-time
name: str
type: str

AI GatewayCustom Providers

List custom providers
ai_gateway.custom_providers.list(CustomProviderListParams**kwargs) -> SyncV4PagePaginationArray[CustomProviderListResponse]
GET/accounts/{account_id}/ai-gateway/custom-providers
Get a custom provider
ai_gateway.custom_providers.get(strid, CustomProviderGetParams**kwargs) -> CustomProviderGetResponse
GET/accounts/{account_id}/ai-gateway/custom-providers/{id}
Create a custom provider
ai_gateway.custom_providers.create(CustomProviderCreateParams**kwargs) -> CustomProviderCreateResponse
POST/accounts/{account_id}/ai-gateway/custom-providers
Delete a custom provider
ai_gateway.custom_providers.delete(strid, CustomProviderDeleteParams**kwargs) -> CustomProviderDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/custom-providers/{id}
ModelsExpand Collapse
class CustomProviderListResponse: …
id: str
formatuuid
base_url: str
formaturi
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
name: str
slug: str
beta: Optional[bool]
curl_example: Optional[str]
description: Optional[str]
enable: Optional[bool]
headers: Optional[str]

JSON object of extra HTTP headers that AI Gateway sends to the provider. Values can contain credentials.

maxLength8192
js_example: Optional[str]
position: Optional[int]
class CustomProviderGetResponse: …
id: str
formatuuid
base_url: str
formaturi
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
name: str
slug: str
beta: Optional[bool]
curl_example: Optional[str]
description: Optional[str]
enable: Optional[bool]
headers: Optional[str]

JSON object of extra HTTP headers that AI Gateway sends to the provider. Values can contain credentials.

maxLength8192
js_example: Optional[str]
position: Optional[int]
class CustomProviderCreateResponse: …
id: str
formatuuid
base_url: str
formaturi
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
name: str
slug: str
beta: Optional[bool]
curl_example: Optional[str]
description: Optional[str]
enable: Optional[bool]
headers: Optional[str]

JSON object of extra HTTP headers that AI Gateway sends to the provider. Values can contain credentials.

maxLength8192
js_example: Optional[str]
position: Optional[int]
class CustomProviderDeleteResponse: …
id: str
formatuuid
base_url: str
formaturi
created_at: datetime
formatdate-time
modified_at: datetime
formatdate-time
name: str
slug: str
beta: Optional[bool]
curl_example: Optional[str]
description: Optional[str]
enable: Optional[bool]
headers: Optional[str]

JSON object of extra HTTP headers that AI Gateway sends to the provider. Values can contain credentials.

maxLength8192
js_example: Optional[str]
position: Optional[int]

AI GatewayLogs

List Gateway Logs
ai_gateway.logs.list(strgateway_id, LogListParams**kwargs) -> SyncV4PagePaginationArray[LogListResponse]
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs
Get Gateway Log Detail
ai_gateway.logs.get(strid, LogGetParams**kwargs) -> LogGetResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}
Patch Gateway Log
ai_gateway.logs.edit(strid, LogEditParams**kwargs) -> object
PATCH/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}
Delete Gateway Logs
ai_gateway.logs.delete(strgateway_id, LogDeleteParams**kwargs) -> LogDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs
Get Gateway Log Request
ai_gateway.logs.request(strid, LogRequestParams**kwargs) -> object
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/request
Get Gateway Log Response
ai_gateway.logs.response(strid, LogResponseParams**kwargs) -> object
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/response
ModelsExpand Collapse
class LogListResponse: …
id: str
cached: bool
created_at: datetime
formatdate-time
duration: int
model: str
path: str
provider: str
success: bool
tokens_in: Optional[int]
tokens_out: Optional[int]
cost: Optional[float]
custom_cost: Optional[bool]
metadata: Optional[str]
model_type: Optional[str]
request_content_type: Optional[str]
request_type: Optional[str]
response_content_type: Optional[str]
status_code: Optional[int]
step: Optional[int]
class LogGetResponse: …
id: str
cached: bool
created_at: datetime
formatdate-time
duration: int
model: str
path: str
provider: str
success: bool
tokens_in: Optional[int]
tokens_out: Optional[int]
cost: Optional[float]
custom_cost: Optional[bool]
metadata: Optional[str]
model_type: Optional[str]
request_content_type: Optional[str]
request_head: Optional[str]
request_head_complete: Optional[bool]
request_size: Optional[int]
request_type: Optional[str]
response_content_type: Optional[str]
response_head: Optional[str]
response_head_complete: Optional[bool]
response_size: Optional[int]
status_code: Optional[int]
step: Optional[int]
class LogDeleteResponse: …
success: bool

AI GatewayDatasets

List datasets (deprecated)
ai_gateway.datasets.list(strgateway_id, DatasetListParams**kwargs) -> SyncV4PagePaginationArray[DatasetListResponse]
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets
Get a dataset (deprecated)
ai_gateway.datasets.get(strid, DatasetGetParams**kwargs) -> DatasetGetResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}
Create a dataset (deprecated)
ai_gateway.datasets.create(strgateway_id, DatasetCreateParams**kwargs) -> DatasetCreateResponse
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets
Update a dataset (deprecated)
ai_gateway.datasets.update(strid, DatasetUpdateParams**kwargs) -> DatasetUpdateResponse
PUT/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}
Delete a dataset (deprecated)
ai_gateway.datasets.delete(strid, DatasetDeleteParams**kwargs) -> DatasetDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}
ModelsExpand Collapse
class DatasetListResponse: …
id: str
created_at: datetime
formatdate-time
enable: bool
filters: List[Filter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
class DatasetGetResponse: …
id: str
created_at: datetime
formatdate-time
enable: bool
filters: List[Filter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
class DatasetCreateResponse: …
id: str
created_at: datetime
formatdate-time
enable: bool
filters: List[Filter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
class DatasetUpdateResponse: …
id: str
created_at: datetime
formatdate-time
enable: bool
filters: List[Filter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
class DatasetDeleteResponse: …
id: str
created_at: datetime
formatdate-time
enable: bool
filters: List[Filter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str

AI GatewayEvaluations

List evaluations (deprecated)
ai_gateway.evaluations.list(strgateway_id, EvaluationListParams**kwargs) -> SyncV4PagePaginationArray[EvaluationListResponse]
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations
Get an evaluation (deprecated)
ai_gateway.evaluations.get(strid, EvaluationGetParams**kwargs) -> EvaluationGetResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}
Create an evaluation (deprecated)
ai_gateway.evaluations.create(strgateway_id, EvaluationCreateParams**kwargs) -> EvaluationCreateResponse
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations
Delete an evaluation (deprecated)
ai_gateway.evaluations.delete(strid, EvaluationDeleteParams**kwargs) -> EvaluationDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}
ModelsExpand Collapse
class EvaluationListResponse: …
id: str
created_at: datetime
formatdate-time
datasets: List[Dataset]
id: str
account_id: str
account_tag: str
created_at: datetime
formatdate-time
enable: bool
filters: List[DatasetFilter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
processed: bool
results: List[Result]
id: str
created_at: datetime
formatdate-time
evaluation_id: str
evaluation_type_id: str
modified_at: datetime
formatdate-time
result: str
status: float
status_description: str
total_logs: float
total_logs: float
class EvaluationGetResponse: …
id: str
created_at: datetime
formatdate-time
datasets: List[Dataset]
id: str
account_id: str
account_tag: str
created_at: datetime
formatdate-time
enable: bool
filters: List[DatasetFilter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
processed: bool
results: List[Result]
id: str
created_at: datetime
formatdate-time
evaluation_id: str
evaluation_type_id: str
modified_at: datetime
formatdate-time
result: str
status: float
status_description: str
total_logs: float
total_logs: float
class EvaluationCreateResponse: …
id: str
created_at: datetime
formatdate-time
datasets: List[Dataset]
id: str
account_id: str
account_tag: str
created_at: datetime
formatdate-time
enable: bool
filters: List[DatasetFilter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
processed: bool
results: List[Result]
id: str
created_at: datetime
formatdate-time
evaluation_id: str
evaluation_type_id: str
modified_at: datetime
formatdate-time
result: str
status: float
status_description: str
total_logs: float
total_logs: float
class EvaluationDeleteResponse: …
id: str
created_at: datetime
formatdate-time
datasets: List[Dataset]
id: str
account_id: str
account_tag: str
created_at: datetime
formatdate-time
enable: bool
filters: List[DatasetFilter]
key: Literal["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: Literal["eq", "contains", "lt", "gt"]
One of the following:
"eq"
"contains"
"lt"
"gt"
value: List[Union[str, float, bool]]
One of the following:
str
float
bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
name: str
processed: bool
results: List[Result]
id: str
created_at: datetime
formatdate-time
evaluation_id: str
evaluation_type_id: str
modified_at: datetime
formatdate-time
result: str
status: float
status_description: str
total_logs: float
total_logs: float

AI GatewayDynamic Routing

List dynamic routes
ai_gateway.dynamic_routing.list(strgateway_id, DynamicRoutingListParams**kwargs) -> DynamicRoutingListResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes
Get a dynamic route
ai_gateway.dynamic_routing.get(strid, DynamicRoutingGetParams**kwargs) -> DynamicRoutingGetResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}
Create a dynamic route
ai_gateway.dynamic_routing.create(strgateway_id, DynamicRoutingCreateParams**kwargs) -> DynamicRoutingCreateResponse
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes
Rename a dynamic route
ai_gateway.dynamic_routing.update(strid, DynamicRoutingUpdateParams**kwargs) -> DynamicRoutingUpdateResponse
PATCH/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}
Delete a dynamic route
ai_gateway.dynamic_routing.delete(strid, DynamicRoutingDeleteParams**kwargs) -> DynamicRoutingDeleteResponse
DELETE/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}
List dynamic route deployments
ai_gateway.dynamic_routing.list_deployments(strid, DynamicRoutingListDeploymentsParams**kwargs) -> DynamicRoutingListDeploymentsResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments
Deploy a dynamic route version
ai_gateway.dynamic_routing.create_deployment(strid, DynamicRoutingCreateDeploymentParams**kwargs) -> DynamicRoutingCreateDeploymentResponse
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments
List dynamic route versions
ai_gateway.dynamic_routing.list_versions(strid, DynamicRoutingListVersionsParams**kwargs) -> DynamicRoutingListVersionsResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions
Create a dynamic route version
ai_gateway.dynamic_routing.create_version(strid, DynamicRoutingCreateVersionParams**kwargs) -> DynamicRoutingCreateVersionResponse
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions
Get a dynamic route version
ai_gateway.dynamic_routing.get_version(strversion_id, DynamicRoutingGetVersionParams**kwargs) -> DynamicRoutingGetVersionResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}
ModelsExpand Collapse
class DynamicRoutingListResponse: …
data: Data
order_by: str
order_by_direction: str
page: float
per_page: float
routes: List[DataRoute]
id: str
account_tag: str
created_at: datetime
formatdate-time
deployment: DataRouteDeployment
created_at: str
deployment_id: str
version_id: str
elements: List[DataRouteElement]
One of the following:
class DataRouteElementUnionMember0: …
id: str
outputs: DataRouteElementUnionMember0Outputs
type: Literal["start"]
class DataRouteElementUnionMember1: …
id: str
outputs: DataRouteElementUnionMember1Outputs
false: DataRouteElementUnionMember1OutputsFalse_
element_id: str
true: DataRouteElementUnionMember1OutputsTrue_
element_id: str
properties: DataRouteElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class DataRouteElementUnionMember2: …
id: str
outputs: Dict[str, DataRouteElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class DataRouteElementUnionMember3: …
id: str
outputs: DataRouteElementUnionMember3Outputs
fallback: DataRouteElementUnionMember3OutputsFallback
element_id: str
success: DataRouteElementUnionMember3OutputsSuccess
element_id: str
properties: DataRouteElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class DataRouteElementUnionMember4: …
id: str
outputs: DataRouteElementUnionMember4Outputs
fallback: DataRouteElementUnionMember4OutputsFallback
element_id: str
success: DataRouteElementUnionMember4OutputsSuccess
element_id: str
properties: DataRouteElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class DataRouteElementUnionMember5: …
id: str
outputs: Dict[str, DataRouteElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
version: DataRouteVersion
active: Literal["true", "false"]
One of the following:
"true"
"false"
created_at: str
data: str
version_id: str
is_valid: Optional[bool]
success: bool
class DynamicRoutingGetResponse: …
id: str
created_at: datetime
formatdate-time
deployment: Deployment
created_at: str
deployment_id: str
version_id: str
elements: List[Element]
One of the following:
class ElementUnionMember0: …
id: str
outputs: ElementUnionMember0Outputs
type: Literal["start"]
class ElementUnionMember1: …
id: str
outputs: ElementUnionMember1Outputs
false: ElementUnionMember1OutputsFalse_
element_id: str
true: ElementUnionMember1OutputsTrue_
element_id: str
properties: ElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class ElementUnionMember2: …
id: str
outputs: Dict[str, ElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class ElementUnionMember3: …
id: str
outputs: ElementUnionMember3Outputs
fallback: ElementUnionMember3OutputsFallback
element_id: str
success: ElementUnionMember3OutputsSuccess
element_id: str
properties: ElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class ElementUnionMember4: …
id: str
outputs: ElementUnionMember4Outputs
fallback: ElementUnionMember4OutputsFallback
element_id: str
success: ElementUnionMember4OutputsSuccess
element_id: str
properties: ElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class ElementUnionMember5: …
id: str
outputs: Dict[str, ElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
version: Version
active: Literal["true", "false"]
One of the following:
"true"
"false"
created_at: str
data: str
version_id: str
is_valid: Optional[bool]
class DynamicRoutingCreateResponse: …
id: str
created_at: datetime
formatdate-time
deployment: Deployment
created_at: str
deployment_id: str
version_id: str
elements: List[Element]
One of the following:
class ElementUnionMember0: …
id: str
outputs: ElementUnionMember0Outputs
type: Literal["start"]
class ElementUnionMember1: …
id: str
outputs: ElementUnionMember1Outputs
false: ElementUnionMember1OutputsFalse_
element_id: str
true: ElementUnionMember1OutputsTrue_
element_id: str
properties: ElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class ElementUnionMember2: …
id: str
outputs: Dict[str, ElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class ElementUnionMember3: …
id: str
outputs: ElementUnionMember3Outputs
fallback: ElementUnionMember3OutputsFallback
element_id: str
success: ElementUnionMember3OutputsSuccess
element_id: str
properties: ElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class ElementUnionMember4: …
id: str
outputs: ElementUnionMember4Outputs
fallback: ElementUnionMember4OutputsFallback
element_id: str
success: ElementUnionMember4OutputsSuccess
element_id: str
properties: ElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class ElementUnionMember5: …
id: str
outputs: Dict[str, ElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
version: Version
active: Literal["true", "false"]
One of the following:
"true"
"false"
created_at: str
data: str
version_id: str
is_valid: Optional[bool]
class DynamicRoutingUpdateResponse: …
route: Route
id: str
account_tag: str
created_at: datetime
formatdate-time
deployment: RouteDeployment
created_at: str
deployment_id: str
version_id: str
elements: List[RouteElement]
One of the following:
class RouteElementUnionMember0: …
id: str
outputs: RouteElementUnionMember0Outputs
type: Literal["start"]
class RouteElementUnionMember1: …
id: str
outputs: RouteElementUnionMember1Outputs
false: RouteElementUnionMember1OutputsFalse_
element_id: str
true: RouteElementUnionMember1OutputsTrue_
element_id: str
properties: RouteElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class RouteElementUnionMember2: …
id: str
outputs: Dict[str, RouteElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class RouteElementUnionMember3: …
id: str
outputs: RouteElementUnionMember3Outputs
fallback: RouteElementUnionMember3OutputsFallback
element_id: str
success: RouteElementUnionMember3OutputsSuccess
element_id: str
properties: RouteElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class RouteElementUnionMember4: …
id: str
outputs: RouteElementUnionMember4Outputs
fallback: RouteElementUnionMember4OutputsFallback
element_id: str
success: RouteElementUnionMember4OutputsSuccess
element_id: str
properties: RouteElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class RouteElementUnionMember5: …
id: str
outputs: Dict[str, RouteElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
version: RouteVersion
active: Literal["true", "false"]
One of the following:
"true"
"false"
created_at: str
data: str
version_id: str
is_valid: Optional[bool]
success: bool
class DynamicRoutingDeleteResponse: …
id: str
created_at: datetime
formatdate-time
elements: List[Element]
One of the following:
class ElementUnionMember0: …
id: str
outputs: ElementUnionMember0Outputs
type: Literal["start"]
class ElementUnionMember1: …
id: str
outputs: ElementUnionMember1Outputs
false: ElementUnionMember1OutputsFalse_
element_id: str
true: ElementUnionMember1OutputsTrue_
element_id: str
properties: ElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class ElementUnionMember2: …
id: str
outputs: Dict[str, ElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class ElementUnionMember3: …
id: str
outputs: ElementUnionMember3Outputs
fallback: ElementUnionMember3OutputsFallback
element_id: str
success: ElementUnionMember3OutputsSuccess
element_id: str
properties: ElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class ElementUnionMember4: …
id: str
outputs: ElementUnionMember4Outputs
fallback: ElementUnionMember4OutputsFallback
element_id: str
success: ElementUnionMember4OutputsSuccess
element_id: str
properties: ElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class ElementUnionMember5: …
id: str
outputs: Dict[str, ElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
class DynamicRoutingListDeploymentsResponse: …
data: Data
deployments: List[DataDeployment]
created_at: str
deployment_id: str
version_id: str
order_by: str
order_by_direction: str
page: float
per_page: float
success: bool
class DynamicRoutingCreateDeploymentResponse: …
id: str
created_at: datetime
formatdate-time
elements: List[Element]
One of the following:
class ElementUnionMember0: …
id: str
outputs: ElementUnionMember0Outputs
type: Literal["start"]
class ElementUnionMember1: …
id: str
outputs: ElementUnionMember1Outputs
false: ElementUnionMember1OutputsFalse_
element_id: str
true: ElementUnionMember1OutputsTrue_
element_id: str
properties: ElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class ElementUnionMember2: …
id: str
outputs: Dict[str, ElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class ElementUnionMember3: …
id: str
outputs: ElementUnionMember3Outputs
fallback: ElementUnionMember3OutputsFallback
element_id: str
success: ElementUnionMember3OutputsSuccess
element_id: str
properties: ElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class ElementUnionMember4: …
id: str
outputs: ElementUnionMember4Outputs
fallback: ElementUnionMember4OutputsFallback
element_id: str
success: ElementUnionMember4OutputsSuccess
element_id: str
properties: ElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class ElementUnionMember5: …
id: str
outputs: Dict[str, ElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
class DynamicRoutingListVersionsResponse: …
data: Data
order_by: str
order_by_direction: str
page: float
per_page: float
versions: List[DataVersion]
active: Literal["true", "false"]
One of the following:
"true"
"false"
created_at: str
data: str
version_id: str
is_valid: Optional[bool]
success: bool
class DynamicRoutingCreateVersionResponse: …
id: str
created_at: datetime
formatdate-time
elements: List[Element]
One of the following:
class ElementUnionMember0: …
id: str
outputs: ElementUnionMember0Outputs
type: Literal["start"]
class ElementUnionMember1: …
id: str
outputs: ElementUnionMember1Outputs
false: ElementUnionMember1OutputsFalse_
element_id: str
true: ElementUnionMember1OutputsTrue_
element_id: str
properties: ElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class ElementUnionMember2: …
id: str
outputs: Dict[str, ElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class ElementUnionMember3: …
id: str
outputs: ElementUnionMember3Outputs
fallback: ElementUnionMember3OutputsFallback
element_id: str
success: ElementUnionMember3OutputsSuccess
element_id: str
properties: ElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class ElementUnionMember4: …
id: str
outputs: ElementUnionMember4Outputs
fallback: ElementUnionMember4OutputsFallback
element_id: str
success: ElementUnionMember4OutputsSuccess
element_id: str
properties: ElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class ElementUnionMember5: …
id: str
outputs: Dict[str, ElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
class DynamicRoutingGetVersionResponse: …
id: str
active: Literal["true", "false"]
One of the following:
"true"
"false"
created_at: str
data: str
elements: List[Element]
One of the following:
class ElementUnionMember0: …
id: str
outputs: ElementUnionMember0Outputs
type: Literal["start"]
class ElementUnionMember1: …
id: str
outputs: ElementUnionMember1Outputs
false: ElementUnionMember1OutputsFalse_
element_id: str
true: ElementUnionMember1OutputsTrue_
element_id: str
properties: ElementUnionMember1Properties
conditions: Optional[object]
type: Literal["conditional"]
class ElementUnionMember2: …
id: str
outputs: Dict[str, ElementUnionMember2Outputs]
element_id: str
type: Literal["percentage"]
class ElementUnionMember3: …
id: str
outputs: ElementUnionMember3Outputs
fallback: ElementUnionMember3OutputsFallback
element_id: str
success: ElementUnionMember3OutputsSuccess
element_id: str
properties: ElementUnionMember3Properties
key: str
limit: float
limit_type: Literal["count", "cost"]
One of the following:
"count"
"cost"
window: float
type: Literal["rate"]
class ElementUnionMember4: …
id: str
outputs: ElementUnionMember4Outputs
fallback: ElementUnionMember4OutputsFallback
element_id: str
success: ElementUnionMember4OutputsSuccess
element_id: str
properties: ElementUnionMember4Properties
model: str
provider: str
retries: float
timeout: float
type: Literal["model"]
class ElementUnionMember5: …
id: str
outputs: Dict[str, ElementUnionMember5Outputs]
element_id: str
type: Literal["end"]
gateway_id: str
modified_at: datetime
formatdate-time
name: str
minLength1
version_id: str
is_valid: Optional[bool]

AI GatewayProvider Configs

List provider keys
ai_gateway.provider_configs.list(strgateway_id, ProviderConfigListParams**kwargs) -> SyncV4PagePaginationArray[ProviderConfigListResponse]
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs
Store a provider key
ai_gateway.provider_configs.create(strgateway_id, ProviderConfigCreateParams**kwargs) -> ProviderConfigCreateResponse
POST/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs
ModelsExpand Collapse
class ProviderConfigListResponse: …
id: str
alias: str
default_config: bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
provider_slug: str
secret_id: str
secret_preview: str
rate_limit: Optional[float]
rate_limit_period: Optional[float]
class ProviderConfigCreateResponse: …
id: str
alias: str
default_config: bool
gateway_id: str

Unique identifier of the AI Gateway within the account.

maxLength64
minLength1
modified_at: datetime
formatdate-time
provider_slug: str
secret_id: str
secret_preview: str
rate_limit: Optional[float]
rate_limit_period: Optional[float]

AI GatewayURLs

Get Gateway URL
ai_gateway.urls.get(strprovider, URLGetParams**kwargs) -> URLGetResponse
GET/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}
ModelsExpand Collapse
str

AI GatewayBilling

Get credit balance
ai_gateway.billing.credit_balance(BillingCreditBalanceParams**kwargs) -> BillingCreditBalanceResponse
GET/accounts/{account_id}/ai-gateway/billing/credit-balance
Get usage history
ai_gateway.billing.usage_history(BillingUsageHistoryParams**kwargs) -> BillingUsageHistoryResponse
GET/accounts/{account_id}/ai-gateway/billing/usage-history
Get invoice history
ai_gateway.billing.invoice_history(BillingInvoiceHistoryParams**kwargs) -> BillingInvoiceHistoryResponse
GET/accounts/{account_id}/ai-gateway/billing/invoice-history
Get invoice preview
ai_gateway.billing.invoice_preview(BillingInvoicePreviewParams**kwargs) -> BillingInvoicePreviewResponse
GET/accounts/{account_id}/ai-gateway/billing/invoice-preview
ModelsExpand Collapse
class BillingCreditBalanceResponse: …
balance: float
has_default_payment_method: bool
payment_method: Optional[PaymentMethod]
brand: Optional[str]
last4: Optional[str]
topup_config: TopupConfig
amount: Optional[float]
threshold: Optional[float]
disabled_reason: Optional[str]
error: Optional[str]
last_failed_at: Optional[float]
first_topup_success: Optional[bool]
class BillingUsageHistoryResponse: …
history: List[History]
id: str
aggregated_value: float
end_time: float
start_time: float
class BillingInvoiceHistoryResponse: …
invoices: List[Invoice]
amount_due: float
amount_paid: float
amount_remaining: float
currency: str
id: Optional[str]
attempt_count: Optional[float]
attempted: Optional[bool]
auto_advance: Optional[bool]
created: Optional[float]
created_by: Optional[str]
description: Optional[str]
invoice_origin: Optional[str]
invoice_pdf: Optional[str]
status: Optional[str]
class BillingInvoicePreviewResponse: …
id: str
amount_due: float
amount_paid: float
amount_remaining: float
currency: str
invoice_lines: List[InvoiceLine]
amount: float
currency: str
description: Optional[str]
period: InvoiceLinePeriod
end: float
start: float
pricing: InvoiceLinePricing
unit_amount_decimal: Optional[str]
quantity: float
pretax_credit_amounts: Optional[List[InvoiceLinePretaxCreditAmount]]
amount: float
type: str
credit_balance_transaction: Optional[str]
discount: Optional[str]
period_end: float
period_start: float
status: Literal["draft", "open", "paid", 2 more]
One of the following:
"draft"
"open"
"paid"
"uncollectible"
"void"

AI GatewayBillingTopup

Create a top-up
ai_gateway.billing.topup.create(TopupCreateParams**kwargs) -> TopupCreateResponse
POST/accounts/{account_id}/ai-gateway/billing/topup
Check top-up status
ai_gateway.billing.topup.status(TopupStatusParams**kwargs) -> TopupStatusResponse
POST/accounts/{account_id}/ai-gateway/billing/topup/status
ModelsExpand Collapse
class TopupCreateResponse: …
client_secret: Optional[str]

Stripe PaymentIntent client secret.

onboarding: bool

Whether the user was already onboarded.

payment_intent_id: str

Stripe invoice ID.

brand: Optional[str]

Card brand (visa, mastercard, etc.).

last4: Optional[str]

Last 4 digits of card.

class TopupStatusResponse: …
payment_intent_id: str
status: Literal["completed", "pending"]
One of the following:
"completed"
"pending"

AI GatewayBillingTopupConfig

Get auto top-up configuration
ai_gateway.billing.topup.config.get(ConfigGetParams**kwargs) -> ConfigGetResponse
GET/accounts/{account_id}/ai-gateway/billing/topup/config
Set auto top-up configuration
ai_gateway.billing.topup.config.create(ConfigCreateParams**kwargs) -> ConfigCreateResponse
POST/accounts/{account_id}/ai-gateway/billing/topup/config
Delete auto top-up configuration
ai_gateway.billing.topup.config.delete(ConfigDeleteParams**kwargs) -> object
DELETE/accounts/{account_id}/ai-gateway/billing/topup/config
ModelsExpand Collapse
class ConfigGetResponse: …
amount: Optional[float]
threshold: Optional[float]
disabled_reason: Optional[str]
error: Optional[str]
last_failed_at: Optional[float]
class ConfigCreateResponse: …
amount: float
threshold: float

AI GatewayBillingSpending Limit

Get spending limit (deprecated)
ai_gateway.billing.spending_limit.get(SpendingLimitGetParams**kwargs) -> SpendingLimitGetResponse
GET/accounts/{account_id}/ai-gateway/billing/spending-limit
Set spending limit (deprecated)
Deprecated
ai_gateway.billing.spending_limit.create(SpendingLimitCreateParams**kwargs) -> object
POST/accounts/{account_id}/ai-gateway/billing/spending-limit
Delete spending limit (deprecated)
ai_gateway.billing.spending_limit.delete(SpendingLimitDeleteParams**kwargs) -> object
DELETE/accounts/{account_id}/ai-gateway/billing/spending-limit
ModelsExpand Collapse
class SpendingLimitGetResponse: …
config: Config
amount: Optional[float]
duration: Optional[str]
strategy: Optional[str]
enabled: bool