# AI Gateway ## List Gateways `client.aiGateway.list(AIGatewayListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/gateways` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `params: AIGatewayListParams` - `account_id: string` Path param - `page?: number` Query param - `per_page?: number` Query param - `search?: string` Query param: Search by id ### Returns - `AIGatewayListResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const aiGatewayListResponse of client.aiGateway.list({ account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', })) { console.log(aiGatewayListResponse.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 `client.aiGateway.get(stringid, AIGatewayGetParamsparams, RequestOptionsoptions?): AIGatewayGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `id: string` gateway id - `params: AIGatewayGetParams` - `account_id: string` ### Returns - `AIGatewayGetResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const aiGateway = await client.aiGateway.get('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(aiGateway.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 `client.aiGateway.create(AIGatewayCreateParamsparams, RequestOptionsoptions?): AIGatewayCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways` Creates a new AI Gateway. ### Parameters - `params: AIGatewayCreateParams` - `account_id: string` Path param - `id: string` Body param: gateway id - `cache_invalidate_on_update: boolean` Body param - `cache_ttl: number | null` Body param - `collect_logs: boolean` Body param - `rate_limiting_interval: number | null` Body param - `rate_limiting_limit: number | null` Body param - `authentication?: boolean` Body param - `log_management?: number | null` Body param - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` Body param - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` Body param - `logpush_public_key?: string | null` Body param - `rate_limiting_technique?: "fixed" | "sliding" | null` Body param - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Body param: Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Body param: Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Body param: Maximum number of retry attempts for failed requests (1-5) - `workers_ai_billing_mode?: "postpaid"` Body param: Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` Body param ### Returns - `AIGatewayCreateResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const aiGateway = await client.aiGateway.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, }); console.log(aiGateway.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 `client.aiGateway.update(stringid, AIGatewayUpdateParamsparams, RequestOptionsoptions?): AIGatewayUpdateResponse` **put** `/accounts/{account_id}/ai-gateway/gateways/{id}` Updates an existing AI Gateway dataset. ### Parameters - `id: string` gateway id - `params: AIGatewayUpdateParams` - `account_id: string` Path param - `cache_invalidate_on_update: boolean` Body param - `cache_ttl: number | null` Body param - `collect_logs: boolean` Body param - `rate_limiting_interval: number | null` Body param - `rate_limiting_limit: number | null` Body param - `authentication?: boolean` Body param - `dlp?: UnionMember0 | UnionMember1` Body param - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `log_management?: number | null` Body param - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` Body param - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` Body param - `logpush_public_key?: string | null` Body param - `otel?: Array | null` Body param - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` Body param - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Body param: Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Body param: Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Body param: Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` Body param - `stripe?: Stripe | null` Body param - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Body param: Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` Body param ### Returns - `AIGatewayUpdateResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const aiGateway = await client.aiGateway.update('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', cache_invalidate_on_update: true, cache_ttl: 0, collect_logs: true, rate_limiting_interval: 0, rate_limiting_limit: 0, }); console.log(aiGateway.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 `client.aiGateway.delete(stringid, AIGatewayDeleteParamsparams, RequestOptionsoptions?): AIGatewayDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{id}` Deletes an AI Gateway dataset. ### Parameters - `id: string` gateway id - `params: AIGatewayDeleteParams` - `account_id: string` ### Returns - `AIGatewayDeleteResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const aiGateway = await client.aiGateway.delete('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(aiGateway.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 - `AIGatewayListResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### AI Gateway Get Response - `AIGatewayGetResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### AI Gateway Create Response - `AIGatewayCreateResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### AI Gateway Update Response - `AIGatewayUpdateResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### AI Gateway Delete Response - `AIGatewayDeleteResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` # Evaluation Types ## List Evaluators `client.aiGateway.evaluationTypes.list(EvaluationTypeListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/evaluation-types` List Evaluators ### Parameters - `params: EvaluationTypeListParams` - `account_id: string` Path param - `order_by?: string` Query param - `order_by_direction?: "asc" | "desc"` Query param - `"asc"` - `"desc"` - `page?: number` Query param - `per_page?: number` Query param ### Returns - `EvaluationTypeListResponse` - `id: string` - `created_at: string` - `description: string` - `enable: boolean` - `mandatory: boolean` - `modified_at: string` - `name: string` - `type: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const evaluationTypeListResponse of client.aiGateway.evaluationTypes.list({ account_id: '0d37909e38d3e99c29fa2cd343ac421a', })) { console.log(evaluationTypeListResponse.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 - `EvaluationTypeListResponse` - `id: string` - `created_at: string` - `description: string` - `enable: boolean` - `mandatory: boolean` - `modified_at: string` - `name: string` - `type: string` # Logs ## List Gateway Logs `client.aiGateway.logs.list(stringgatewayId, LogListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs` List Gateway Logs ### Parameters - `gatewayId: string` gateway id - `params: LogListParams` - `account_id: string` Path param - `cached?: boolean` Query param - `direction?: "asc" | "desc"` Query param - `"asc"` - `"desc"` - `end_date?: string` Query param - `feedback?: 0 | 1` Query param - `0` - `1` - `filters?: Array` Query param - `key: "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: "eq" | "neq" | "contains" | 2 more` - `"eq"` - `"neq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string | null` - `number` - `boolean` - `max_cost?: number` Query param - `max_duration?: number` Query param - `max_tokens_in?: number` Query param - `max_tokens_out?: number` Query param - `max_total_tokens?: number` Query param - `meta_info?: boolean` Query param - `min_cost?: number` Query param - `min_duration?: number` Query param - `min_tokens_in?: number` Query param - `min_tokens_out?: number` Query param - `min_total_tokens?: number` Query param - `model?: string` Query param - `model_type?: string` Query param - `order_by?: "created_at" | "provider" | "model" | 3 more` Query param - `"created_at"` - `"provider"` - `"model"` - `"model_type"` - `"success"` - `"cached"` - `order_by_direction?: "asc" | "desc"` Query param - `"asc"` - `"desc"` - `page?: number` Query param - `per_page?: number` Query param - `provider?: string` Query param - `request_content_type?: string` Query param - `response_content_type?: string` Query param - `search?: string` Query param - `start_date?: string` Query param - `success?: boolean` Query param ### Returns - `LogListResponse` - `id: string` - `cached: boolean` - `created_at: string` - `duration: number` - `model: string` - `path: string` - `provider: string` - `success: boolean` - `tokens_in: number | null` - `tokens_out: number | null` - `cost?: number` - `custom_cost?: boolean` - `metadata?: string` - `model_type?: string` - `request_content_type?: string` - `request_type?: string` - `response_content_type?: string` - `status_code?: number` - `step?: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const logListResponse of client.aiGateway.logs.list('my-gateway', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', })) { console.log(logListResponse.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 `client.aiGateway.logs.get(stringgatewayId, stringid, LogGetParamsparams, RequestOptionsoptions?): LogGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}` Retrieves detailed information for a specific AI Gateway log entry. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: LogGetParams` - `account_id: string` ### Returns - `LogGetResponse` - `id: string` - `cached: boolean` - `created_at: string` - `duration: number` - `model: string` - `path: string` - `provider: string` - `success: boolean` - `tokens_in: number | null` - `tokens_out: number | null` - `cost?: number` - `custom_cost?: boolean` - `metadata?: string` - `model_type?: string` - `request_content_type?: string` - `request_head?: string` - `request_head_complete?: boolean` - `request_size?: number` - `request_type?: string` - `response_content_type?: string` - `response_head?: string` - `response_head_complete?: boolean` - `response_size?: number` - `status_code?: number` - `step?: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const log = await client.aiGateway.logs.get('my-gateway', 'id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(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 `client.aiGateway.logs.edit(stringgatewayId, stringid, LogEditParamsparams, RequestOptionsoptions?): LogEditResponse` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}` Updates metadata for an AI Gateway log entry. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: LogEditParams` - `account_id: string` Path param - `feedback?: number | null` Body param - `metadata?: Record | null` Body param - `string` - `number` - `boolean` - `score?: number | null` Body param ### Returns - `LogEditResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.logs.edit('my-gateway', 'id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(response); ``` #### Response ```json { "result": {}, "success": true } ``` ## Delete Gateway Logs `client.aiGateway.logs.delete(stringgatewayId, LogDeleteParamsparams, RequestOptionsoptions?): LogDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs` Delete Gateway Logs ### Parameters - `gatewayId: string` gateway id - `params: LogDeleteParams` - `account_id: string` Path param - `filters?: Array` Query param - `key: "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: "eq" | "neq" | "contains" | 2 more` - `"eq"` - `"neq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string | null` - `number` - `boolean` - `limit?: number` Query param - `order_by?: "created_at" | "provider" | "model" | 8 more` Query param - `"created_at"` - `"provider"` - `"model"` - `"model_type"` - `"success"` - `"cached"` - `"cost"` - `"tokens_in"` - `"tokens_out"` - `"duration"` - `"feedback"` - `order_by_direction?: "asc" | "desc"` Query param - `"asc"` - `"desc"` ### Returns - `LogDeleteResponse` - `success: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const log = await client.aiGateway.logs.delete('my-gateway', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(log.success); ``` #### Response ```json { "success": true } ``` ## Get Gateway Log Request `client.aiGateway.logs.request(stringgatewayId, stringid, LogRequestParamsparams, RequestOptionsoptions?): LogRequestResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/request` Retrieves the original request payload for an AI Gateway log entry. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: LogRequestParams` - `account_id: string` ### Returns - `LogRequestResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.logs.request('my-gateway', 'id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(response); ``` #### Response ```json {} ``` ## Get Gateway Log Response `client.aiGateway.logs.response(stringgatewayId, stringid, LogResponseParamsparams, RequestOptionsoptions?): LogResponseResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}/response` Retrieves the response payload for an AI Gateway log entry. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: LogResponseParams` - `account_id: string` ### Returns - `LogResponseResponse = unknown` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.logs.response('my-gateway', 'id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(response); ``` #### Response ```json {} ``` ## Domain Types ### Log List Response - `LogListResponse` - `id: string` - `cached: boolean` - `created_at: string` - `duration: number` - `model: string` - `path: string` - `provider: string` - `success: boolean` - `tokens_in: number | null` - `tokens_out: number | null` - `cost?: number` - `custom_cost?: boolean` - `metadata?: string` - `model_type?: string` - `request_content_type?: string` - `request_type?: string` - `response_content_type?: string` - `status_code?: number` - `step?: number` ### Log Get Response - `LogGetResponse` - `id: string` - `cached: boolean` - `created_at: string` - `duration: number` - `model: string` - `path: string` - `provider: string` - `success: boolean` - `tokens_in: number | null` - `tokens_out: number | null` - `cost?: number` - `custom_cost?: boolean` - `metadata?: string` - `model_type?: string` - `request_content_type?: string` - `request_head?: string` - `request_head_complete?: boolean` - `request_size?: number` - `request_type?: string` - `response_content_type?: string` - `response_head?: string` - `response_head_complete?: boolean` - `response_size?: number` - `status_code?: number` - `step?: number` ### Log Edit Response - `LogEditResponse = unknown` ### Log Delete Response - `LogDeleteResponse` - `success: boolean` ### Log Request Response - `LogRequestResponse = unknown` ### Log Response Response - `LogResponseResponse = unknown` # Datasets ## List Datasets `client.aiGateway.datasets.list(stringgatewayId, DatasetListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `gatewayId: string` gateway id - `params: DatasetListParams` - `account_id: string` Path param - `enable?: boolean` Query param - `name?: string` Query param - `page?: number` Query param - `per_page?: number` Query param - `search?: string` Query param: Search by id, name, filters ### Returns - `DatasetListResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const datasetListResponse of client.aiGateway.datasets.list('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', })) { console.log(datasetListResponse.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 `client.aiGateway.datasets.get(stringgatewayId, stringid, DatasetGetParamsparams, RequestOptionsoptions?): DatasetGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: DatasetGetParams` - `account_id: string` ### Returns - `DatasetGetResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dataset = await client.aiGateway.datasets.get('my-gateway', 'id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(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 `client.aiGateway.datasets.create(stringgatewayId, DatasetCreateParamsparams, RequestOptionsoptions?): DatasetCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets` Creates a new AI Gateway. ### Parameters - `gatewayId: string` gateway id - `params: DatasetCreateParams` - `account_id: string` Path param - `enable: boolean` Body param - `filters: Array` Body param - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `name: string` Body param ### Returns - `DatasetCreateResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dataset = await client.aiGateway.datasets.create('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', enable: true, filters: [ { key: 'created_at', operator: 'eq', value: ['string'], }, ], name: 'name', }); console.log(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 `client.aiGateway.datasets.update(stringgatewayId, stringid, DatasetUpdateParamsparams, RequestOptionsoptions?): DatasetUpdateResponse` **put** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Updates an existing AI Gateway dataset. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: DatasetUpdateParams` - `account_id: string` Path param - `enable: boolean` Body param - `filters: Array` Body param - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `name: string` Body param ### Returns - `DatasetUpdateResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dataset = await client.aiGateway.datasets.update('my-gateway', 'id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', enable: true, filters: [ { key: 'created_at', operator: 'eq', value: ['string'], }, ], name: 'name', }); console.log(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 `client.aiGateway.datasets.delete(stringgatewayId, stringid, DatasetDeleteParamsparams, RequestOptionsoptions?): DatasetDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Deletes an AI Gateway dataset. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: DatasetDeleteParams` - `account_id: string` ### Returns - `DatasetDeleteResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dataset = await client.aiGateway.datasets.delete('my-gateway', 'id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(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 - `DatasetListResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Dataset Get Response - `DatasetGetResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Dataset Create Response - `DatasetCreateResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Dataset Update Response - `DatasetUpdateResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` ### Dataset Delete Response - `DatasetDeleteResponse` - `id: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` # Evaluations ## List Evaluations `client.aiGateway.evaluations.list(stringgatewayId, EvaluationListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `gatewayId: string` gateway id - `params: EvaluationListParams` - `account_id: string` Path param - `name?: string` Query param - `page?: number` Query param - `per_page?: number` Query param - `processed?: boolean` Query param - `search?: string` Query param: Search by id, name ### Returns - `EvaluationListResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const evaluationListResponse of client.aiGateway.evaluations.list('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', })) { console.log(evaluationListResponse.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 `client.aiGateway.evaluations.get(stringgatewayId, stringid, EvaluationGetParamsparams, RequestOptionsoptions?): EvaluationGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: EvaluationGetParams` - `account_id: string` ### Returns - `EvaluationGetResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const evaluation = await client.aiGateway.evaluations.get('my-gateway', 'id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(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 `client.aiGateway.evaluations.create(stringgatewayId, EvaluationCreateParamsparams, RequestOptionsoptions?): EvaluationCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations` Creates a new AI Gateway. ### Parameters - `gatewayId: string` gateway id - `params: EvaluationCreateParams` - `account_id: string` Path param - `dataset_ids: Array` Body param - `evaluation_type_ids: Array` Body param - `name: string` Body param ### Returns - `EvaluationCreateResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const evaluation = await client.aiGateway.evaluations.create('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', dataset_ids: ['string'], evaluation_type_ids: ['string'], name: 'name', }); console.log(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 `client.aiGateway.evaluations.delete(stringgatewayId, stringid, EvaluationDeleteParamsparams, RequestOptionsoptions?): EvaluationDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Deletes an AI Gateway dataset. ### Parameters - `gatewayId: string` gateway id - `id: string` - `params: EvaluationDeleteParams` - `account_id: string` ### Returns - `EvaluationDeleteResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const evaluation = await client.aiGateway.evaluations.delete('my-gateway', 'id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', }); console.log(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 - `EvaluationListResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` ### Evaluation Get Response - `EvaluationGetResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` ### Evaluation Create Response - `EvaluationCreateResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` ### Evaluation Delete Response - `EvaluationDeleteResponse` - `id: string` - `created_at: string` - `datasets: Array` - `id: string` - `account_id: string` - `account_tag: string` - `created_at: string` - `enable: boolean` - `filters: Array` - `key: "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: "eq" | "contains" | "lt" | "gt"` - `"eq"` - `"contains"` - `"lt"` - `"gt"` - `value: Array` - `string` - `number` - `boolean` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `gateway_id: string` gateway id - `modified_at: string` - `name: string` - `processed: boolean` - `results: Array` - `id: string` - `created_at: string` - `evaluation_id: string` - `evaluation_type_id: string` - `modified_at: string` - `result: string` - `status: number` - `status_description: string` - `total_logs: number` - `total_logs: number` # Dynamic Routing ## List all AI Gateway Dynamic Routes. `client.aiGateway.dynamicRouting.list(stringgatewayId, DynamicRoutingListParamsparams, RequestOptionsoptions?): DynamicRoutingListResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` List all AI Gateway Dynamic Routes. ### Parameters - `gatewayId: string` - `params: DynamicRoutingListParams` - `account_id: string` ### Returns - `DynamicRoutingListResponse` - `data: Data` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `routes: Array` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dynamicRoutings = await client.aiGateway.dynamicRouting.list('54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(dynamicRoutings.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. `client.aiGateway.dynamicRouting.get(stringgatewayId, stringid, DynamicRoutingGetParamsparams, RequestOptionsoptions?): DynamicRoutingGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Get an AI Gateway Dynamic Route. ### Parameters - `gatewayId: string` - `id: string` - `params: DynamicRoutingGetParams` - `account_id: string` ### Returns - `DynamicRoutingGetResponse` - `id: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dynamicRouting = await client.aiGateway.dynamicRouting.get('54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(dynamicRouting.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. `client.aiGateway.dynamicRouting.create(stringgatewayId, DynamicRoutingCreateParamsparams, RequestOptionsoptions?): DynamicRoutingCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes` Create a new AI Gateway Dynamic Route. ### Parameters - `gatewayId: string` - `params: DynamicRoutingCreateParams` - `account_id: string` Path param - `elements: Array` Body param - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `name: string` Body param ### Returns - `DynamicRoutingCreateResponse` - `id: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dynamicRouting = await client.aiGateway.dynamicRouting.create('54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', elements: [ { id: 'id', outputs: { next: { elementId: 'elementId' } }, type: 'start', }, ], name: 'name', }); console.log(dynamicRouting.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. `client.aiGateway.dynamicRouting.update(stringgatewayId, stringid, DynamicRoutingUpdateParamsparams, RequestOptionsoptions?): DynamicRoutingUpdateResponse` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Update an AI Gateway Dynamic Route. ### Parameters - `gatewayId: string` - `id: string` - `params: DynamicRoutingUpdateParams` - `account_id: string` Path param - `name: string` Body param ### Returns - `DynamicRoutingUpdateResponse` - `route: Route` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dynamicRouting = await client.aiGateway.dynamicRouting.update('54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', name: 'Route Name', }); console.log(dynamicRouting.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. `client.aiGateway.dynamicRouting.delete(stringgatewayId, stringid, DynamicRoutingDeleteParamsparams, RequestOptionsoptions?): DynamicRoutingDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Delete an AI Gateway Dynamic Route. ### Parameters - `gatewayId: string` - `id: string` - `params: DynamicRoutingDeleteParams` - `account_id: string` ### Returns - `DynamicRoutingDeleteResponse` - `id: string` - `created_at: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dynamicRouting = await client.aiGateway.dynamicRouting.delete('54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(dynamicRouting.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. `client.aiGateway.dynamicRouting.listDeployments(stringgatewayId, stringid, DynamicRoutingListDeploymentsParamsparams, RequestOptionsoptions?): DynamicRoutingListDeploymentsResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` List all AI Gateway Dynamic Route Deployments. ### Parameters - `gatewayId: string` - `id: string` - `params: DynamicRoutingListDeploymentsParams` - `account_id: string` ### Returns - `DynamicRoutingListDeploymentsResponse` - `data: Data` - `deployments: Array` - `created_at: string` - `deployment_id: string` - `version_id: string` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `success: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.dynamicRouting.listDeployments('54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(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. `client.aiGateway.dynamicRouting.createDeployment(stringgatewayId, stringid, DynamicRoutingCreateDeploymentParamsparams, RequestOptionsoptions?): DynamicRoutingCreateDeploymentResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` Create a new AI Gateway Dynamic Route Deployment. ### Parameters - `gatewayId: string` - `id: string` - `params: DynamicRoutingCreateDeploymentParams` - `account_id: string` Path param - `version_id: string` Body param ### Returns - `DynamicRoutingCreateDeploymentResponse` - `id: string` - `created_at: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.dynamicRouting.createDeployment('54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', version_id: '54442216', }); console.log(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. `client.aiGateway.dynamicRouting.listVersions(stringgatewayId, stringid, DynamicRoutingListVersionsParamsparams, RequestOptionsoptions?): DynamicRoutingListVersionsResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` List all AI Gateway Dynamic Route Versions. ### Parameters - `gatewayId: string` - `id: string` - `params: DynamicRoutingListVersionsParams` - `account_id: string` ### Returns - `DynamicRoutingListVersionsResponse` - `data: Data` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `versions: Array` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.dynamicRouting.listVersions('54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(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. `client.aiGateway.dynamicRouting.createVersion(stringgatewayId, stringid, DynamicRoutingCreateVersionParamsparams, RequestOptionsoptions?): DynamicRoutingCreateVersionResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` Create a new AI Gateway Dynamic Route Version. ### Parameters - `gatewayId: string` - `id: string` - `params: DynamicRoutingCreateVersionParams` - `account_id: string` Path param - `elements: Array` Body param - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` ### Returns - `DynamicRoutingCreateVersionResponse` - `id: string` - `created_at: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.dynamicRouting.createVersion('54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', elements: [ { id: 'id', outputs: { next: { elementId: 'elementId' } }, type: 'start', }, ], }); console.log(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. `client.aiGateway.dynamicRouting.getVersion(stringgatewayId, stringid, stringversionId, DynamicRoutingGetVersionParamsparams, RequestOptionsoptions?): DynamicRoutingGetVersionResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}` Get an AI Gateway Dynamic Route Version. ### Parameters - `gatewayId: string` - `id: string` - `versionId: string` - `params: DynamicRoutingGetVersionParams` - `account_id: string` ### Returns - `DynamicRoutingGetVersionResponse` - `id: string` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version_id: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.aiGateway.dynamicRouting.getVersion( '54442216', '54442216', '54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a' }, ); console.log(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 - `DynamicRoutingListResponse` - `data: Data` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `routes: Array` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Dynamic Routing Get Response - `DynamicRoutingGetResponse` - `id: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` ### Dynamic Routing Create Response - `DynamicRoutingCreateResponse` - `id: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` ### Dynamic Routing Update Response - `DynamicRoutingUpdateResponse` - `route: Route` - `id: string` - `account_tag: string` - `created_at: string` - `deployment: Deployment` - `created_at: string` - `deployment_id: string` - `version_id: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version: Version` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Dynamic Routing Delete Response - `DynamicRoutingDeleteResponse` - `id: string` - `created_at: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Dynamic Routing List Deployments Response - `DynamicRoutingListDeploymentsResponse` - `data: Data` - `deployments: Array` - `created_at: string` - `deployment_id: string` - `version_id: string` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `success: boolean` ### Dynamic Routing Create Deployment Response - `DynamicRoutingCreateDeploymentResponse` - `id: string` - `created_at: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Dynamic Routing List Versions Response - `DynamicRoutingListVersionsResponse` - `data: Data` - `order_by: string` - `order_by_direction: string` - `page: number` - `per_page: number` - `versions: Array` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `version_id: string` - `success: boolean` ### Dynamic Routing Create Version Response - `DynamicRoutingCreateVersionResponse` - `id: string` - `created_at: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` ### Dynamic Routing Get Version Response - `DynamicRoutingGetVersionResponse` - `id: string` - `active: "true" | "false"` - `"true"` - `"false"` - `created_at: string` - `data: string` - `elements: Array` - `UnionMember0` - `id: string` - `outputs: Outputs` - `next: Next` - `elementId: string` - `type: "start"` - `"start"` - `UnionMember1` - `id: string` - `outputs: Outputs` - `false: False` - `elementId: string` - `true: True` - `elementId: string` - `properties: Properties` - `conditions?: unknown` - `type: "conditional"` - `"conditional"` - `UnionMember2` - `id: string` - `outputs: Record` - `elementId: string` - `type: "percentage"` - `"percentage"` - `UnionMember3` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `key: string` - `limit: number` - `limitType: "count" | "cost"` - `"count"` - `"cost"` - `window: number` - `type: "rate"` - `"rate"` - `UnionMember4` - `id: string` - `outputs: Outputs` - `fallback: Fallback` - `elementId: string` - `success: Success` - `elementId: string` - `properties: Properties` - `model: string` - `provider: string` - `retries: number` - `timeout: number` - `type: "model"` - `"model"` - `UnionMember5` - `id: string` - `outputs: Record` - `elementId: string` - `type: "end"` - `"end"` - `gateway_id: string` - `modified_at: string` - `name: string` - `version_id: string` # Provider Configs ## List Provider Configs `client.aiGateway.providerConfigs.list(stringgatewayId, ProviderConfigListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `gatewayId: string` gateway id - `params: ProviderConfigListParams` - `account_id: string` Path param - `page?: number` Query param - `per_page?: number` Query param ### Returns - `ProviderConfigListResponse` - `id: string` - `alias: string` - `default_config: boolean` - `gateway_id: string` gateway id - `modified_at: string` - `provider_slug: string` - `secret_id: string` - `secret_preview: string` - `rate_limit?: number` - `rate_limit_period?: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const providerConfigListResponse of client.aiGateway.providerConfigs.list('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', })) { console.log(providerConfigListResponse.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 `client.aiGateway.providerConfigs.create(stringgatewayId, ProviderConfigCreateParamsparams, RequestOptionsoptions?): ProviderConfigCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs` Creates a new AI Gateway. ### Parameters - `gatewayId: string` gateway id - `params: ProviderConfigCreateParams` - `account_id: string` Path param - `alias: string` Body param - `default_config: boolean` Body param - `provider_slug: string` Body param - `secret: string` Body param - `secret_id: string` Body param - `rate_limit?: number` Body param - `rate_limit_period?: number` Body param ### Returns - `ProviderConfigCreateResponse` - `id: string` - `alias: string` - `default_config: boolean` - `gateway_id: string` gateway id - `modified_at: string` - `provider_slug: string` - `secret_id: string` - `secret_preview: string` - `rate_limit?: number` - `rate_limit_period?: number` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const providerConfig = await client.aiGateway.providerConfigs.create('my-gateway', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', alias: 'alias', default_config: true, provider_slug: 'provider_slug', secret: 'secret', secret_id: 'secret_id', }); console.log(providerConfig.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 - `ProviderConfigListResponse` - `id: string` - `alias: string` - `default_config: boolean` - `gateway_id: string` gateway id - `modified_at: string` - `provider_slug: string` - `secret_id: string` - `secret_preview: string` - `rate_limit?: number` - `rate_limit_period?: number` ### Provider Config Create Response - `ProviderConfigCreateResponse` - `id: string` - `alias: string` - `default_config: boolean` - `gateway_id: string` gateway id - `modified_at: string` - `provider_slug: string` - `secret_id: string` - `secret_preview: string` - `rate_limit?: number` - `rate_limit_period?: number` # URLs ## Get Gateway URL `client.aiGateway.urls.get(stringgatewayId, stringprovider, URLGetParamsparams, RequestOptionsoptions?): URLGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}` Retrieves the endpoint URL for an AI Gateway. ### Parameters - `gatewayId: string` gateway id - `provider: string` - `params: URLGetParams` - `account_id: string` ### Returns - `URLGetResponse = string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const url = await client.aiGateway.urls.get('my-gateway', 'workers-ai', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', }); console.log(url); ``` #### Response ```json { "result": "result", "success": true } ``` ## Domain Types ### URL Get Response - `URLGetResponse = string`