OptStuff

Cost Analysis & Pricing Strategy

How to reason about OptStuff's per-request cost — Vercel serverless, Neon PostgreSQL, Upstash Redis, Clerk auth, and how to set your pricing.

This page walks through the actual infrastructure costs behind running OptStuff, so you can understand the cost floor per request and reason about how to price your own instance.

Infrastructure Stack

OptStuff runs on a serverless-first stack. Each service has its own billing model:

ServiceRoleBilling Model
VercelHosting + serverless functionsInvocations + CPU time + memory + bandwidth
NeonPostgreSQL (teams, projects, keys, logs)Compute Units (CU-hours) + storage
UpstashRedis (config cache + rate limiting)Per-command
ClerkUser authenticationMonthly Active Users (MAU)

Per-Request Cost Breakdown

When a browser requests an optimized image, here's what happens and what it costs:

1. Vercel Function Invocation

Every image request triggers one serverless function invocation.

ItemValue
Price$0.60 per 1M invocations (as of 2026-03-04 — source: Vercel Pricing)
Free tier (Hobby/Pro)First 1M/month included (as of 2026-03-04 — source: Vercel Pricing)
Per-request cost$0.0000006 (derived from Vercel invocation pricing as of 2026-03-04 — source: Vercel Pricing)

2. Vercel Active CPU

Image processing (Sharp/IPX resize, format conversion) is CPU-intensive. Vercel's Fluid Compute bills only for active CPU time — I/O wait (Redis, DB queries) is free.

ItemValue
Rate (US region)~$0.128 per CPU-hour (as of 2026-03-04 — source: Vercel Pricing)
Typical image transform50–200ms CPU time
Estimate at 100ms$0.128 / 3,600 × 0.1 = $0.0000036 (derived from Vercel CPU pricing as of 2026-03-04 — source: Vercel Pricing)

Simple resizes (e.g., w_400) take ~50ms. Heavy operations (large source + format conversion to AVIF) can reach 200ms+. The 100ms estimate is a reasonable midpoint for WebP output.

3. Vercel Provisioned Memory

Memory is billed for the entire function instance lifetime (including I/O wait), not just CPU time.

ItemValue
Rate (US region)~$0.0106 per GB-hour (as of 2026-03-04 — source: Vercel Pricing)
Function memory~256MB (0.25 GB)
Instance lifetime~300ms (including I/O)
Cost0.25 × (0.3 / 3,600) × $0.0106 = $0.0000002 (derived from Vercel memory pricing as of 2026-03-04 — source: Vercel Pricing)

Memory cost is negligible compared to CPU cost.

4. Upstash Redis

Each request makes 3–5 Redis commands: config cache lookup, rate limit checks (day + minute), and usage throttle.

ItemValue
Rate$0.20 per 100K commands (as of 2026-03-04 — source: Upstash Redis Pricing)
Commands per request~4
Per-request cost4 × $0.000002 = $0.000008 (derived from Upstash pricing as of 2026-03-04 — source: Upstash Redis Pricing)

5. Neon PostgreSQL

Most requests hit the Redis config cache (60s TTL). Only cache misses or first requests for a key trigger a DB query. Background tasks (request logging, usage updates) are throttled to reduce DB load.

ItemValue
Rate (Launch plan)$0.106 per CU-hour (as of 2026-03-04 — source: Neon Pricing)
DB queries per request~0.05 (amortized, most hit cache)
Background write cost~0.02 queries amortized (throttled)
Per-request cost~$0.000001 (amortized; derived from Neon pricing as of 2026-03-04 — source: Neon Pricing)

6. Vercel Bandwidth

Optimized images are served as response bytes. This is often the largest variable cost.

ItemValue
Pro plan included1 TB/month (as of 2026-03-04 — source: Vercel Pricing)
Overage rate$0.15 per GB (as of 2026-03-04 — source: Vercel Pricing)
Average optimized image~80–150 KB
Estimate at 100 KB$0.15 / 1,000,000 × 100 = $0.000015 (derived from Vercel bandwidth pricing as of 2026-03-04 — source: Vercel Pricing)

With a CDN in front (Cloudflare, CloudFront), most repeat requests are served from CDN cache and never reach Vercel. Actual bandwidth cost depends heavily on your CDN cache hit ratio.

Do not use request-log-derived dashboard metrics (for example, Bandwidth Savings) as billing/accounting numbers. Those analytics can be sampled and are intended for operational trend analysis. For exact metric formulas and interpretation boundaries, see Usage Metrics Calculations.

Per-Request Cost Summary

