Vercel bill spike from image optimization or functions
What you'll seeSpend Management notifications at 50%, 75% and 100% of your amount
# and, if you turned on pausing, visitors get:
503: DEPLOYMENT_PAUSED
Find the metric that jumped on the Usage page, turn on Spend Management with pausing so it can't run away, then narrow which images can be optimized and rate limit the routes bots are hitting.
Why it happens
Image Optimization is billed per transformation (each cache miss or stale revalidation) plus cache reads and writes. Every extra width, format and quality multiplies the variants. Next.js warns that loose remotePatterns (for example leaving out the path, which implies a ** wildcard) may let other people optimize images you never intended.
Functions cost active CPU time and memory time. Bots crawling dynamic pages, routes with no caching, and functions that run until the timeout add up fast.
Fix it by hand
- Find the metric. In the dashboard open Usage, switch to the last 30 days, and break it down by project. Note whether Image Optimization, Functions or data transfer jumped.
- Set a ceiling. On Pro, go to Settings, Billing, Spend Management. Set the On-Demand Budget and enable Pause Production Deployments. Setting an amount alone doesn't stop usage, and Vercel checks every few minutes, so set it a little below your real maximum.
- Tighten images. Restrict
remotePatternsto your exact host and path:
Trimimages: { remotePatterns: [new URL('https://cdn.example.com/my-account/**')], formats: ['image/webp'], qualities: [75], minimumCacheTTL: 2678400, // 31 days, for images that rarely change }deviceSizesandimageSizesto the widths you use, and mark tiny iconsunoptimizedper image. - Rate limit expensive routes. In Firewall, add a rule with the Rate Limit action for your API or search routes. WAF rate limiting is available on all plans.
- Cap function time. Set a sensible
maxDurationper route, cache responses that don't change per user, and look for functions that call themselves.
Stop it happening again
- Keep Spend Management on with pausing enabled, at an amount you can afford to lose.
- Review
remotePatternswhenever you add an image source. - Add a rate limit rule to any route that calls a paid API or a database.
Bill Spiked $7
Bill Spiked finds image-optimizer wildcards, uncapped function durations, open endpoints and self-triggering calls in your code, and gives the Vercel spend checklist along with the other paid providers it detects.
- Finds the uncapped calls, loops and open endpoints that run up a bill, ranked by how much damage each can do.
- Adds the limits as diffs you approve, and gives a spending-cap checklist for each paid provider in your code.
- Verdict first. Every finding shows the file and line, what it breaks, and the fix as a diff that is applied only with your OK.
Bill Spiked: how it works, with examples · Install guide
Works with Claude Code, Claude.ai, Cursor, Codex and other agents that read SKILL.md files. No installs, no accounts, works offline. No-questions refund.