# AI Gateway ## List Gateways `ai_gateway.list(AIGatewayListParams**kwargs) -> SyncV4PagePaginationArray[AIGatewayListResponse]` **get** `/accounts/{account_id}/ai-gateway/gateways` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `account_id: str` - `page: Optional[int]` - `per_page: Optional[int]` - `search: Optional[str]` Search by id ### Returns - `class AIGatewayListResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.ai_gateway.list( account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", ) page = page.result[0] print(page.id) ``` #### Response ```json { "result": [ { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true } ], "success": true } ``` ## Fetch a Gateway `ai_gateway.get(strid, AIGatewayGetParams**kwargs) -> AIGatewayGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `account_id: str` - `id: str` gateway id ### Returns - `class AIGatewayGetResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) ai_gateway = client.ai_gateway.get( id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", ) print(ai_gateway.id) ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` ## Create a new Gateway `ai_gateway.create(AIGatewayCreateParams**kwargs) -> AIGatewayCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways` Creates a new AI Gateway. ### Parameters - `account_id: str` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### Returns - `class AIGatewayCreateResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) ai_gateway = client.ai_gateway.create( account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", id="my-gateway", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, rate_limiting_interval=0, rate_limiting_limit=0, ) print(ai_gateway.id) ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` ## Update a Gateway `ai_gateway.update(strid, AIGatewayUpdateParams**kwargs) -> AIGatewayUpdateResponse` **put** `/accounts/{account_id}/ai-gateway/gateways/{id}` Updates an existing AI Gateway dataset. ### Parameters - `account_id: str` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: SequenceNotStr[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: Iterable[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: SequenceNotStr[str]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[Iterable[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: Iterable[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### Returns - `class AIGatewayUpdateResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) ai_gateway = client.ai_gateway.update( id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", cache_invalidate_on_update=True, cache_ttl=0, collect_logs=True, rate_limiting_interval=0, rate_limiting_limit=0, ) print(ai_gateway.id) ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` ## Delete a Gateway `ai_gateway.delete(strid, AIGatewayDeleteParams**kwargs) -> AIGatewayDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{id}` Deletes an AI Gateway dataset. ### Parameters - `account_id: str` - `id: str` gateway id ### Returns - `class AIGatewayDeleteResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) ai_gateway = client.ai_gateway.delete( id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", ) print(ai_gateway.id) ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ``` ## Domain Types ### AI Gateway List Response - `class AIGatewayListResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### AI Gateway Get Response - `class AIGatewayGetResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### AI Gateway Create Response - `class AIGatewayCreateResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### AI Gateway Update Response - `class AIGatewayUpdateResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` ### AI Gateway Delete Response - `class AIGatewayDeleteResponse: …` - `id: str` gateway id - `cache_invalidate_on_update: bool` - `cache_ttl: Optional[int]` - `collect_logs: bool` - `created_at: datetime` - `modified_at: datetime` - `rate_limiting_interval: Optional[int]` - `rate_limiting_limit: Optional[int]` - `authentication: Optional[bool]` - `dlp: Optional[DLP]` - `class DLPUnionMember0: …` - `action: Literal["BLOCK", "FLAG"]` - `"BLOCK"` - `"FLAG"` - `enabled: bool` - `profiles: List[str]` - `class DLPUnionMember1: …` - `enabled: bool` - `policies: List[DLPUnionMember1Policy]` - `id: str` - `action: Literal["FLAG", "BLOCK"]` - `"FLAG"` - `"BLOCK"` - `check: List[Literal["REQUEST", "RESPONSE"]]` - `"REQUEST"` - `"RESPONSE"` - `enabled: bool` - `profiles: List[str]` - `is_default: Optional[bool]` - `log_management: Optional[int]` - `log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]]` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush: Optional[bool]` - `logpush_public_key: Optional[str]` - `otel: Optional[List[Otel]]` - `authorization: str` - `headers: Dict[str, str]` - `url: str` - `content_type: Optional[Literal["json", "protobuf"]]` - `"json"` - `"protobuf"` - `rate_limiting_technique: Optional[Literal["fixed", "sliding"]]` - `"fixed"` - `"sliding"` - `retry_backoff: Optional[Literal["constant", "linear", "exponential"]]` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay: Optional[int]` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts: Optional[int]` Maximum number of retry attempts for failed requests (1-5) - `store_id: Optional[str]` - `stripe: Optional[Stripe]` - `authorization: str` - `usage_events: List[StripeUsageEvent]` - `payload: str` - `workers_ai_billing_mode: Optional[Literal["postpaid"]]` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr: Optional[bool]` # Evaluation Types ## List Evaluators `ai_gateway.evaluation_types.list(EvaluationTypeListParams**kwargs) -> SyncV4PagePaginationArray[EvaluationTypeListResponse]` **get** `/accounts/{account_id}/ai-gateway/evaluation-types` List Evaluators ### Parameters - `account_id: str` - `order_by: Optional[str]` - `order_by_direction: Optional[Literal["asc", "desc"]]` - `"asc"` - `"desc"` - `page: Optional[int]` - `per_page: Optional[int]` ### Returns - `class EvaluationTypeListResponse: …` - `id: str` - `created_at: datetime` - `description: str` - `enable: bool` - `mandatory: bool` - `modified_at: datetime` - `name: str` - `type: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.ai_gateway.evaluation_types.list( account_id="0d37909e38d3e99c29fa2cd343ac421a", ) page = page.result[0] print(page.id) ``` #### Response ```json { "result": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "description": "description", "enable": true, "mandatory": true, "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "type": "type" } ], "result_info": { "count": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` ## Domain Types ### Evaluation Type List Response - `class EvaluationTypeListResponse: …` - `id: str` - `created_at: datetime` - `description: str` - `enable: bool` - `mandatory: bool` - `modified_at: datetime` - `name: str` - `type: str` # Logs ## List Gateway Logs `ai_gateway.logs.list(strgateway_id, LogListParams**kwargs) -> SyncV4PagePaginationArray[LogListResponse]` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs` List Gateway Logs ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `cached: Optional[bool]` - `direction: Optional[Literal["asc", "desc"]]` - `"asc"` - `"desc"` - `end_date: Optional[Union[str, datetime]]` - `feedback: Optional[Literal[0, 1]]` - `0` - `1` - `filters: Optional[Iterable[Filter]]` - `key: Literal["id", "created_at", "request_content_type", 20 more]` - `"id"` - `"created_at"` - `"request_content_type"` - `"response_content_type"` - `"request_type"` - `"success"` - `"cached"` - `"provider"` - `"model"` - `"model_type"` - `"cost"` - `"tokens"` - `"tokens_in"` - `"tokens_out"` - `"duration"` - `"feedback"` - `"event_id"` - `"metadata.key"` - `"metadata.value"` - `"authentication"` - `"wholesale"` - `"compatibilityMode"` - `"dlp_action"` - `operator: Literal["eq", "neq", "contains", 2 more]` - `"eq"` - `"neq"` - `"contains"` - `"lt"` - `"gt"` - `value: SequenceNotStr[Union[Optional[str], float, bool]]` - `Optional[str]` - `float` - `bool` - `max_cost: Optional[float]` - `max_duration: Optional[float]` - `max_tokens_in: Optional[float]` - `max_tokens_out: Optional[float]` - `max_total_tokens: Optional[float]` - `meta_info: Optional[bool]` - `min_cost: Optional[float]` - `min_duration: Optional[float]` - `min_tokens_in: Optional[float]` - `min_tokens_out: Optional[float]` - `min_total_tokens: Optional[float]` - `model: Optional[str]` - `model_type: Optional[str]` - `order_by: Optional[Literal["created_at", "provider", "model", 3 more]]` - `"created_at"` - `"provider"` - `"model"` - `"model_type"` - `"success"` - `"cached"` - `order_by_direction: Optional[Literal["asc", "desc"]]` - `"asc"` - `"desc"` - `page: Optional[int]` - `per_page: Optional[int]` - `provider: Optional[str]` - `request_content_type: Optional[str]` - `response_content_type: Optional[str]` - `search: Optional[str]` - `start_date: Optional[Union[str, datetime]]` - `success: Optional[bool]` ### Returns - `class LogListResponse: …` - `id: str` - `cached: bool` - `created_at: datetime` - `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]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.ai_gateway.logs.list( gateway_id="my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) page = page.result[0] print(page.id) ``` #### Response ```json { "result": [ { "id": "id", "cached": true, "created_at": "2019-12-27T18:11:19.117Z", "duration": 0, "model": "model", "path": "path", "provider": "provider", "success": true, "tokens_in": 0, "tokens_out": 0, "cost": 0, "custom_cost": true, "metadata": "metadata", "model_type": "model_type", "request_content_type": "request_content_type", "request_type": "request_type", "response_content_type": "response_content_type", "status_code": 0, "step": 0 } ], "result_info": { "count": 0, "max_cost": 0, "max_duration": 0, "max_tokens_in": 0, "max_tokens_out": 0, "max_total_tokens": 0, "min_cost": 0, "min_duration": 0, "min_tokens_in": 0, "min_tokens_out": 0, "min_total_tokens": 0, "page": 0, "per_page": 0, "total_count": 0 }, "success": true } ``` ## Get Gateway Log Detail `ai_gateway.logs.get(strid, LogGetParams**kwargs) -> LogGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}` Retrieves detailed information for a specific AI Gateway log entry. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` ### Returns - `class LogGetResponse: …` - `id: str` - `cached: bool` - `created_at: datetime` - `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]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) log = client.ai_gateway.logs.get( id="id", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="my-gateway", ) print(log.id) ``` #### Response ```json { "result": { "id": "id", "cached": true, "created_at": "2019-12-27T18:11:19.117Z", "duration": 0, "model": "model", "path": "path", "provider": "provider", "success": true, "tokens_in": 0, "tokens_out": 0, "cost": 0, "custom_cost": true, "metadata": "metadata", "model_type": "model_type", "request_content_type": "request_content_type", "request_head": "request_head", "request_head_complete": true, "request_size": 0, "request_type": "request_type", "response_content_type": "response_content_type", "response_head": "response_head", "response_head_complete": true, "response_size": 0, "status_code": 0, "step": 0 }, "success": true } ``` ## Patch Gateway Log `ai_gateway.logs.edit(strid, LogEditParams**kwargs) -> object` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}` Updates metadata for an AI Gateway log entry. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` - `feedback: Optional[float]` - `metadata: Optional[Dict[str, Union[str, float, bool]]]` - `str` - `float` - `bool` - `score: Optional[float]` ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.logs.edit( id="id", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="my-gateway", ) print(response) ``` #### Response ```json { "result": {}, "success": true } ``` ## Delete Gateway Logs `ai_gateway.logs.delete(strgateway_id, LogDeleteParams**kwargs) -> LogDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs` Delete Gateway Logs ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `filters: Optional[Iterable[Filter]]` - `key: Literal["id", "created_at", "request_content_type", 20 more]` - `"id"` - `"created_at"` - `"request_content_type"` - `"response_content_type"` - `"request_type"` - `"success"` - `"cached"` - `"provider"` - `"model"` - `"model_type"` - `"cost"` - `"tokens"` - `"tokens_in"` - `"tokens_out"` - `"duration"` - `"feedback"` - `"event_id"` - `"metadata.key"` - `"metadata.value"` - `"authentication"` - `"wholesale"` - `"compatibilityMode"` - `"dlp_action"` - `operator: Literal["eq", "neq", "contains", 2 more]` - `"eq"` - `"neq"` - `"contains"` - `"lt"` - `"gt"` - `value: SequenceNotStr[Union[Optional[str], float, bool]]` - `Optional[str]` - `float` - `bool` - `limit: Optional[int]` - `order_by: Optional[Literal["created_at", "provider", "model", 8 more]]` - `"created_at"` - `"provider"` - `"model"` - `"model_type"` - `"success"` - `"cached"` - `"cost"` - `"tokens_in"` - `"tokens_out"` - `"duration"` - `"feedback"` - `order_by_direction: Optional[Literal["asc", "desc"]]` - `"asc"` - `"desc"` ### Returns - `class LogDeleteResponse: …` - `success: bool` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) log = client.ai_gateway.logs.delete( gateway_id="my-gateway", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) print(log.success) ``` #### Response ```json { "success": true } ``` ## Get Gateway Log Request `ai_gateway.logs.request(strid, LogRequestParams**kwargs) -> object` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/request` Retrieves the original request payload for an AI Gateway log entry. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.logs.request( id="id", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="my-gateway", ) print(response) ``` #### Response ```json {} ``` ## Get Gateway Log Response `ai_gateway.logs.response(strid, LogResponseParams**kwargs) -> object` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/response` Retrieves the response payload for an AI Gateway log entry. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` ### Returns - `object` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.logs.response( id="id", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="my-gateway", ) print(response) ``` #### Response ```json {} ``` ## Domain Types ### Log List Response - `class LogListResponse: …` - `id: str` - `cached: bool` - `created_at: datetime` - `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]` ### Log Get Response - `class LogGetResponse: …` - `id: str` - `cached: bool` - `created_at: datetime` - `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]` ### Log Delete Response - `class LogDeleteResponse: …` - `success: bool` # Datasets ## List Datasets `ai_gateway.datasets.list(strgateway_id, DatasetListParams**kwargs) -> SyncV4PagePaginationArray[DatasetListResponse]` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `enable: Optional[bool]` - `name: Optional[str]` - `page: Optional[int]` - `per_page: Optional[int]` - `search: Optional[str]` Search by id, name, filters ### Returns - `class DatasetListResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.ai_gateway.datasets.list( gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", ) page = page.result[0] print(page.id) ``` #### Response ```json { "result": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "success": true } ``` ## Fetch a Dataset `ai_gateway.datasets.get(strid, DatasetGetParams**kwargs) -> DatasetGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` ### Returns - `class DatasetGetResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dataset = client.ai_gateway.datasets.get( id="id", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", gateway_id="my-gateway", ) print(dataset.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Create a new Dataset `ai_gateway.datasets.create(strgateway_id, DatasetCreateParams**kwargs) -> DatasetCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets` Creates a new AI Gateway. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `enable: bool` - `filters: Iterable[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: SequenceNotStr[Union[str, float, bool]]` - `str` - `float` - `bool` - `name: str` ### Returns - `class DatasetCreateResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dataset = client.ai_gateway.datasets.create( gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", enable=True, filters=[{ "key": "created_at", "operator": "eq", "value": ["string"], }], name="name", ) print(dataset.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Update a Dataset `ai_gateway.datasets.update(strid, DatasetUpdateParams**kwargs) -> DatasetUpdateResponse` **put** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Updates an existing AI Gateway dataset. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` - `enable: bool` - `filters: Iterable[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: SequenceNotStr[Union[str, float, bool]]` - `str` - `float` - `bool` - `name: str` ### Returns - `class DatasetUpdateResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dataset = client.ai_gateway.datasets.update( id="id", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", gateway_id="my-gateway", enable=True, filters=[{ "key": "created_at", "operator": "eq", "value": ["string"], }], name="name", ) print(dataset.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Delete a Dataset `ai_gateway.datasets.delete(strid, DatasetDeleteParams**kwargs) -> DatasetDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Deletes an AI Gateway dataset. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` ### Returns - `class DatasetDeleteResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dataset = client.ai_gateway.datasets.delete( id="id", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", gateway_id="my-gateway", ) print(dataset.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Domain Types ### Dataset List Response - `class DatasetListResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Dataset Get Response - `class DatasetGetResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Dataset Create Response - `class DatasetCreateResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Dataset Update Response - `class DatasetUpdateResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` ### Dataset Delete Response - `class DatasetDeleteResponse: …` - `id: str` - `created_at: datetime` - `enable: bool` - `filters: List[Filter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` # Evaluations ## List Evaluations `ai_gateway.evaluations.list(strgateway_id, EvaluationListParams**kwargs) -> SyncV4PagePaginationArray[EvaluationListResponse]` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `name: Optional[str]` - `page: Optional[int]` - `per_page: Optional[int]` - `processed: Optional[bool]` - `search: Optional[str]` Search by id, name ### Returns - `class EvaluationListResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.ai_gateway.evaluations.list( gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", ) page = page.result[0] print(page.id) ``` #### Response ```json { "result": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 } ], "success": true } ``` ## Fetch a Evaluation `ai_gateway.evaluations.get(strid, EvaluationGetParams**kwargs) -> EvaluationGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` ### Returns - `class EvaluationGetResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) evaluation = client.ai_gateway.evaluations.get( id="id", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", gateway_id="my-gateway", ) print(evaluation.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Create a new Evaluation `ai_gateway.evaluations.create(strgateway_id, EvaluationCreateParams**kwargs) -> EvaluationCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Creates a new AI Gateway. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `dataset_ids: SequenceNotStr[str]` - `evaluation_type_ids: SequenceNotStr[str]` - `name: str` ### Returns - `class EvaluationCreateResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) evaluation = client.ai_gateway.evaluations.create( gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", dataset_ids=["string"], evaluation_type_ids=["string"], name="name", ) print(evaluation.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Delete a Evaluation `ai_gateway.evaluations.delete(strid, EvaluationDeleteParams**kwargs) -> EvaluationDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Deletes an AI Gateway dataset. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `id: str` ### Returns - `class EvaluationDeleteResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) evaluation = client.ai_gateway.evaluations.delete( id="id", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", gateway_id="my-gateway", ) print(evaluation.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "datasets": [ { "id": "id", "account_id": "account_id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "enable": true, "filters": [ { "key": "created_at", "operator": "eq", "value": [ "string" ] } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" } ], "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "processed": true, "results": [ { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "evaluation_id": "evaluation_id", "evaluation_type_id": "evaluation_type_id", "modified_at": "2019-12-27T18:11:19.117Z", "result": "result", "status": 0, "status_description": "status_description", "total_logs": 0 } ], "total_logs": 0 }, "success": true } ``` ## Domain Types ### Evaluation List Response - `class EvaluationListResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` ### Evaluation Get Response - `class EvaluationGetResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` ### Evaluation Create Response - `class EvaluationCreateResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` ### Evaluation Delete Response - `class EvaluationDeleteResponse: …` - `id: str` - `created_at: datetime` - `datasets: List[Dataset]` - `id: str` - `account_id: str` - `account_tag: str` - `created_at: datetime` - `enable: bool` - `filters: List[DatasetFilter]` - `key: Literal["created_at", "request_content_type", "response_content_type", 10 more]` - `"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"]` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: List[Union[str, float, bool]]` - `str` - `float` - `bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `gateway_id: str` gateway id - `modified_at: datetime` - `name: str` - `processed: bool` - `results: List[Result]` - `id: str` - `created_at: datetime` - `evaluation_id: str` - `evaluation_type_id: str` - `modified_at: datetime` - `result: str` - `status: float` - `status_description: str` - `total_logs: float` - `total_logs: float` # Dynamic Routing ## List all AI Gateway Dynamic Routes. `ai_gateway.dynamic_routing.list(strgateway_id, DynamicRoutingListParams**kwargs) -> DynamicRoutingListResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` List all AI Gateway Dynamic Routes. ### Parameters - `account_id: str` - `gateway_id: str` ### Returns - `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` - `deployment: DataRouteDeployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[DataRouteElement]` - `class DataRouteElementUnionMember0: …` - `id: str` - `outputs: DataRouteElementUnionMember0Outputs` - `next: DataRouteElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class DataRouteElementUnionMember2: …` - `id: str` - `outputs: Dict[str, DataRouteElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class DataRouteElementUnionMember5: …` - `id: str` - `outputs: Dict[str, DataRouteElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: DataRouteVersion` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` - `success: bool` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dynamic_routings = client.ai_gateway.dynamic_routing.list( gateway_id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", ) print(dynamic_routings.data) ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "routes": [ { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } } ] }, "success": true } ``` ## Get an AI Gateway Dynamic Route. `ai_gateway.dynamic_routing.get(strid, DynamicRoutingGetParams**kwargs) -> DynamicRoutingGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Get an AI Gateway Dynamic Route. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` ### Returns - `class DynamicRoutingGetResponse: …` - `id: str` - `created_at: datetime` - `deployment: Deployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: Version` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dynamic_routing = client.ai_gateway.dynamic_routing.get( id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", ) print(dynamic_routing.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Create a new AI Gateway Dynamic Route. `ai_gateway.dynamic_routing.create(strgateway_id, DynamicRoutingCreateParams**kwargs) -> DynamicRoutingCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` Create a new AI Gateway Dynamic Route. ### Parameters - `account_id: str` - `gateway_id: str` - `elements: Iterable[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `name: str` ### Returns - `class DynamicRoutingCreateResponse: …` - `id: str` - `created_at: datetime` - `deployment: Deployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: Version` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dynamic_routing = client.ai_gateway.dynamic_routing.create( gateway_id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", elements=[{ "id": "id", "outputs": { "next": { "element_id": "elementId" } }, "type": "start", }], name="name", ) print(dynamic_routing.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Update an AI Gateway Dynamic Route. `ai_gateway.dynamic_routing.update(strid, DynamicRoutingUpdateParams**kwargs) -> DynamicRoutingUpdateResponse` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Update an AI Gateway Dynamic Route. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` - `name: str` ### Returns - `class DynamicRoutingUpdateResponse: …` - `route: Route` - `id: str` - `account_tag: str` - `created_at: datetime` - `deployment: RouteDeployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[RouteElement]` - `class RouteElementUnionMember0: …` - `id: str` - `outputs: RouteElementUnionMember0Outputs` - `next: RouteElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class RouteElementUnionMember2: …` - `id: str` - `outputs: Dict[str, RouteElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class RouteElementUnionMember5: …` - `id: str` - `outputs: Dict[str, RouteElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: RouteVersion` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` - `success: bool` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dynamic_routing = client.ai_gateway.dynamic_routing.update( id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", name="Route Name", ) print(dynamic_routing.route) ``` #### Response ```json { "route": { "id": "id", "account_tag": "account_tag", "created_at": "2019-12-27T18:11:19.117Z", "deployment": { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" }, "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version": { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } }, "success": true } ``` ## Delete an AI Gateway Dynamic Route. `ai_gateway.dynamic_routing.delete(strid, DynamicRoutingDeleteParams**kwargs) -> DynamicRoutingDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Delete an AI Gateway Dynamic Route. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` ### Returns - `class DynamicRoutingDeleteResponse: …` - `id: str` - `created_at: datetime` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) dynamic_routing = client.ai_gateway.dynamic_routing.delete( id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", ) print(dynamic_routing.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway 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` List all AI Gateway Dynamic Route Deployments. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` ### Returns - `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` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.dynamic_routing.list_deployments( id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", ) print(response.data) ``` #### Response ```json { "data": { "deployments": [ { "created_at": "created_at", "deployment_id": "deployment_id", "version_id": "version_id" } ], "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0 }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Deployment. `ai_gateway.dynamic_routing.create_deployment(strid, DynamicRoutingCreateDeploymentParams**kwargs) -> DynamicRoutingCreateDeploymentResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` Create a new AI Gateway Dynamic Route Deployment. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` - `version_id: str` ### Returns - `class DynamicRoutingCreateDeploymentResponse: …` - `id: str` - `created_at: datetime` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.dynamic_routing.create_deployment( id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", version_id="54442216", ) print(response.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## List all AI Gateway 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` List all AI Gateway Dynamic Route Versions. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` ### Returns - `class DynamicRoutingListVersionsResponse: …` - `data: Data` - `order_by: str` - `order_by_direction: str` - `page: float` - `per_page: float` - `versions: List[DataVersion]` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` - `success: bool` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.dynamic_routing.list_versions( id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", ) print(response.data) ``` #### Response ```json { "data": { "order_by": "order_by", "order_by_direction": "order_by_direction", "page": 0, "per_page": 0, "versions": [ { "active": "true", "created_at": "created_at", "data": "data", "version_id": "version_id" } ] }, "success": true } ``` ## Create a new AI Gateway 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` Create a new AI Gateway Dynamic Route Version. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` - `elements: Iterable[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` ### Returns - `class DynamicRoutingCreateVersionResponse: …` - `id: str` - `created_at: datetime` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.dynamic_routing.create_version( id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", elements=[{ "id": "id", "outputs": { "next": { "element_id": "elementId" } }, "type": "start", }], ) print(response.id) ``` #### Response ```json { "result": { "id": "id", "created_at": "2019-12-27T18:11:19.117Z", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name" }, "success": true } ``` ## Get an AI Gateway 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}` Get an AI Gateway Dynamic Route Version. ### Parameters - `account_id: str` - `gateway_id: str` - `id: str` - `version_id: str` ### Returns - `class DynamicRoutingGetVersionResponse: …` - `id: str` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version_id: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.ai_gateway.dynamic_routing.get_version( version_id="54442216", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="54442216", id="54442216", ) print(response.id) ``` #### Response ```json { "result": { "id": "id", "active": "true", "created_at": "created_at", "data": "data", "elements": [ { "id": "id", "outputs": { "next": { "elementId": "elementId" } }, "type": "start" } ], "gateway_id": "gateway_id", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "version_id": "version_id" }, "success": true } ``` ## Domain Types ### Dynamic Routing List Response - `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` - `deployment: DataRouteDeployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[DataRouteElement]` - `class DataRouteElementUnionMember0: …` - `id: str` - `outputs: DataRouteElementUnionMember0Outputs` - `next: DataRouteElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class DataRouteElementUnionMember2: …` - `id: str` - `outputs: Dict[str, DataRouteElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class DataRouteElementUnionMember5: …` - `id: str` - `outputs: Dict[str, DataRouteElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: DataRouteVersion` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` - `success: bool` ### Dynamic Routing Get Response - `class DynamicRoutingGetResponse: …` - `id: str` - `created_at: datetime` - `deployment: Deployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: Version` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` ### Dynamic Routing Create Response - `class DynamicRoutingCreateResponse: …` - `id: str` - `created_at: datetime` - `deployment: Deployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: Version` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` ### Dynamic Routing Update Response - `class DynamicRoutingUpdateResponse: …` - `route: Route` - `id: str` - `account_tag: str` - `created_at: datetime` - `deployment: RouteDeployment` - `created_at: str` - `deployment_id: str` - `version_id: str` - `elements: List[RouteElement]` - `class RouteElementUnionMember0: …` - `id: str` - `outputs: RouteElementUnionMember0Outputs` - `next: RouteElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class RouteElementUnionMember2: …` - `id: str` - `outputs: Dict[str, RouteElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class RouteElementUnionMember5: …` - `id: str` - `outputs: Dict[str, RouteElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version: RouteVersion` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` - `success: bool` ### Dynamic Routing Delete Response - `class DynamicRoutingDeleteResponse: …` - `id: str` - `created_at: datetime` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` ### Dynamic Routing List Deployments Response - `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` ### Dynamic Routing Create Deployment Response - `class DynamicRoutingCreateDeploymentResponse: …` - `id: str` - `created_at: datetime` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` ### Dynamic Routing List Versions Response - `class DynamicRoutingListVersionsResponse: …` - `data: Data` - `order_by: str` - `order_by_direction: str` - `page: float` - `per_page: float` - `versions: List[DataVersion]` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `version_id: str` - `success: bool` ### Dynamic Routing Create Version Response - `class DynamicRoutingCreateVersionResponse: …` - `id: str` - `created_at: datetime` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` ### Dynamic Routing Get Version Response - `class DynamicRoutingGetVersionResponse: …` - `id: str` - `active: Literal["true", "false"]` - `"true"` - `"false"` - `created_at: str` - `data: str` - `elements: List[Element]` - `class ElementUnionMember0: …` - `id: str` - `outputs: ElementUnionMember0Outputs` - `next: ElementUnionMember0OutputsNext` - `element_id: str` - `type: Literal["start"]` - `"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"]` - `"conditional"` - `class ElementUnionMember2: …` - `id: str` - `outputs: Dict[str, ElementUnionMember2Outputs]` - `element_id: str` - `type: Literal["percentage"]` - `"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"]` - `"count"` - `"cost"` - `window: float` - `type: Literal["rate"]` - `"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"]` - `"model"` - `class ElementUnionMember5: …` - `id: str` - `outputs: Dict[str, ElementUnionMember5Outputs]` - `element_id: str` - `type: Literal["end"]` - `"end"` - `gateway_id: str` - `modified_at: datetime` - `name: str` - `version_id: str` # Provider Configs ## List Provider Configs `ai_gateway.provider_configs.list(strgateway_id, ProviderConfigListParams**kwargs) -> SyncV4PagePaginationArray[ProviderConfigListResponse]` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `page: Optional[int]` - `per_page: Optional[int]` ### Returns - `class ProviderConfigListResponse: …` - `id: str` - `alias: str` - `default_config: bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `provider_slug: str` - `secret_id: str` - `secret_preview: str` - `rate_limit: Optional[float]` - `rate_limit_period: Optional[float]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.ai_gateway.provider_configs.list( gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", ) page = page.result[0] print(page.id) ``` #### Response ```json { "result": [ { "id": "id", "alias": "alias", "default_config": true, "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "provider_slug": "provider_slug", "secret_id": "secret_id", "secret_preview": "secret_preview", "rate_limit": 0, "rate_limit_period": 0 } ], "success": true } ``` ## Create a new Provider Configs `ai_gateway.provider_configs.create(strgateway_id, ProviderConfigCreateParams**kwargs) -> ProviderConfigCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs` Creates a new AI Gateway. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `alias: str` - `default_config: bool` - `provider_slug: str` - `secret: str` - `secret_id: str` - `rate_limit: Optional[float]` - `rate_limit_period: Optional[float]` ### Returns - `class ProviderConfigCreateResponse: …` - `id: str` - `alias: str` - `default_config: bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `provider_slug: str` - `secret_id: str` - `secret_preview: str` - `rate_limit: Optional[float]` - `rate_limit_period: Optional[float]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) provider_config = client.ai_gateway.provider_configs.create( gateway_id="my-gateway", account_id="3ebbcb006d4d46d7bb6a8c7f14676cb0", alias="alias", default_config=True, provider_slug="provider_slug", secret="secret", secret_id="secret_id", ) print(provider_config.id) ``` #### Response ```json { "result": { "id": "id", "alias": "alias", "default_config": true, "gateway_id": "my-gateway", "modified_at": "2019-12-27T18:11:19.117Z", "provider_slug": "provider_slug", "secret_id": "secret_id", "secret_preview": "secret_preview", "rate_limit": 0, "rate_limit_period": 0 }, "success": true } ``` ## Domain Types ### Provider Config List Response - `class ProviderConfigListResponse: …` - `id: str` - `alias: str` - `default_config: bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `provider_slug: str` - `secret_id: str` - `secret_preview: str` - `rate_limit: Optional[float]` - `rate_limit_period: Optional[float]` ### Provider Config Create Response - `class ProviderConfigCreateResponse: …` - `id: str` - `alias: str` - `default_config: bool` - `gateway_id: str` gateway id - `modified_at: datetime` - `provider_slug: str` - `secret_id: str` - `secret_preview: str` - `rate_limit: Optional[float]` - `rate_limit_period: Optional[float]` # URLs ## Get Gateway URL `ai_gateway.urls.get(strprovider, URLGetParams**kwargs) -> URLGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}` Retrieves the endpoint URL for an AI Gateway. ### Parameters - `account_id: str` - `gateway_id: str` gateway id - `provider: str` ### Returns - `str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) url = client.ai_gateway.urls.get( provider="workers-ai", account_id="0d37909e38d3e99c29fa2cd343ac421a", gateway_id="my-gateway", ) print(url) ``` #### Response ```json { "result": "result", "success": true } ``` ## Domain Types ### URL Get Response - `str`