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 infrastructure costs behind running OptStuff, so you can understand the cost floor per request and reason about how to price your own instance.
Provider pricing changes. The example figures below were checked against the linked provider pricing pages on 2026-07-04; verify the source pages before using these numbers for billing decisions.
Infrastructure Stack
OptStuff runs on a serverless-first stack. Each service has its own billing model:
| Service | Role | Billing Model |
|---|---|---|
| Vercel | Hosting + serverless functions | Invocations + CPU time + memory + bandwidth |
| Neon | PostgreSQL (teams, projects, keys, logs) | Compute Units (CU-hours) + storage |
| Upstash | Redis (config cache + rate limiting) | Per-command |
| Clerk | User authentication | Monthly 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.
| Item | Value |
|---|---|
| Price | $0.60 per 1M invocations (checked 2026-07-04 — source: Vercel Pricing) |
| Free tier (Hobby/Pro) | First 1M/month included (checked 2026-07-04 — source: Vercel Pricing) |
| Per-request cost | $0.0000006 (derived from Vercel invocation pricing checked 2026-07-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.
| Item | Value |
|---|---|
| Rate (US region) | ~$0.128 per CPU-hour (checked 2026-07-04 — source: Vercel Pricing) |
| Typical image transform | 50–200ms CPU time |
| Estimate at 100ms | $0.128 / 3,600 × 0.1 = $0.0000036 (derived from Vercel CPU pricing checked 2026-07-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.
| Item | Value |
|---|---|
| Rate (US region) | ~$0.0106 per GB-hour (checked 2026-07-04 — source: Vercel Pricing) |
| Function memory | ~256MB (0.25 GB) |
| Instance lifetime | ~300ms (including I/O) |
| Cost | 0.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.
| Item | Value |
|---|---|
| Rate | $0.20 per 100K commands (checked 2026-07-04 — source: Upstash Redis Pricing) |
| Commands per request | ~4 |
| Per-request cost | 4 × $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.
| Item | Value |
|---|---|
| Rate (Launch plan) | $0.106 per CU-hour (checked 2026-07-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 checked 2026-07-04 — source: Neon Pricing) |
6. Vercel Bandwidth
Optimized images are served as response bytes. This is often the largest variable cost.
| Item | Value |
|---|---|
| Pro plan included | 1 TB/month (checked 2026-07-04 — source: Vercel Pricing) |
| Overage rate | $0.15 per GB (checked 2026-07-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 checked 2026-07-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
| Component | Cost per Request | % of Total |
|---|---|---|
| Vercel CPU | $0.0000036 | 12.7% |
| Vercel Bandwidth | $0.0000150 | 52.8% |
| Upstash Redis | $0.0000080 | 28.2% |
| Neon PostgreSQL | $0.0000010 | 3.5% |
| Vercel Invocation | $0.0000006 | 2.1% |
| Vercel Memory | $0.0000002 | 0.7% |
| Total | ~$0.0000284 | 100% |
Scaled up:
| Volume | Variable 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:
| Service | Free Tier | Paid Tier | When You Need Paid |
|---|---|---|---|
| Vercel | Hobby (free) | Pro $20/mo | Commercial use, team features |
| Neon | 100 CU-hours + 0.5GB per project | Launch usage-based, typical intermittent-load spend ~$15/mo | >100 CU-hours, larger storage, or production support needs |
| Upstash | 500K commands/month | Pay-as-you-go or $10/mo fixed | >500K commands/month or predictable fixed-plan needs |
| Clerk | 50,000 monthly retained users (MRUs) | Pro $25/mo ($20/mo billed annually) | >50,000 MRUs, passkeys, custom branding, or advanced features |
Minimum Monthly Cost Scenarios
| Scenario | Vercel | Neon | Upstash | Clerk | Total Fixed |
|---|---|---|---|---|---|
| Hobby / Side project | $0 | $0 | $0 | $0 | $0/mo |
| Small production | $20 | $0 | $0 | $0 | $20/mo |
| Full production example | $20 | ~$15 | $10 | $25 | ~$70/mo |
Total Cost Model
Monthly Cost = Fixed Costs + (Per-Request Cost × Request Volume)| Monthly Volume | Free Stack | Full Production Stack |
|---|---|---|
| 10,000 | $0 + $0.28 = $0.28 | $70 + $0.28 = $70.28 |
| 100,000 | $0 + $2.84 = $2.84 | $70 + $2.84 = $72.84 |
| 1,000,000 | Over free limits | $70 + $28.40 = $98.40 |
At 1M requests/month on the full production example, 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:
| Volume | Effective Cost per 1K Requests |
|---|---|
| 10,000/mo | $7.03 per 1K (fixed costs dominate) |
| 100,000/mo | $0.73 per 1K |
| 1,000,000/mo | $0.10 per 1K (approaching marginal cost) |
Step 2: Compare with Alternatives
| Service | Cost per 1K Optimizations | Source (checked 2026-07-04) |
|---|---|---|
| Cloudinary | Credit-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 |
| imgix | Credit bundles: tiered roughly $0.12-$0.25 per credit depending on bundle and billing term; delivery is currently listed as 1 credit/GB, while transformations vary by feature. | https://www.imgix.com/pricing |
| Vercel Image Optimization | Usage-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 1K | Derived from this page |
| OptStuff (self-hosted, 1M/mo) | ~$0.10 per 1K | Derived 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:
| Tier | Price per 1K | Margin 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%) |
| Enterprise | Custom | Volume 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
- Bandwidth is the largest variable cost (~53% per request) — CDN caching is your best cost optimization lever
- Fixed costs dominate at low volume — the free tiers of Vercel/Neon/Upstash/Clerk make it possible to start at $0/month
- Marginal cost is very low (~$0.03 per 1K requests) — at scale, OptStuff is significantly cheaper than commercial alternatives
- 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
Related Documentation
- CDN and Caching — Maximize cache hit ratio to reduce costs
- Usage Metrics Calculations — Exact formulas, data sources, and sampling caveats for dashboard metrics
- Rate Limiting — Protect against cost spikes from abuse
- Deployment Guide — Deploy your own instance
- Environment Variables — Configure your infrastructure connections
Last updated on