From 6e5c2b0aa391bf83a208ed436dc69a9250f3565e Mon Sep 17 00:00:00 2001 From: Ming Lu Date: Mon, 2 Mar 2026 09:14:03 -0800 Subject: [PATCH 1/5] [AI Gateway] Simplify docs to use default gateway and improve changelog --- .../ai-gateway/2026-03-02-default-gateway.mdx | 19 ++++++++++++++++--- .../ai-gateway/features/unified-billing.mdx | 4 +++- src/content/docs/ai-gateway/get-started.mdx | 16 ++-------------- .../docs/ai-gateway/usage/chat-completion.mdx | 4 ++-- 4 files changed, 23 insertions(+), 20 deletions(-) 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 1d8563ce57334e..77d8304b1572b2 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,21 @@ 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. +```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?" + } + ] + }' +``` -For more information, refer to [Default gateway](/ai-gateway/configuration/manage-gateway/#default-gateway). +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 482d34317386b8..27107b05bbed4b 100644 --- a/src/content/docs/ai-gateway/features/unified-billing.mdx +++ b/src/content/docs/ai-gateway/features/unified-billing.mdx @@ -54,7 +54,7 @@ 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 \ +curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/default/compat/chat/completions \ --header 'cf-aig-authorization: Bearer {CLOUDFLARE_TOKEN}' \ --header 'Content-Type: application/json' \ --data '{ @@ -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. diff --git a/src/content/docs/ai-gateway/get-started.mdx b/src/content/docs/ai-gateway/get-started.mdx index 0ea465c05b1f85..56ab2eeb17b36e 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,11 +45,7 @@ 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 `cf-aig-authorization` header authenticates your request.
diff --git a/src/content/docs/ai-gateway/usage/chat-completion.mdx b/src/content/docs/ai-gateway/usage/chat-completion.mdx index e7401791959838..a7ef567f0a1096 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 From 017e9bf179e0794c8e4d06f1036e440e6f1a7979 Mon Sep 17 00:00:00 2001 From: Ming Lu Date: Mon, 2 Mar 2026 09:26:23 -0800 Subject: [PATCH 2/5] [AI Gateway] Restore authentication note on get-started page --- src/content/docs/ai-gateway/get-started.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/content/docs/ai-gateway/get-started.mdx b/src/content/docs/ai-gateway/get-started.mdx index 56ab2eeb17b36e..1fc8e35959ab18 100644 --- a/src/content/docs/ai-gateway/get-started.mdx +++ b/src/content/docs/ai-gateway/get-started.mdx @@ -45,7 +45,9 @@ curl -X POST https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/default }' ``` -AI Gateway automatically creates a gateway for you on the first request. The `cf-aig-authorization` header authenticates your request. +:::note +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). +:::
From 76a90d92d434366f8984a6fd5bc10b179b657890 Mon Sep 17 00:00:00 2001 From: Ming Lu Date: Mon, 2 Mar 2026 09:29:47 -0800 Subject: [PATCH 3/5] [AI Gateway] Add API token permissions to changelog entry --- src/content/changelog/ai-gateway/2026-03-02-default-gateway.mdx | 2 ++ 1 file changed, 2 insertions(+) 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 77d8304b1572b2..3528cd7cee228c 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 @@ -8,6 +8,8 @@ date: 2026-03-02 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. +You need a [Cloudflare API token](/fundamentals/api/get-started/create-token/) with `AI Gateway - Read`, `AI Gateway - Edit`, and `Workers AI - Read` permissions. + ```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" \ From 7b8a8d3949edb01d8d7d7630de73b3ddd4d81d8f Mon Sep 17 00:00:00 2001 From: Ming Lu Date: Mon, 2 Mar 2026 09:30:46 -0800 Subject: [PATCH 4/5] [AI Gateway] Improve token permissions wording in changelog --- src/content/changelog/ai-gateway/2026-03-02-default-gateway.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3528cd7cee228c..037a71f367cf15 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 @@ -8,7 +8,7 @@ date: 2026-03-02 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. -You need a [Cloudflare API token](/fundamentals/api/get-started/create-token/) with `AI Gateway - Read`, `AI Gateway - Edit`, and `Workers AI - Read` permissions. +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: ```bash curl -X POST https://gateway.ai.cloudflare.com/v1/$CLOUDFLARE_ACCOUNT_ID/default/compat/chat/completions \ From f1901ff40efa8ed9bf55dfa744d6859ef7ac4285 Mon Sep 17 00:00:00 2001 From: Ming Lu Date: Mon, 2 Mar 2026 12:16:19 -0800 Subject: [PATCH 5/5] [AI Gateway] Fix inconsistent environment variable formatting in unified-billing examples --- src/content/docs/ai-gateway/features/unified-billing.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content/docs/ai-gateway/features/unified-billing.mdx b/src/content/docs/ai-gateway/features/unified-billing.mdx index 27107b05bbed4b..c1e4778c536c8d 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}/default/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", @@ -115,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 '{