Manage gateways (2)
Last updated Sep 15, 2026 You have several different options for managing an AI Gateway.
Create gateway
Default gateway
AI Gateway can automatically create a gateway for you. If you omit the gateway ID from your request entirely, AI Gateway defaults to using default as the gateway ID. When no gateway named default exists in your account, AI Gateway creates it on the first authenticated request.
This means you can start sending requests without creating a gateway first — AI Gateway handles gateway creation for you.
The request that triggers auto-creation must be authenticated. When using the REST API, the standard Authorization header is sufficient. When using provider-native endpoints at gateway.ai.cloudflare.com, include a valid cf-aig-authorization header. For Workers AI bindings, the account identity from the binding is used instead of a header.
The auto-created default gateway uses the following settings:
| Setting | Default value |
|---|---|
| Authentication | On |
| Log collection | On |
| Caching | Off (TTL of 0) |
| Rate limiting | Off |
| Require provider credentials | Off |
| Workers AI billing | Standard billing |
After creation, you can edit the default gateway settings like any other gateway. If you delete the default gateway, sending a new authenticated request to the default gateway ID auto-creates it again.
Note
Auto-creation only applies to the gateway ID default. Using any other gateway ID requires creating the gateway first.
Create a gateway manually
- Log into the Cloudflare dashboard ↗︎ and select your account.
- Go to AI > AI Gateway.
- Select Create Gateway.
- Enter your Gateway name. Note: Gateway name has a 64 character limit.
- In Workers AI Billing, choose how Workers AI requests through this gateway are billed:
- Standard billing charges your Cloudflare account at the end of each billing cycle.
- Unified billing deducts from your prepaid AI Gateway credit balance in real time.
- Select Create.
To set up an AI Gateway using the API:
- Create an API token with the following permissions:
AI Gateway - ReadAI Gateway - Edit- Get your Account ID.
- Using that API token and Account ID, send a
POSTrequest to the Cloudflare API.
Edit gateway
To edit an AI Gateway in the dashboard:
- Log into the Cloudflare dashboard ↗︎ and select your account.
- Go to AI > AI Gateway.
- Select your gateway.
- Go to Settings and update as needed.
To edit an AI Gateway, send a PUT request to the Cloudflare API.
Note
For more details about what settings are available for editing, refer to Configuration.
Configure Workers AI billing
By default, Workers AI requests use Standard billing, which charges your Cloudflare account at the end of each billing cycle.
To use prepaid AI Gateway credits for Workers AI requests:
- Load credits into your Cloudflare account.
- In the Cloudflare dashboard, go to AI > AI Gateway and select your gateway.
- Go to Settings and find Workers AI Billing.
- Select Unified billing.
- Select Save.
Workers AI requests routed through this gateway will deduct from your AI Gateway credit balance in real time.
Prevent Unified Billing fallback for BYOK third-party providers
To prevent Unified Billing fallback for third-party provider requests, turn on Require provider credentials. Refer to Prevent Unified Billing fallback for BYOK third-party providers for dashboard and API instructions.
Retry requests
You can configure your gateway to automatically retry failed requests to upstream providers. This is useful when you do not control the client and cannot implement client-side retries or backoff logic.
To configure retry settings:
- Log in to the Cloudflare dashboard ↗︎ and select your account.
- Go to AI > AI Gateway and select your gateway.
- Go to Settings and find the Retry Requests section.
- Turn on the toggle to turn on automatic retries.
- Configure the following settings:
- Retry count — the maximum number of retry attempts (up to 5).
- Delay — the base delay between retries, from 0.1 to 60 seconds.
- Backoff — the backoff strategy for subsequent retries: Constant, Linear, or Exponential.
- Select Save.
These gateway-level defaults apply to all requests routed through the gateway. Per-request headers can override these defaults — refer to Request handling for details.
For more complex failover scenarios where you need to fail across different providers, refer to Dynamic Routing.
Delete gateway
Deleting your gateway is permanent and can not be undone.
To delete an AI Gateway in the dashboard:
- Log into the Cloudflare dashboard ↗︎ and select your account.
- Go to AI > AI Gateway.
- Select your gateway from the list of available options.
- Go to Settings.
- For Delete Gateway, select Delete (and confirm your deletion).
To delete an AI Gateway, send a DELETE request to the Cloudflare API.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai-gateway/configuration/manage-gateway/#page","headline":"Manage gateways","description":"Create, edit, and delete AI Gateway instances using the dashboard or API.","url":"https://developers.cloudflare.com/ai-gateway/configuration/manage-gateway/","inLanguage":"en","image":"https://developers.cloudflare.com/ai-gateway/configuration/manage-gateway/og.png?v=b71ac78f74104783","dateModified":"2026-09-15","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Configure AI Gateway request timeouts and retries for reliable AI provider interactions. title: Request handling image: https://developers.cloudflare.com/ai-gateway/configuration/request-handling/og.png?v=9828213cd051ec1f
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/ai-gateway/llms.txt
Use this file to discover all available pages before exploring further.
Docs