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.
- Ensure your Cloudflare account has sufficient credits loaded.
- Ensure you have authenticated your AI Gateway.
To load credits for AI Gateway:
-
In the Cloudflare dashboard, go to the AI Gateway page.
Go to AI GatewayThe Credits Available card on the top right shows how many AI gateway credits you have on your account currently.
-
In Credits Available, select Manage.
-
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.
-
Select Top-up credits.
-
Add the amount of credits you want to purchase, then select Confirm and pay.
You can configure AI Gateway to automatically replenish your credits when they fall below a certain threshold. To configure auto top-up:
-
In the Cloudflare dashboard, go to the AI Gateway page.
Go to AI Gateway -
In Credits Available, select Manage.
-
Select Setup auto top-up credits.
-
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.
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:
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?" } ] }'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.
Zero Data Retention (ZDR) routes Unified Billing traffic through provider endpoints that do not retain prompts or responses. Enable it with the gateway-level zdr setting, which maps to ZDR-capable upstream provider configurations. This setting only applies to Unified Billing requests that use Cloudflare-managed credentials. It does not apply to BYOK or other AI Gateway requests.
ZDR does not control AI Gateway logging. To disable request/response logging in AI Gateway, update the logging settings separately in Logging.
ZDR is currently supported for:
If ZDR is enabled for a provider that does not support it, AI Gateway falls back to the standard (non-ZDR) Unified Billing configuration.
To set ZDR as the default for Unified Billing in the dashboard:
- Log into the Cloudflare dashboard ↗ and select your account.
- Go to AI > AI Gateway.
- Select your gateway.
- Go to Settings and toggle Zero Data Retention (ZDR).
To set ZDR as the default for Unified Billing using the API:
- Create an API token with the following permissions:
AI Gateway - ReadAI Gateway - Edit
- Get your Account ID.
- Send a
PUTrequest to update the gateway and includezdr: trueorzdr: falsein the request body.
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.
curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/openai/chat/completions \ --header 'cf-aig-authorization: Bearer {CLOUDFLARE_TOKEN}' \ --header 'Content-Type: application/json' \ --header 'cf-aig-zdr: true' \ --data '{ "model": "gpt-4o-mini", "messages": [ { "role": "user", "content": "Explain Zero Data Retention." } ] }'Unified Billing supports the following AI providers:
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2026 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark
-