-
Notifications
You must be signed in to change notification settings - Fork 16.2k
[Workers AI, AI Gateway] Document unified billing #32561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/content/changelog/ai-gateway/2026-08-07-workers-ai-unified-billing.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| --- | ||
| title: Workers AI and AI Gateway unify model access and billing | ||
| description: Call Workers AI and third-party models through shared APIs, observability, and prepaid billing. | ||
| products: | ||
| - ai-gateway | ||
| - workers-ai | ||
| date: 2026-08-07 | ||
| --- | ||
|
|
||
| import { TypeScriptExample } from "~/components"; | ||
|
|
||
| Workers AI and AI Gateway now provide a unified path for accessing models and managing inference traffic. Use the same AI binding and REST API to call models hosted on Workers AI or by supported third-party providers, with AI Gateway providing observability, logging, caching, security, and billing controls. | ||
|
|
||
| ## Unified entrypoints and observability | ||
|
|
||
| The [AI binding](/ai-gateway/usage/worker-binding-methods/) supports both Workers AI and third-party models through `env.AI.run()`. The [REST API](/ai-gateway/usage/rest-api/) provides shared `/ai/` endpoints with Cloudflare authentication across providers. | ||
|
|
||
| Route a Workers AI request through AI Gateway by specifying a gateway ID. Use `default` to automatically create a gateway on the first authenticated request, or specify an existing gateway to separate applications and workloads: | ||
|
|
||
| <TypeScriptExample> | ||
|
|
||
| ```ts | ||
| const response = await env.AI.run( | ||
| "@cf/zai-org/glm-5.2", | ||
| { | ||
| messages: [{ role: "user", content: "What is the capital of France?" }], | ||
| }, | ||
| { | ||
| gateway: { id: "default" }, | ||
| }, | ||
| ); | ||
| ``` | ||
|
|
||
| </TypeScriptExample> | ||
|
|
||
| Requests routed through AI Gateway can be logged and included in analytics for request volume, errors, latency, token usage, and costs. You can also configure controls such as caching, rate limiting, and request retries on the gateway. | ||
|
|
||
| ## Unified billing and higher rate limits | ||
|
|
||
| You can now use prepaid [AI Gateway credits](/ai-gateway/features/unified-billing/) to pay for Workers AI inference. This provides one credit balance for Workers AI and supported third-party model providers. To use credits for Workers AI, set the gateway's [Workers AI billing setting](/ai-gateway/configuration/manage-gateway/#configure-workers-ai-billing) to **Unified billing**. Workers AI requests routed through that gateway deduct from your credit balance in real time. | ||
|
|
||
| Prepaid credits also provide access to the following Workers AI frontier models without requiring the Workers Paid plan. Each frontier Workers AI model has a rate limit of 50 requests per minute per account, per model when billed with AI Gateway credits, compared to 20 requests per minute through standard Workers AI billing: | ||
|
|
||
| - [`@cf/moonshotai/kimi-k2.6`](/workers-ai/models/kimi-k2.6/) | ||
| - [`@cf/moonshotai/kimi-k2.7-code`](/workers-ai/models/kimi-k2.7-code/) | ||
| - [`@cf/zai-org/glm-5.2`](/workers-ai/models/glm-5.2/) | ||
|
|
||
| These limits are designed for typical agentic and coding workloads, where requests to frontier models can take longer to complete. | ||
|
|
||
| For details, refer to [Workers AI limits](/workers-ai/platform/limits/), [Workers AI pricing](/workers-ai/platform/pricing/), [Unified Billing](/ai-gateway/features/unified-billing/), and the [AI Gateway model catalog](/ai/models/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.