Skip to content
Cloudflare Docs

Unified Billing

Unified Billing allows users to connect to various AI providers (such as OpenAI, Anthropic, and Google AI Studio) and receive a single Cloudflare bill. To use Unified Billing, you must purchase and load credits into your Cloudflare account in the Cloudflare dashboard, which you can then spend with AI Gateway.

Pre-requisites

Load credits

To load credits for AI Gateway:

  1. In the Cloudflare dashboard, go to the AI Gateway page.

    Go to AI Gateway

    The Credits Available card on the top right shows how many AI gateway credits you have on your account currently.

  2. In Credits Available, select Manage.

  3. If your account does not have an available payment method, AI Gateway will prompt you to add a payment method to purchase credits. Add a payment method.

  4. Select Top-up credits.

  5. Add the amount of credits you want to purchase, then select Confirm and pay.

Auto-top up

You can configure AI Gateway to automatically replenish your credits when they fall below a certain threshold. To configure auto top-up:

  1. In the Cloudflare dashboard, go to the AI Gateway page.

    Go to AI Gateway
  2. In Credits Available, select Manage.

  3. Select Setup auto top-up credits.

  4. Choose a threshold and a recharge amount for auto top-up.

When your balance falls below the set threshold, AI Gateway will automatically apply the auto top-up amount to your account.

Use Unified Billing

Call any supported provider without passing an API Key. The request will automatically use Cloudflare's key and deduct credits from your account.

For example, you can use the Unified API:

Terminal window
curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/completions \
--header 'cf-aig-authorization: Bearer {CLOUDFLARE_TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
"model": "google-ai-studio/gemini-2.5-pro",
"messages": [
{
"role": "user",
"content": "What is Cloudflare?"
}
]
}'

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.

Supported providers

Unified Billing supports the following AI providers: