## Create a new Gateway `client.aiGateway.create(AIGatewayCreateParamsparams, RequestOptionsoptions?): AIGatewayCreateResponse` **post** `/accounts/{account_id}/ai-gateway/gateways` Creates a new AI Gateway. ### Parameters - `params: AIGatewayCreateParams` - `account_id: string` Path param - `id: string` Body param: gateway id - `cache_invalidate_on_update: boolean` Body param - `cache_ttl: number | null` Body param - `collect_logs: boolean` Body param - `rate_limiting_interval: number | null` Body param - `rate_limiting_limit: number | null` Body param - `authentication?: boolean` Body param - `log_management?: number | null` Body param - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` Body param - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` Body param - `logpush_public_key?: string | null` Body param - `rate_limiting_technique?: "fixed" | "sliding" | null` Body param - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Body param: Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Body param: Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Body param: Maximum number of retry attempts for failed requests (1-5) - `workers_ai_billing_mode?: "postpaid"` Body param: Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` Body param ### Returns - `AIGatewayCreateResponse` - `id: string` gateway id - `cache_invalidate_on_update: boolean` - `cache_ttl: number | null` - `collect_logs: boolean` - `created_at: string` - `modified_at: string` - `rate_limiting_interval: number | null` - `rate_limiting_limit: number | null` - `authentication?: boolean` - `dlp?: UnionMember0 | UnionMember1` - `UnionMember0` - `action: "BLOCK" | "FLAG"` - `"BLOCK"` - `"FLAG"` - `enabled: boolean` - `profiles: Array` - `UnionMember1` - `enabled: boolean` - `policies: Array` - `id: string` - `action: "FLAG" | "BLOCK"` - `"FLAG"` - `"BLOCK"` - `check: Array<"REQUEST" | "RESPONSE">` - `"REQUEST"` - `"RESPONSE"` - `enabled: boolean` - `profiles: Array` - `is_default?: boolean` - `log_management?: number | null` - `log_management_strategy?: "STOP_INSERTING" | "DELETE_OLDEST" | null` - `"STOP_INSERTING"` - `"DELETE_OLDEST"` - `logpush?: boolean` - `logpush_public_key?: string | null` - `otel?: Array | null` - `authorization: string` - `headers: Record` - `url: string` - `content_type?: "json" | "protobuf"` - `"json"` - `"protobuf"` - `rate_limiting_technique?: "fixed" | "sliding" | null` - `"fixed"` - `"sliding"` - `retry_backoff?: "constant" | "linear" | "exponential" | null` Backoff strategy for retry delays - `"constant"` - `"linear"` - `"exponential"` - `retry_delay?: number | null` Delay between retry attempts in milliseconds (0-5000) - `retry_max_attempts?: number | null` Maximum number of retry attempts for failed requests (1-5) - `store_id?: string | null` - `stripe?: Stripe | null` - `authorization: string` - `usage_events: Array` - `payload: string` - `workers_ai_billing_mode?: "postpaid"` Controls how Workers AI inference calls routed through this gateway are billed. Only 'postpaid' is currently supported. - `"postpaid"` - `zdr?: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const aiGateway = await client.aiGateway.create({ account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', id: 'my-gateway', cache_invalidate_on_update: true, cache_ttl: 0, collect_logs: true, rate_limiting_interval: 0, rate_limiting_limit: 0, }); console.log(aiGateway.id); ``` #### Response ```json { "result": { "id": "my-gateway", "cache_invalidate_on_update": true, "cache_ttl": 0, "collect_logs": true, "created_at": "2019-12-27T18:11:19.117Z", "modified_at": "2019-12-27T18:11:19.117Z", "rate_limiting_interval": 0, "rate_limiting_limit": 0, "authentication": true, "dlp": { "action": "BLOCK", "enabled": true, "profiles": [ "string" ] }, "is_default": true, "log_management": 10000, "log_management_strategy": "STOP_INSERTING", "logpush": true, "logpush_public_key": "xxxxxxxxxxxxxxxx", "otel": [ { "authorization": "authorization", "headers": { "foo": "string" }, "url": "url", "content_type": "json" } ], "rate_limiting_technique": "fixed", "retry_backoff": "constant", "retry_delay": 0, "retry_max_attempts": 1, "store_id": "store_id", "stripe": { "authorization": "authorization", "usage_events": [ { "payload": "payload" } ] }, "workers_ai_billing_mode": "postpaid", "zdr": true }, "success": true } ```