DEV Community

Muhammed ali Ceylan
Muhammed ali Ceylan

Posted on • Originally published at Medium

How I Got a $340 AWS Bill from a Side Project (And What I Built to Prevent It)

The invoice arrived on a Tuesday morning.

$340. For a side project I'd built in a weekend. A small LLM-powered summarization tool — users paste text, model returns a summary. I'd done the math before launching: roughly $0.002 per request, ~500 requests/day, around $30/month. Totally fine.

What I hadn't accounted for:

system_prompt_tokens = 800
requests_per_day = 2000 # not 500 — it went viral in a group chat
input_price_per_1M = 2.50 # GPT-4o

daily_cost = (800 * 2000 / 1_000_000) * 2.50

= $4.00/day → $120/month just from system prompts

Plus the actual user input tokens. Plus output tokens. $340 later, I had learned my lesson.

The Real Problem: API Pricing Is Designed to Be Hard to Compare
Every provider uses different units:

OpenAI → per million tokens (input vs output, different rates)
Pinecone → read units + write units + storage GB/month
Stripe → % of transaction + fixed fee + monthly platform fee
AWS Lambda → per GB-second + per request + data transfer
None of it is comparable at a glance. You end up either building a spreadsheet from scratch every time or just guessing — and guessing gets expensive.

What I Built
After the invoice incident I started keeping a cost estimation spreadsheet. It grew. Eventually I turned it into APICalculators.com — 16 free, browser-based calculators covering the infrastructure decisions most AI/SaaS developers face:

LLM APIs

GPT-4o, Claude Sonnet, Gemini Flash, Llama — cost by model, context length, daily volume
Side-by-side comparison at your exact usage
Vector Databases

Pinecone vs Qdrant vs Supabase vs Weaviate
Enter index size + queries/day → monthly cost
Serverless

AWS Lambda vs Cloudflare Workers vs Vercel Functions
Cost at your invocation volume and memory config
Auth Providers

Clerk vs Auth0 vs Supabase Auth vs Cognito
Monthly cost by MAU tier
Payment Processors

Stripe vs Paddle vs Lemon Squeezy
Real fee comparison on your transaction volume
The System Prompt Problem, Solved in 30 Seconds
Here's what the LLM cost calculator would have shown me before I shipped:

Model: GPT-4o
System prompt: 800 tokens
Avg user input: 200 tokens

Avg output: 150 tokens
Requests/day: 2,000

→ Input cost: (800+200) × 2,000 / 1M × $2.50 = $5.00/day
→ Output cost: 150 × 2,000 / 1M × $10.00 = $3.00/day
→ Monthly: $240

vs my estimate of $30. 8x off.
The fix was obvious once I saw it: cache the system prompt, shorten it, switch to a cheaper model for summarization. Cut the cost by 70%.

Everything Runs in Your Browser
No signup. No data sent anywhere. All calculations happen client-side — your usage numbers never leave your machine.

If you're building anything that touches LLM APIs, vector databases, or cloud infrastructure, check your numbers before you ship.

Surprise invoices are optional.

What's the most unexpected cloud bill you've received? Drop it in the comments.

Top comments (0)