# Upstash bills per command: budget caps and batching before you ship
## The math
Pay as you go is $0.2 per 100K commands. REST calls bill the same as
protocol commands. A handler that fires 10 Redis commands per request,
at 1M requests a month, is 10M commands: about $20 in command charges
alone.
## Set a budget cap first
Budget caps exist on pay-as-you-go databases. You get email alerts at
70% and 90% of the cap, and past the cap the database is rate limited
so cost cannot exceed the budget. Set the cap when you create the
database, not after the first surprise invoice.
Note: the free tiers 500K monthly commands and 256MB are not free on
top of paid tiers. Once you upgrade, everything is metered.
## Kill chatty patterns
The usual offenders:
- await-in-a-loop: N keys fetched one per iteration. Replace with one
MGET, one /pipeline call, or Promise.all with auto-pipelining.
- Middleware that hits Redis on every request with several commands.
Batch to one call.
- Rate limiting with the sliding window algorithm costs 4-5 commands per
limit() call. Fixed window costs 2-3. At high request volume the
algorithm choice is a line item.
## Fixed plans
If your load is predictable, fixed plans have no per-command billing at
all: you pay for data size, bandwidth, and throughput instead.