# AI Gateway Gets Spend Limits: Put a Dollar Cap on Your AI Costs!

Hey there, it's me! Ever glanced at your AI bill and felt a little jolt of panic? Today's update is here to soothe exactly that worry, and I'm excited to share it.

## What was announced?

Straight from Cloudflare's Changelog: [AI Gateway](https://developers.cloudflare.com/ai-gateway/) now supports **spend limits** — cost-based budgets in dollars. Once your cumulative spend crosses the budget, it blocks further requests for you.

## The story so far

Up to now, rate limiting only capped how many requests you could make. But even if you throttle the count, calling a pricey model a lot means you still couldn't directly control the actual bill. Spend limits track the **real cost** based on token usage and model pricing — that's the fundamental difference.

## What changes

You can now set budgets in actual money. For example, give each user a $200/day budget, cap total gateway spend at $10,000/day, or limit a specific model to $50/day per user. So you can build a wall before an unexpected charge blows up your wallet.

## Dive Deep

You can scope limits by **model, provider, or custom metadata**. Because you can slice by custom metadata, splitting budgets per user or per team is totally up to you.

Each rule uses a configurable time window, and you can pick fixed or sliding enforcement.

Spend limits work with both [Unified Billing](https://developers.cloudflare.com/ai-gateway/features/unified-billing/) and [BYOK](https://developers.cloudflare.com/ai-gateway/configuration/bring-your-own-keys/) for models with known pricing. Full setup details live in the [spend limits documentation](https://developers.cloudflare.com/ai-gateway/features/spend-limits/), so peek in if you're curious.

## Wrap-up

- AI Gateway now supports spend limits, letting you control AI costs with dollar-based budgets
- Unlike rate limiting (request counts), it tracks **real cost** from token usage and model pricing
- Scope limits by model, provider, or custom metadata, with fixed or sliding time windows
- Works with both Unified Billing and BYOK for models with known pricing

This one is perfect for ops teams anxious about runaway LLM costs, or SaaS builders who want to carve out a budget per user!