ComponentCost per Request% of Total
Vercel CPU$0.000003612.7%
Vercel Bandwidth$0.000015052.8%
Upstash Redis$0.000008028.2%
Neon PostgreSQL$0.00000103.5%
Vercel Invocation$0.00000062.1%
Vercel Memory$0.00000020.7%
Total~$0.0000284100%

Scaled up:

VolumeVariable Cost
1,000 requests~$0.03
10,000 requests~$0.28
100,000 requests~$2.84
1,000,000 requests~$28.40

Monthly Fixed Costs

Beyond per-request costs, there are fixed monthly platform fees:

ServiceFree TierPaid TierWhen You Need Paid
VercelHobby (free)Pro $20/moCommercial use, team features
Neon100 CU-hours + 0.5GBLaunch $19/mo>100 CU-hours or >0.5GB storage
Upstash10K commands/dayPay-as-you-go or $10/mo fixed>10K commands/day
Clerk10,000 MAUPro $20/mo>10,000 MAU or advanced features

Minimum Monthly Cost Scenarios

ScenarioVercelNeonUpstashClerkTotal Fixed
Hobby / Side project$0$0$0$0$0/mo
Small production$20$0$0$0$20/mo
Full production$20$19$10$20$69/mo

Total Cost Model

Monthly Cost = Fixed Costs + (Per-Request Cost × Request Volume)
Monthly VolumeFree StackFull Production Stack
10,000$0 + $0.28 = $0.28$69 + $0.28 = $69.28
100,000$0 + $2.84 = $2.84$69 + $2.84 = $71.84
1,000,000Over free limits$69 + $28.40 = $97.40

At 1M requests/month on full production stack, the effective cost per request is ~$0.0001 ($0.10 per 1,000 requests).

Pricing Strategy

Step 1: Identify Your Cost Floor

From the analysis above, the marginal cost per request is ~$0.00003. But the real cost floor is dominated by fixed costs at low volume:

VolumeEffective Cost per 1K Requests
10,000/mo$6.93 per 1K (fixed costs dominate)
100,000/mo$0.72 per 1K
1,000,000/mo$0.10 per 1K (approaching marginal cost)

Step 2: Compare with Alternatives

ServiceCost per 1K OptimizationsSource (as of 2026-03-04)
CloudinaryCredit-based tiers: Free 25 credits/mo, Plus 225 credits/mo, Advanced 600 credits/mo (usage is credit-based, not fixed per-1K).https://cloudinary.com/pricing
imgixCredit bundles: tiered ~$0.14-$0.25 per credit, with ~1-2 credits per GB depending on operation.https://www.imgix.com/pricing
Vercel Image OptimizationUsage-based: ~$0.05-$0.0812 per 1K transformations, plus cache read ~$0.40-$0.64 per 1M and cache write ~$4.00-$6.40 per 1M.https://vercel.com/docs/image-optimization/limits-and-pricing
OptStuff (self-hosted, 100K/mo)~$0.72 per 1KDerived from this page
OptStuff (self-hosted, 1M/mo)~$0.10 per 1KDerived from this page

Self-hosted OptStuff becomes very cost-competitive at scale because the per-request marginal cost is low and there are no per-optimization fees.

Step 3: Set Your Margin

If you're offering OptStuff as a hosted service, consider this framework:

TierPrice per 1KMargin at 1M/mo Volume
Free$0 (first 10K/mo)Loss leader for acquisition
Starter$0.50 per 1K~$0.40 profit per 1K (80%)
Pro$0.30 per 1K~$0.20 profit per 1K (67%)
EnterpriseCustomVolume discount, still >50% margin

Step 4: Anchor on Value, Not Cost

The cost analysis gives you a floor, but pricing should reflect value delivered:

  • An e-commerce site converting images to WebP might save 50%+ bandwidth costs
  • A media site serving 10M images/month from a CDN saves thousands vs. Cloudinary
  • The engineering time saved by not building an image pipeline has its own value

Price based on the value you create, not the infrastructure cost you incur.

Key Takeaways

  1. Bandwidth is the largest variable cost (~53% per request) — CDN caching is your best cost optimization lever
  2. Fixed costs dominate at low volume — the free tiers of Vercel/Neon/Upstash/Clerk make it possible to start at $0/month
  3. Marginal cost is very low (~$0.03 per 1K requests) — at scale, OptStuff is significantly cheaper than commercial alternatives
  4. CDN cache hit ratio is the single most impactful cost factor — a 90% cache hit ratio means only 10% of requests reach your serverless functions

Last updated on

On this page