diff --git a/src/content/changelog/ai-gateway/2026-03-02-default-gateway.mdx b/src/content/changelog/ai-gateway/2026-03-02-default-gateway.mdx index 1d8563ce57334e8..037a71f367cf153 100644 --- a/src/content/changelog/ai-gateway/2026-03-02-default-gateway.mdx +++ b/src/content/changelog/ai-gateway/2026-03-02-default-gateway.mdx @@ -6,8 +6,23 @@ products: date: 2026-03-02 --- -AI Gateway now automatically creates a gateway for you on your first request. When you use `default` as a gateway ID, it will be created if it does not already exist — no need to set one up through the dashboard or API first. +You can now start using AI Gateway with a single API call — no setup required. Use `default` as your gateway ID, and AI Gateway creates one for you automatically on the first request. -The auto-created default gateway has authentication and log collection turned on, with caching and rate limiting turned off. +To try it out, [create an API token](/fundamentals/api/get-started/create-token/) with `AI Gateway - Read`, `AI Gateway - Edit`, and `Workers AI - Read` permissions, then run: -For more information, refer to [Default gateway](/ai-gateway/configuration/manage-gateway/#default-gateway). +```bash +curl -X POST https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/default/compat/chat/completions \ + --header "cf-aig-authorization: Bearer $CLOUDFLARE_API_TOKEN" \ + --header 'Content-Type: application/json' \ + --data '{ + "model": "workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast", + "messages": [ + { + "role": "user", + "content": "What is Cloudflare?" + } + ] + }' +``` + +AI Gateway gives you logging, caching, rate limiting, and access to multiple AI providers through a single endpoint. For more information, refer to [Get started](/ai-gateway/get-started/). diff --git a/src/content/docs/ai-gateway/features/unified-billing.mdx b/src/content/docs/ai-gateway/features/unified-billing.mdx index 482d34317386b80..c1e4778c536c8d9 100644 --- a/src/content/docs/ai-gateway/features/unified-billing.mdx +++ b/src/content/docs/ai-gateway/features/unified-billing.mdx @@ -54,8 +54,8 @@ Call any supported provider without passing an API Key. The request will automat For example, you can use the Unified API: ```bash -curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/completions \ - --header 'cf-aig-authorization: Bearer {CLOUDFLARE_TOKEN}' \ +curl -X POST https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/default/compat/chat/completions \ + --header "cf-aig-authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header 'Content-Type: application/json' \ --data '{ "model": "google-ai-studio/gemini-2.5-pro", @@ -68,6 +68,8 @@ curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/comp }' ``` +The `default` gateway is created automatically on your first request. Replace `default` with a specific gateway ID if you have already created one. + ### Spend limits Set spend limits to prevent unexpected charges on your loaded credits. You can define daily, weekly, or monthly limits. When a limit is reached, the AI Gateway automatically stops processing requests until the period resets or you increase the limit. @@ -113,8 +115,8 @@ To set ZDR as the default for Unified Billing using the API: Use the `cf-aig-zdr` header to override the gateway default for a single Unified Billing request. Set it to `true` to force ZDR, or `false` to disable ZDR for the request. ```bash title="Unified Billing request with ZDR" -curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/openai/chat/completions \ - --header 'cf-aig-authorization: Bearer {CLOUDFLARE_TOKEN}' \ +curl -X POST https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/{gateway_id}/openai/chat/completions \ + --header "cf-aig-authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --header 'Content-Type: application/json' \ --header 'cf-aig-zdr: true' \ --data '{ diff --git a/src/content/docs/ai-gateway/get-started.mdx b/src/content/docs/ai-gateway/get-started.mdx index 0ea465c05b1f85c..1fc8e35959ab186 100644 --- a/src/content/docs/ai-gateway/get-started.mdx +++ b/src/content/docs/ai-gateway/get-started.mdx @@ -28,15 +28,7 @@ Before making requests, you need two things: ## Send your first request -AI Gateway can automatically create a default gateway for you on the first authenticated request. Refer to [Default gateway](/ai-gateway/configuration/manage-gateway/#default-gateway) for more details. - -Use `default` as your gateway ID in the endpoint URL: - -```txt -https://gateway.ai.cloudflare.com/v1/{account_id}/default/{provider}/{endpoint} -``` - -For example, to send a chat completion request through AI Gateway: +Run the following command to make your first request through AI Gateway: ```bash curl -X POST https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/default/compat/chat/completions \ @@ -53,10 +45,8 @@ curl -X POST https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/default }' ``` -The `cf-aig-authorization` header authenticates your request with AI Gateway. - :::note -The default gateway is created with [authentication](/ai-gateway/configuration/authentication/) turned on, so the `cf-aig-authorization` header is required for all requests. For more details on how the default gateway works, refer to [Default gateway](/ai-gateway/configuration/manage-gateway/#default-gateway). +AI Gateway automatically creates a gateway for you on the first request. The gateway is created with [authentication](/ai-gateway/configuration/authentication/) turned on, so the `cf-aig-authorization` header is required for all requests. For more details on how the default gateway works, refer to [Default gateway](/ai-gateway/configuration/manage-gateway/#default-gateway). :::
diff --git a/src/content/docs/ai-gateway/usage/chat-completion.mdx b/src/content/docs/ai-gateway/usage/chat-completion.mdx index e7401791959838e..a7ef567f0a10969 100644 --- a/src/content/docs/ai-gateway/usage/chat-completion.mdx +++ b/src/content/docs/ai-gateway/usage/chat-completion.mdx @@ -19,10 +19,10 @@ Cloudflare's AI Gateway offers an OpenAI-compatible `/chat/completions` endpoint ## Endpoint URL ```txt -https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/completions +https://gateway.ai.cloudflare.com/v1/{account_id}/default/compat/chat/completions ``` -Replace `{account_id}` and `{gateway_id}` with your Cloudflare account and gateway IDs. +Replace `{account_id}` with your Cloudflare account ID. The `default` gateway is created automatically on your first request — no setup needed. You can also replace `default` with a specific gateway ID if you have already created one. ## Parameters