# 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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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 ```typescript 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" ] }, "guardrails": { "prompt": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" }, "response": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" } }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "headers": { "foo": "string" }, "url": "https://example.com", "authorization": "authorization", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "spend_limits": { "enabled": true, "rules": [ { "limit": 1, "limitType": "cost", "window": 1, "id": "x", "enabled": true, "metadata": { "foo": { "mode": "partition" } }, "model": { "mode": "filter", "values": [ "string" ] }, "provider": { "mode": "filter", "values": [ "string" ] }, "technique": "fixed" } ] }, "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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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 ```typescript 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" ] }, "guardrails": { "prompt": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" }, "response": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" } }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "headers": { "foo": "string" }, "url": "https://example.com", "authorization": "authorization", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "spend_limits": { "enabled": true, "rules": [ { "limit": 1, "limitType": "cost", "window": 1, "id": "x", "enabled": true, "metadata": { "foo": { "mode": "partition" } }, "model": { "mode": "filter", "values": [ "string" ] }, "provider": { "mode": "filter", "values": [ "string" ] }, "technique": "fixed" } ] }, "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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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 ```typescript 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" ] }, "guardrails": { "prompt": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" }, "response": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" } }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "headers": { "foo": "string" }, "url": "https://example.com", "authorization": "authorization", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "spend_limits": { "enabled": true, "rules": [ { "limit": 1, "limitType": "cost", "window": 1, "id": "x", "enabled": true, "metadata": { "foo": { "mode": "partition" } }, "model": { "mode": "filter", "values": [ "string" ] }, "provider": { "mode": "filter", "values": [ "string" ] }, "technique": "fixed" } ] }, "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` - `guardrails?: Guardrails | null` Body param - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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 - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` Body param - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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 ```typescript 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" ] }, "guardrails": { "prompt": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" }, "response": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" } }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "headers": { "foo": "string" }, "url": "https://example.com", "authorization": "authorization", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "spend_limits": { "enabled": true, "rules": [ { "limit": 1, "limitType": "cost", "window": 1, "id": "x", "enabled": true, "metadata": { "foo": { "mode": "partition" } }, "model": { "mode": "filter", "values": [ "string" ] }, "provider": { "mode": "filter", "values": [ "string" ] }, "technique": "fixed" } ] }, "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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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 ```typescript 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" ] }, "guardrails": { "prompt": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" }, "response": { "P1": "FLAG", "S1": "FLAG", "S10": "FLAG", "S11": "FLAG", "S12": "FLAG", "S13": "FLAG", "S2": "FLAG", "S3": "FLAG", "S4": "FLAG", "S5": "FLAG", "S6": "FLAG", "S7": "FLAG", "S8": "FLAG", "S9": "FLAG" } }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "headers": { "foo": "string" }, "url": "https://example.com", "authorization": "authorization", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "spend_limits": { "enabled": true, "rules": [ { "limit": 1, "limitType": "cost", "window": 1, "id": "x", "enabled": true, "metadata": { "foo": { "mode": "partition" } }, "model": { "mode": "filter", "values": [ "string" ] }, "provider": { "mode": "filter", "values": [ "string" ] }, "technique": "fixed" } ] }, "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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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` - `guardrails?: Guardrails | null` - `prompt: Prompt` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `response: Response` - `P1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S1?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S10?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S11?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S12?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S13?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S2?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S3?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S4?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S5?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S6?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S7?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S8?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `S9?: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `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` - `headers: Record` - `url: string` - `authorization?: 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) - `spend_limits?: SpendLimits | null` - `enabled?: boolean` - `rules?: Array` - `limit: number` - `limitType: "cost"` - `"cost"` - `window: number` - `id?: string` - `enabled?: boolean` - `metadata?: Record` - `Mode` - `mode: "partition"` - `"partition"` - `UnionMember1` - `mode: "filter"` - `"filter"` - `values: Array` - `model?: Model` - `mode: "filter"` - `"filter"` - `values: Array` - `provider?: Provider` - `mode: "filter"` - `"filter"` - `values: Array` - `technique?: "fixed" | "sliding"` - `"fixed"` - `"sliding"` - `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` Lists all available evaluator types for scoring AI gateway responses. ### 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 ```typescript 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` # Custom Providers ## List Account Providers `client.aiGateway.customProviders.list(CustomProviderListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/custom-providers` Lists all AI Gateway evaluator types configured for the account. ### Parameters - `params: CustomProviderListParams` - `account_id: string` Path param - `beta?: boolean` Query param - `enable?: boolean` Query param - `page?: number` Query param - `per_page?: number` Query param - `search?: string` Query param: Search by id, name, slug ### Returns - `CustomProviderListResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` ### Example ```typescript 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 customProviderListResponse of client.aiGateway.customProviders.list({ account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', })) { console.log(customProviderListResponse.id); } ``` #### Response ```json { "result": [ { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "base_url": "https://example.com", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "beta": true, "curl_example": "curl_example", "description": "description", "enable": true, "headers": "headers", "js_example": "js_example", "link": "link", "logo": "logo", "position": 0 } ], "success": true } ``` ## Fetch a Account Provider `client.aiGateway.customProviders.get(stringid, CustomProviderGetParamsparams, RequestOptionsoptions?): CustomProviderGetResponse` **get** `/accounts/{account_id}/ai-gateway/custom-providers/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `id: string` - `params: CustomProviderGetParams` - `account_id: string` ### Returns - `CustomProviderGetResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const customProvider = await client.aiGateway.customProviders.get( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, ); console.log(customProvider.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "base_url": "https://example.com", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "beta": true, "curl_example": "curl_example", "description": "description", "enable": true, "headers": "headers", "js_example": "js_example", "link": "link", "logo": "logo", "position": 0 }, "success": true } ``` ## Create a new Account Provider `client.aiGateway.customProviders.create(CustomProviderCreateParamsparams, RequestOptionsoptions?): CustomProviderCreateResponse` **post** `/accounts/{account_id}/ai-gateway/custom-providers` Creates a new AI Gateway. ### Parameters - `params: CustomProviderCreateParams` - `account_id: string` Path param - `base_url: string` Body param - `name: string` Body param - `slug: string` Body param - `beta?: boolean` Body param - `curl_example?: string` Body param - `description?: string` Body param - `enable?: boolean` Body param - `headers?: string` Body param - `js_example?: string` Body param - `link?: string` Body param - `position?: number` Body param ### Returns - `CustomProviderCreateResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const customProvider = await client.aiGateway.customProviders.create({ account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', base_url: 'https://example.com', name: 'name', slug: 'slug', }); console.log(customProvider.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "base_url": "https://example.com", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "beta": true, "curl_example": "curl_example", "description": "description", "enable": true, "headers": "headers", "js_example": "js_example", "link": "link", "logo": "logo", "position": 0 }, "success": true } ``` ## Delete a Account Provider `client.aiGateway.customProviders.delete(stringid, CustomProviderDeleteParamsparams, RequestOptionsoptions?): CustomProviderDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/custom-providers/{id}` Deletes an AI Gateway dataset. ### Parameters - `id: string` - `params: CustomProviderDeleteParams` - `account_id: string` ### Returns - `CustomProviderDeleteResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const customProvider = await client.aiGateway.customProviders.delete( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, ); console.log(customProvider.id); ``` #### Response ```json { "result": { "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "base_url": "https://example.com", "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "name": "name", "slug": "slug", "beta": true, "curl_example": "curl_example", "description": "description", "enable": true, "headers": "headers", "js_example": "js_example", "link": "link", "logo": "logo", "position": 0 }, "success": true } ``` ## Domain Types ### Custom Provider List Response - `CustomProviderListResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` ### Custom Provider Get Response - `CustomProviderGetResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` ### Custom Provider Create Response - `CustomProviderCreateResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` ### Custom Provider Delete Response - `CustomProviderDeleteResponse` - `id: string` - `base_url: string` - `created_at: string` - `modified_at: string` - `name: string` - `slug: string` - `beta?: boolean` - `curl_example?: string` - `description?: string` - `enable?: boolean` - `headers?: string` - `js_example?: string` - `link?: string` - `logo?: string` - `position?: number` # Logs ## List Gateway Logs `client.aiGateway.logs.list(stringgatewayID, LogListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs` Lists request/response log entries for the AI gateway with filtering and pagination. ### 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" | 21 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"` - `"user_agent"` - `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 ```typescript 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(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 - `id: string` - `params: LogGetParams` - `account_id: string` - `gateway_id: string` gateway id ### 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 ```typescript 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('id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: 'my-gateway', }); 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(stringid, LogEditParamsparams, RequestOptionsoptions?): LogEditResponse` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/logs/{id}` Updates metadata for an AI Gateway log entry. ### Parameters - `id: string` - `params: LogEditParams` - `account_id: string` Path param - `gateway_id: string` Path param: gateway id - `feedback?: number | null` Body param - `metadata?: Record | null` Body param - `string` - `number` - `boolean` - `score?: number | null` Body param ### Returns - `LogEditResponse = unknown` ### Example ```typescript 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('id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: 'my-gateway', }); 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` Deletes gateway log entries matching the specified criteria. ### Parameters - `gatewayID: string` gateway id - `params: LogDeleteParams` - `account_id: string` Path param - `filters?: Array` Query param - `key: "id" | "created_at" | "request_content_type" | 21 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"` - `"user_agent"` - `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 ```typescript 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(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 - `id: string` - `params: LogRequestParams` - `account_id: string` - `gateway_id: string` gateway id ### Returns - `LogRequestResponse = unknown` ### Example ```typescript 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('id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: 'my-gateway', }); console.log(response); ``` #### Response ```json {} ``` ## Get Gateway Log Response `client.aiGateway.logs.response(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 - `id: string` - `params: LogResponseParams` - `account_id: string` - `gateway_id: string` gateway id ### Returns - `LogResponseResponse = unknown` ### Example ```typescript 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('id', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: 'my-gateway', }); 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 ```typescript 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(stringid, DatasetGetParamsparams, RequestOptionsoptions?): DatasetGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `id: string` - `params: DatasetGetParams` - `account_id: string` - `gateway_id: string` gateway id ### 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 ```typescript 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('id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', gateway_id: 'my-gateway', }); 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 ```typescript 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(stringid, DatasetUpdateParamsparams, RequestOptionsoptions?): DatasetUpdateResponse` **put** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Updates an existing AI Gateway dataset. ### Parameters - `id: string` - `params: DatasetUpdateParams` - `account_id: string` Path param - `gateway_id: string` Path param: gateway id - `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 ```typescript 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('id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', gateway_id: 'my-gateway', 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(stringid, DatasetDeleteParamsparams, RequestOptionsoptions?): DatasetDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/datasets/{id}` Deletes an AI Gateway dataset. ### Parameters - `id: string` - `params: DatasetDeleteParams` - `account_id: string` - `gateway_id: string` gateway id ### 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 ```typescript 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('id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', gateway_id: 'my-gateway', }); 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 ```typescript 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(stringid, EvaluationGetParamsparams, RequestOptionsoptions?): EvaluationGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Retrieves details for a specific AI Gateway dataset. ### Parameters - `id: string` - `params: EvaluationGetParams` - `account_id: string` - `gateway_id: string` gateway id ### 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 ```typescript 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('id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', gateway_id: 'my-gateway', }); 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 ```typescript 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(stringid, EvaluationDeleteParamsparams, RequestOptionsoptions?): EvaluationDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/evaluations/{id}` Deletes an AI Gateway dataset. ### Parameters - `id: string` - `params: EvaluationDeleteParams` - `account_id: string` - `gateway_id: string` gateway id ### 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 ```typescript 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('id', { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', gateway_id: 'my-gateway', }); 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` Path param - `page?: number` Query param: Page number - `per_page?: number` Query param: Number of routes per page ### 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` - `is_valid?: boolean` - `success: boolean` ### Example ```typescript 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", "is_valid": true } } ] }, "success": true } ``` ## Get an AI Gateway Dynamic Route. `client.aiGateway.dynamicRouting.get(stringid, DynamicRoutingGetParamsparams, RequestOptionsoptions?): DynamicRoutingGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Get an AI Gateway Dynamic Route. ### Parameters - `id: string` - `params: DynamicRoutingGetParams` - `account_id: string` - `gateway_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` - `is_valid?: boolean` ### Example ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', }); 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", "is_valid": true } }, "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` - `is_valid?: boolean` ### Example ```typescript 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", "is_valid": true } }, "success": true } ``` ## Update an AI Gateway Dynamic Route. `client.aiGateway.dynamicRouting.update(stringid, DynamicRoutingUpdateParamsparams, RequestOptionsoptions?): DynamicRoutingUpdateResponse` **patch** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Update an AI Gateway Dynamic Route. ### Parameters - `id: string` - `params: DynamicRoutingUpdateParams` - `account_id: string` Path param - `gateway_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` - `is_valid?: boolean` - `success: boolean` ### Example ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', 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", "is_valid": true } }, "success": true } ``` ## Delete an AI Gateway Dynamic Route. `client.aiGateway.dynamicRouting.delete(stringid, DynamicRoutingDeleteParamsparams, RequestOptionsoptions?): DynamicRoutingDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}` Delete an AI Gateway Dynamic Route. ### Parameters - `id: string` - `params: DynamicRoutingDeleteParams` - `account_id: string` - `gateway_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 ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', }); 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(stringid, DynamicRoutingListDeploymentsParamsparams, RequestOptionsoptions?): DynamicRoutingListDeploymentsResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments` List all AI Gateway Dynamic Route Deployments. ### Parameters - `id: string` - `params: DynamicRoutingListDeploymentsParams` - `account_id: string` - `gateway_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 ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', }); 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(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 - `id: string` - `params: DynamicRoutingCreateDeploymentParams` - `account_id: string` Path param - `gateway_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 ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', 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(stringid, DynamicRoutingListVersionsParamsparams, RequestOptionsoptions?): DynamicRoutingListVersionsResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions` List all AI Gateway Dynamic Route Versions. ### Parameters - `id: string` - `params: DynamicRoutingListVersionsParams` - `account_id: string` - `gateway_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` - `is_valid?: boolean` - `success: boolean` ### Example ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', }); 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", "is_valid": true } ] }, "success": true } ``` ## Create a new AI Gateway Dynamic Route Version. `client.aiGateway.dynamicRouting.createVersion(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 - `id: string` - `params: DynamicRoutingCreateVersionParams` - `account_id: string` Path param - `gateway_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 ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', 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(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 - `versionID: string` - `params: DynamicRoutingGetVersionParams` - `account_id: string` - `gateway_id: string` - `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` - `is_valid?: boolean` ### Example ```typescript 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', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: '54442216', id: '54442216', }); 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", "is_valid": true }, "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` - `is_valid?: boolean` - `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` - `is_valid?: boolean` ### 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` - `is_valid?: boolean` ### 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` - `is_valid?: boolean` - `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` - `is_valid?: boolean` - `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` - `is_valid?: boolean` # 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 ```typescript 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 - `rate_limit?: number` Body param - `rate_limit_period?: number` Body param - `secret?: string` Body param - `secret_id?: string` 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 ```typescript 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', }); 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(stringprovider, URLGetParamsparams, RequestOptionsoptions?): URLGetResponse` **get** `/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}` Retrieves the endpoint URL for an AI Gateway. ### Parameters - `provider: string` - `params: URLGetParams` - `account_id: string` - `gateway_id: string` gateway id ### Returns - `URLGetResponse = string` ### Example ```typescript 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('workers-ai', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', gateway_id: 'my-gateway', }); console.log(url); ``` #### Response ```json { "result": "result", "success": true } ``` ## Domain Types ### URL Get Response - `URLGetResponse = string` # Billing ## Get credit balance `client.aiGateway.billing.creditBalance(BillingCreditBalanceParamsparams, RequestOptionsoptions?): BillingCreditBalanceResponse` **get** `/accounts/{account_id}/ai-gateway/billing/credit-balance` Retrieve the current credit balance, payment method info, and top-up configuration. ### Parameters - `params: BillingCreditBalanceParams` - `account_id: string` Cloudflare account ID. ### Returns - `BillingCreditBalanceResponse` - `balance: number` - `has_default_payment_method: boolean` - `payment_method: PaymentMethod | null` - `brand?: string` - `last4?: string` - `topup_config: TopupConfig` - `amount: number | null` - `disabledReason: string | null` - `error: string | null` - `lastFailedAt: number | null` - `threshold: number | null` - `first_topup_success?: boolean` ### Example ```typescript 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.billing.creditBalance({ account_id: 'account_id' }); console.log(response.balance); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "balance": 0, "has_default_payment_method": true, "payment_method": { "brand": "brand", "last4": "last4" }, "topup_config": { "amount": 0, "disabledReason": "disabledReason", "error": "error", "lastFailedAt": 0, "threshold": 0 }, "first_topup_success": true }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Get usage history `client.aiGateway.billing.usageHistory(BillingUsageHistoryParamsparams, RequestOptionsoptions?): BillingUsageHistoryResponse` **get** `/accounts/{account_id}/ai-gateway/billing/usage-history` Retrieve aggregated usage meter event summaries for the given time range. ### Parameters - `params: BillingUsageHistoryParams` - `account_id: string` Path param: Cloudflare account ID. - `value_grouping_window: "day" | "hour"` Query param: Grouping window for usage data. - `"day"` - `"hour"` - `end_time?: number | null` Query param: End time as Unix timestamp in milliseconds. - `start_time?: number | null` Query param: Start time as Unix timestamp in milliseconds. ### Returns - `BillingUsageHistoryResponse` - `history: Array` - `id: string` - `aggregated_value: number` - `end_time: number` - `start_time: number` ### Example ```typescript 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.billing.usageHistory({ account_id: 'account_id', value_grouping_window: 'day', }); console.log(response.history); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "history": [ { "id": "id", "aggregated_value": 0, "end_time": 0, "start_time": 0 } ] }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Get invoice history `client.aiGateway.billing.invoiceHistory(BillingInvoiceHistoryParamsparams, RequestOptionsoptions?): BillingInvoiceHistoryResponse` **get** `/accounts/{account_id}/ai-gateway/billing/invoice-history` Retrieve a list of past invoices with pagination, optionally filtered by type. ### Parameters - `params: BillingInvoiceHistoryParams` - `account_id: string` Path param: Cloudflare account ID. - `type?: "auto" | "all" | "manual"` Query param: Filter invoice type: auto, manual, or all. - `"auto"` - `"all"` - `"manual"` ### Returns - `BillingInvoiceHistoryResponse` - `invoices: Array` - `amount_due: number` - `amount_paid: number` - `amount_remaining: number` - `currency: string` - `id?: string | null` - `attempt_count?: number` - `attempted?: boolean` - `auto_advance?: boolean | null` - `created?: number` - `created_by?: string` - `description?: string | null` - `invoice_origin?: string` - `invoice_pdf?: string | null` - `status?: string | null` - `pagination: Pagination` - `has_more: boolean` - `page: number` - `per_page: number` - `total_count: number` ### Example ```typescript 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.billing.invoiceHistory({ account_id: 'account_id' }); console.log(response.invoices); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "invoices": [ { "amount_due": 0, "amount_paid": 0, "amount_remaining": 0, "currency": "currency", "id": "id", "attempt_count": 0, "attempted": true, "auto_advance": true, "created": 0, "created_by": "created_by", "description": "description", "invoice_origin": "invoice_origin", "invoice_pdf": "invoice_pdf", "status": "status" } ], "pagination": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Get invoice preview `client.aiGateway.billing.invoicePreview(BillingInvoicePreviewParamsparams, RequestOptionsoptions?): BillingInvoicePreviewResponse` **get** `/accounts/{account_id}/ai-gateway/billing/invoice-preview` Retrieve a preview of the upcoming invoice including line items and tax. ### Parameters - `params: BillingInvoicePreviewParams` - `account_id: string` Cloudflare account ID. ### Returns - `BillingInvoicePreviewResponse` - `id: string` - `amount_due: number` - `amount_paid: number` - `amount_remaining: number` - `currency: string` - `invoice_lines: Array` - `amount: number` - `currency: string` - `description: string | null` - `period: Period` - `end: number` - `start: number` - `pricing: Pricing` - `unit_amount_decimal: string | null` - `quantity: number` - `pretax_credit_amounts?: Array` - `amount: number` - `type: string` - `credit_balance_transaction?: string | null` - `discount?: string | null` - `period_end: number` - `period_start: number` - `status: "draft" | "open" | "paid" | 2 more` - `"draft"` - `"open"` - `"paid"` - `"uncollectible"` - `"void"` ### Example ```typescript 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.billing.invoicePreview({ account_id: 'account_id' }); console.log(response.id); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "id": "id", "amount_due": 0, "amount_paid": 0, "amount_remaining": 0, "currency": "currency", "invoice_lines": [ { "amount": 0, "currency": "currency", "description": "description", "period": { "end": 0, "start": 0 }, "pricing": { "unit_amount_decimal": "unit_amount_decimal" }, "quantity": 0, "pretax_credit_amounts": [ { "amount": 0, "type": "type", "credit_balance_transaction": "credit_balance_transaction", "discount": "discount" } ] } ], "period_end": 0, "period_start": 0, "status": "draft" }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Domain Types ### Billing Credit Balance Response - `BillingCreditBalanceResponse` - `balance: number` - `has_default_payment_method: boolean` - `payment_method: PaymentMethod | null` - `brand?: string` - `last4?: string` - `topup_config: TopupConfig` - `amount: number | null` - `disabledReason: string | null` - `error: string | null` - `lastFailedAt: number | null` - `threshold: number | null` - `first_topup_success?: boolean` ### Billing Usage History Response - `BillingUsageHistoryResponse` - `history: Array` - `id: string` - `aggregated_value: number` - `end_time: number` - `start_time: number` ### Billing Invoice History Response - `BillingInvoiceHistoryResponse` - `invoices: Array` - `amount_due: number` - `amount_paid: number` - `amount_remaining: number` - `currency: string` - `id?: string | null` - `attempt_count?: number` - `attempted?: boolean` - `auto_advance?: boolean | null` - `created?: number` - `created_by?: string` - `description?: string | null` - `invoice_origin?: string` - `invoice_pdf?: string | null` - `status?: string | null` - `pagination: Pagination` - `has_more: boolean` - `page: number` - `per_page: number` - `total_count: number` ### Billing Invoice Preview Response - `BillingInvoicePreviewResponse` - `id: string` - `amount_due: number` - `amount_paid: number` - `amount_remaining: number` - `currency: string` - `invoice_lines: Array` - `amount: number` - `currency: string` - `description: string | null` - `period: Period` - `end: number` - `start: number` - `pricing: Pricing` - `unit_amount_decimal: string | null` - `quantity: number` - `pretax_credit_amounts?: Array` - `amount: number` - `type: string` - `credit_balance_transaction?: string | null` - `discount?: string | null` - `period_end: number` - `period_start: number` - `status: "draft" | "open" | "paid" | 2 more` - `"draft"` - `"open"` - `"paid"` - `"uncollectible"` - `"void"` # Topup ## Create a top-up `client.aiGateway.billing.topup.create(TopupCreateParamsparams, RequestOptionsoptions?): TopupCreateResponse` **post** `/accounts/{account_id}/ai-gateway/billing/topup` Create a credit top-up via Stripe PaymentIntent for the given account. ### Parameters - `params: TopupCreateParams` - `account_id: string` Path param: Cloudflare account ID. - `amount: number` Body param: Top-up amount in cents (min 1000). ### Returns - `TopupCreateResponse` - `client_secret: string | null` Stripe PaymentIntent client secret. - `onboarding: boolean` Whether the user was already onboarded. - `payment_intent_id: string` Stripe invoice ID. - `brand?: string` Card brand (visa, mastercard, etc.). - `last4?: string` Last 4 digits of card. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const topup = await client.aiGateway.billing.topup.create({ account_id: 'account_id', amount: 5000, }); console.log(topup.payment_intent_id); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "client_secret": "client_secret", "onboarding": true, "payment_intent_id": "payment_intent_id", "brand": "brand", "last4": "last4" }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Check top-up status `client.aiGateway.billing.topup.status(TopupStatusParamsparams, RequestOptionsoptions?): TopupStatusResponse` **post** `/accounts/{account_id}/ai-gateway/billing/topup/status` Get the payment processing status of a top-up by its invoice ID. ### Parameters - `params: TopupStatusParams` - `account_id: string` Path param: Cloudflare account ID. - `payment_intent_id: string` Body param: Stripe invoice ID to check status for. ### Returns - `TopupStatusResponse` - `payment_intent_id: string` - `status: "completed" | "pending"` - `"completed"` - `"pending"` ### Example ```typescript 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.billing.topup.status({ account_id: 'account_id', payment_intent_id: 'in_1abc', }); console.log(response.payment_intent_id); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "payment_intent_id": "payment_intent_id", "status": "completed" }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Domain Types ### Topup Create Response - `TopupCreateResponse` - `client_secret: string | null` Stripe PaymentIntent client secret. - `onboarding: boolean` Whether the user was already onboarded. - `payment_intent_id: string` Stripe invoice ID. - `brand?: string` Card brand (visa, mastercard, etc.). - `last4?: string` Last 4 digits of card. ### Topup Status Response - `TopupStatusResponse` - `payment_intent_id: string` - `status: "completed" | "pending"` - `"completed"` - `"pending"` # Config ## Get auto top-up configuration `client.aiGateway.billing.topup.config.get(ConfigGetParamsparams, RequestOptionsoptions?): ConfigGetResponse` **get** `/accounts/{account_id}/ai-gateway/billing/topup/config` Retrieve the current auto top-up threshold, amount, and any error state. ### Parameters - `params: ConfigGetParams` - `account_id: string` Cloudflare account ID. ### Returns - `ConfigGetResponse` - `amount: number | null` - `disabledReason: string | null` - `error: string | null` - `lastFailedAt: number | null` - `threshold: number | null` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const config = await client.aiGateway.billing.topup.config.get({ account_id: 'account_id' }); console.log(config.amount); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "amount": 0, "disabledReason": "disabledReason", "error": "error", "lastFailedAt": 0, "threshold": 0 }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Set auto top-up configuration `client.aiGateway.billing.topup.config.create(ConfigCreateParamsparams, RequestOptionsoptions?): ConfigCreateResponse` **post** `/accounts/{account_id}/ai-gateway/billing/topup/config` Configure auto top-up with a balance threshold and top-up amount. ### Parameters - `params: ConfigCreateParams` - `account_id: string` Path param: Cloudflare account ID. - `amount: number` Body param: Auto top-up amount in cents (min 1000). - `threshold: number` Body param: Balance threshold in cents that triggers auto top-up (min 500). ### Returns - `ConfigCreateResponse` - `amount: number` - `threshold: number` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const config = await client.aiGateway.billing.topup.config.create({ account_id: 'account_id', amount: 5000, threshold: 500, }); console.log(config.amount); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "amount": 0, "threshold": 0 }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Delete auto top-up configuration `client.aiGateway.billing.topup.config.delete(ConfigDeleteParamsparams, RequestOptionsoptions?): ConfigDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/billing/topup/config` Remove the auto top-up configuration for the account. ### Parameters - `params: ConfigDeleteParams` - `account_id: string` Cloudflare account ID. ### Returns - `ConfigDeleteResponse = unknown` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const config = await client.aiGateway.billing.topup.config.delete({ account_id: 'account_id' }); console.log(config); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": {}, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Domain Types ### Config Get Response - `ConfigGetResponse` - `amount: number | null` - `disabledReason: string | null` - `error: string | null` - `lastFailedAt: number | null` - `threshold: number | null` ### Config Create Response - `ConfigCreateResponse` - `amount: number` - `threshold: number` ### Config Delete Response - `ConfigDeleteResponse = unknown` # Spending Limit ## Get spending limit `client.aiGateway.billing.spendingLimit.get(SpendingLimitGetParamsparams, RequestOptionsoptions?): SpendingLimitGetResponse` **get** `/accounts/{account_id}/ai-gateway/billing/spending-limit` Retrieve the current spending limit configuration for the account. ### Parameters - `params: SpendingLimitGetParams` - `account_id: string` Cloudflare account ID. ### Returns - `SpendingLimitGetResponse` - `config: Config` - `amount: number | null` - `duration: string | null` - `strategy: string | null` - `enabled: boolean` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const spendingLimit = await client.aiGateway.billing.spendingLimit.get({ account_id: 'account_id', }); console.log(spendingLimit.config); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": { "config": { "amount": 0, "duration": "duration", "strategy": "strategy" }, "enabled": true }, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Set spending limit (deprecated) `client.aiGateway.billing.spendingLimit.create(SpendingLimitCreateParamsparams, RequestOptionsoptions?): SpendingLimitCreateResponse` **post** `/accounts/{account_id}/ai-gateway/billing/spending-limit` Deprecated: spending limits can no longer be created, enabled, or modified and this endpoint always responds 403. Use the new AI Gateway spend limits instead: https://developers.cloudflare.com/ai-gateway/features/spend-limits/. Existing limits can be removed via DELETE /spending-limit. ### Parameters - `params: SpendingLimitCreateParams` - `account_id: string` Path param: Cloudflare account ID. - `amount: number` Body param: Spending limit amount in cents (min 100). - `duration: "daily" | "weekly" | "monthly"` Body param: Spending limit duration. - `"daily"` - `"weekly"` - `"monthly"` - `strategy: "fixed" | "sliding"` Body param: Spending limit strategy. - `"fixed"` - `"sliding"` ### Returns - `SpendingLimitCreateResponse = unknown` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const spendingLimit = await client.aiGateway.billing.spendingLimit.create({ account_id: 'account_id', amount: 10000, duration: 'monthly', strategy: 'fixed', }); console.log(spendingLimit); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": {}, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Delete spending limit `client.aiGateway.billing.spendingLimit.delete(SpendingLimitDeleteParamsparams, RequestOptionsoptions?): SpendingLimitDeleteResponse` **delete** `/accounts/{account_id}/ai-gateway/billing/spending-limit` Remove the spending limit for the account. ### Parameters - `params: SpendingLimitDeleteParams` - `account_id: string` Cloudflare account ID. ### Returns - `SpendingLimitDeleteResponse = unknown` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const spendingLimit = await client.aiGateway.billing.spendingLimit.delete({ account_id: 'account_id', }); console.log(spendingLimit); ``` #### Response ```json { "errors": [ { "code": 0, "message": "message" } ], "messages": [ { "code": 0, "message": "message" } ], "result": {}, "success": true, "result_info": { "has_more": true, "page": 0, "per_page": 0, "total_count": 0 } } ``` ## Domain Types ### Spending Limit Get Response - `SpendingLimitGetResponse` - `config: Config` - `amount: number | null` - `duration: string | null` - `strategy: string | null` - `enabled: boolean` ### Spending Limit Create Response - `SpendingLimitCreateResponse = unknown` ### Spending Limit Delete Response - `SpendingLimitDeleteResponse = unknown`