|
| 1 | + |
| 2 | +--- |
| 3 | +pcx_content_type: configuration |
| 4 | +title: Unified Billing |
| 5 | +sidebar: |
| 6 | + order: 1 |
| 7 | +head: [] |
| 8 | +description: Use the Cloudflare billing to pay for and authenticate your inference requests. |
| 9 | +--- |
| 10 | + |
| 11 | +:::caution |
| 12 | +Unified Billing is in closed beta. Request for access. |
| 13 | +::: |
| 14 | + |
| 15 | +Unified Billing allows users to connect to various AI providers (e.g. OpenAI, Anthropic) and receive a single Cloudflare bill. To use Unified Billing, users must purchase and load credits into their Cloudflare account, via the Dashboard, which can then be spent via the AI Gateway. |
| 16 | + |
| 17 | + |
| 18 | +### Load credits |
| 19 | + |
| 20 | +- Navigate to [AI Gateway](https://dash.cloudflare.com/?to=/:account/ai/ai-gateway) on Cloudflare dashboard |
| 21 | +- The "Credits Available" card on the top right shows how many AI gateway credits you have on your account currently. |
| 22 | +- Click "Manage" to navigate to the new billing page |
| 23 | +- If you don't have a payment method already on your account, you will be prompted to "Add a payment method to purchase credits" on top of page. |
| 24 | +- Once you have a card added, you will be able to do a credit top up on your account by clicking "Top-up credits", and then adding the required amount on the next popup. |
| 25 | + |
| 26 | + |
| 27 | +### Auto-top up |
| 28 | + |
| 29 | +- Navigate to [AI Gateway](https://dash.cloudflare.com/?to=/:account/ai/ai-gateway) on Cloudflare dashboard |
| 30 | +- Click "Manage" on the "Credits Available" card on the top right to navigate to the new billing page |
| 31 | +- Click the "Setup auto top-up credits" option on the dashboard, and set up a threshold and a recharge amount for auto topup. |
| 32 | + |
| 33 | +When your balance falls below the given threshold, we will automatically apply the auto topup on your account. |
| 34 | + |
| 35 | +### Using Unified Billing |
| 36 | + |
| 37 | +#### Pre-requisites |
| 38 | + |
| 39 | +- Ensure your gateway is [authenticated](/ai-gateway/configuration/authentication/). |
| 40 | + |
| 41 | +Call any supported provider without passing any API Key. The request will automatically use Cloudflare's key and deduct credits from your account. |
| 42 | + |
| 43 | +Example with Unified API: |
| 44 | + |
| 45 | +```bash |
| 46 | +curl -X POST https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/compat/chat/completions \ |
| 47 | + --header 'cf-aig-authorization: Bearer {CLOUDFLARE_TOKEN}' \ |
| 48 | + --header 'Content-Type: application/json' \ |
| 49 | + --data '{ |
| 50 | + "model": "google-ai-studio/gemini-2.5-pro", |
| 51 | + "messages": [ |
| 52 | + { |
| 53 | + "role": "user", |
| 54 | + "content": "What is Cloudflare?" |
| 55 | + } |
| 56 | + ] |
| 57 | + }' |
| 58 | +``` |
| 59 | + |
| 60 | +### Spend limit |
| 61 | + |
| 62 | +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. |
| 63 | + |
| 64 | + |
| 65 | +### Supported Providers |
| 66 | + |
| 67 | +- [OpenAI](/ai-gateway/usage/providers/openai/) |
| 68 | +- [Anthropic](/ai-gateway/usage/providers/anthropic/) |
| 69 | +- [Google AI Studio](/ai-gateway/usage/providers/google-ai-studio/) |
| 70 | +- [xAI](/ai-gateway/usage/providers/grok/) |
| 71 | +- [Groq](/ai-gateway/usage/providers/groq/) |
0 commit comments