billing hacks
Platform SettingsMemory Config

Memory Configuration

Sometimes more memory = lower total cost.

TL;DR

Higher memory = more CPU = faster execution. Sometimes bumping memory from 512MB to 1024MB makes functions run 2x faster, cutting Active CPU time in half. Test both directions.

Memory affects cost in two ways:

  1. Direct: Higher memory = higher per-hour rate
  2. Indirect: Higher memory = more CPU = faster execution

Sometimes bumping memory lowers total cost.

The Math

Cost = (Provisioned Memory Rate × Time) + (Active CPU Rate × CPU Time)

If higher memory cuts CPU time significantly, you win.

Execution: 800ms CPU time
Memory rate: $0.0053/hour
Execution: 300ms CPU time (faster)
Memory rate: $0.016/hour

If Active CPU savings exceed the memory cost increase, higher memory wins.

Guidelines

WorkloadMemory
Auth checks, simple CRUD512 MB
Standard API routes1024 MB
Complex aggregations1536 MB
PDF/image generation2048+ MB

Configure Per-Route

vercel.json
{
  "functions": {
    "app/api/health/**": { "memory": 512, "maxDuration": 5 },
    "app/api/reports/**": { "memory": 2048, "maxDuration": 60 },
    "app/api/**": { "memory": 1024, "maxDuration": 30 }
  }
}

Routes match from most specific to least specific.


With platform settings done, see Rendering Strategy for code-level wins.

On this page