Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/content/changelog/ai-gateway/2026-03-02-default-gateway.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
10 changes: 6 additions & 4 deletions src/content/docs/ai-gateway/features/unified-billing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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.
Expand Down Expand Up @@ -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 '{
Expand Down
14 changes: 2 additions & 12 deletions src/content/docs/ai-gateway/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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).
:::

<Details header="Create a gateway manually">
Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/ai-gateway/usage/chat-completion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading