🔌 API Cost Calculator

Estimate your REST API infrastructure costs including compute servers, database, CDN, bandwidth, and monitoring. Plan your tech stack budget accurately.

📊 Infrastructure Cost Estimator
Traffic & Usage
Compute
Database & Storage
Networking
Other
📈 Monthly Cost Breakdown
Total Monthly Infrastructure Cost
Cost Distribution
Monthly vs Annual
⚠️ Prices shown in USD — all major cloud providers (AWS, GCP, Azure, DigitalOcean, Hetzner, Vultr) bill in USD globally. Estimates are approximate; actual costs vary by region, reserved vs on-demand pricing, and traffic patterns.
🔌

Configure your infrastructure to see cost estimates

Guide

About the API Cost Calculator

Last updated: August 2026 · Reviewed by the NeftCal editorial team

Hosting a REST API involves more than a single server bill — compute, database, object storage, CDN, egress bandwidth, and monitoring all add up, and the right mix of providers can mean a 5-10x cost difference for the same workload. This API cost calculator is a free API infrastructure cost estimator that helps developers, startups, and engineering leads project total monthly REST API hosting cost and compare providers like AWS, Hetzner, DigitalOcean, GCP, and Cloudflare before committing to an architecture.

What This Calculator Estimates

It sums six independent cost line items — compute (fixed VM or serverless/edge billing), managed database, object storage, CDN, egress bandwidth, and monitoring/logging — into a single total monthly infrastructure cost, then rolls that figure up into quarterly and annual projections. Each line item uses a specific provider's real published pricing structure rather than a single generic "cloud cost" average, so switching a dropdown from AWS to Hetzner or from a fixed VM to serverless immediately shows the dollar impact.

Who Should Use This Calculator

It's built for backend developers scoping a new API before writing infrastructure-as-code, startup founders projecting infrastructure burn rate ahead of a fundraising conversation, engineering leads comparing a Hetzner vs AWS cost migration, and agencies putting together a defensible infrastructure line item for a client proposal. It's equally useful for students and bootcamp graduates learning how the pieces of a typical backend bill (compute, database, storage, bandwidth) actually add up in dollar terms.

Why API Cost Estimation Matters

Egress bandwidth and compute are usually the biggest levers in a REST API budget — AWS charges roughly $0.09–$0.114/GB for egress versus Hetzner's ~$0.01/GB or Cloudflare's zero-egress model, and reserved VMs can be 3-5x cheaper than equivalent on-demand AWS/GCP instances. Estimating cost before launch, the same way teams already budget AI spend with a Cloud Cost Calculator or AI Token Calculator, turns "how much will this API cost per month" from a post-launch surprise into a number you control at design time.

Real-World Applications

  • Budgeting a new SaaS backend or mobile app API before choosing a hosting provider
  • Comparing a Hetzner vs AWS cost migration for an existing production API
  • Deciding between serverless (AWS Lambda / Cloud Run) and reserved VMs for a specific traffic pattern
  • Pairing with NeftCal's Data Transfer Cost Calculator and Cloud Storage Cost Calculator for a deeper egress and storage cost breakdown
  • Building a defensible infrastructure cost line item for a client proposal or internal budget request

Tips for Accurate Results

  • Use serverless pricing only if your traffic is genuinely spiky or low-volume — steady, predictable traffic is usually cheaper on reserved VMs once volume climbs
  • Factor in response compression (gzip/brotli), which typically cuts bandwidth costs by 60-80% and lowers your egress bandwidth cost directly
  • Revisit your storage provider choice as data grows — zero-egress options like Cloudflare R2 or Wasabi can beat a plain S3 comparison significantly once you serve a lot of data to end users
  • When comparing Cloudflare Workers pricing to AWS Lambda, remember Workers' flat-rate pricing can be cheaper for short, high-frequency calls, while Lambda can win for longer-running jobs
  • Re-run this estimate whenever traffic roughly doubles — the cheapest provider at low volume isn't always the cheapest one at scale
Formula

The Formula, Explained

How this API cost calculator turns your traffic and infrastructure choices into a monthly dollar total

Traffic Formula
Monthly Requests = Daily Requests × 30
Egress Bandwidth (GB) = (Monthly Requests × Avg Response Size in KB) ÷ 1,024 ÷ 1,024

Compute Cost Formula
Fixed VM: Compute Cost = Price per Server × Number of Servers
Serverless: Compute Cost = (max(0, Monthly Requests − 1,000,000) ÷ 1,000,000 × $0.20) + (max(0, Monthly Requests × (Exec Time ms ÷ 1,000) × (Memory MB ÷ 1,024) − 400,000) × $0.0000166667)
Cloudflare Workers: Compute Cost = $5 flat

Storage & Bandwidth Formulas
Object Storage Cost = Storage (GB) × Rate per GB/month
Bandwidth Cost = Egress Bandwidth (GB) × Egress Rate ($/GB)

Total Cost Formula
Total Monthly Cost = Compute + Database + Object Storage + CDN + Bandwidth + Monitoring
Quarterly Cost = Total Monthly Cost × 3  |  Annual Cost = Total Monthly Cost × 12
🖥️

Compute Pricing Models

Fixed VM pricing charges a flat monthly rate per server regardless of traffic; serverless charges per request and per GB-second of execution; Cloudflare Workers bundles a flat rate covering a fixed request allotment.

🌐

Egress Bandwidth Rate

The per-GB cost of data leaving your servers toward users, ranging from $0.09-$0.114/GB on AWS by region down to $0.01/GB on Hetzner or $0 on Cloudflare Workers.

🎁

Serverless Free-Tier Thresholds

The serverless formula models a 1,000,000 free requests and 400,000 free GB-seconds allowance per month before per-unit billing kicks in, matching AWS Lambda's published free tier.

⚙️ Why This Formula Works

Each line item mirrors how the underlying provider actually bills: fixed multiplication for flat-rate VMs, a two-part request-plus-duration formula for serverless (matching AWS Lambda's real pricing structure), and simple per-GB multiplication for storage and bandwidth. Summing independently-modeled line items, rather than one blended "cloud cost" number, keeps each provider's real pricing mechanics visible and lets you swap a single input to see its isolated dollar impact.

🎯 When to Use It

  • Early architecture planning, before provisioning any infrastructure
  • Comparing a specific provider migration (e.g., AWS to Hetzner) at the same traffic level
  • Deciding between serverless and reserved VM billing for your actual traffic pattern

📋 Assumptions

  • Daily request volume is roughly steady, with monthly volume simply days × 30
  • Average response size is representative across all endpoints, not just one route
  • Pricing reflects each provider's standard published on-demand rate

⚠️ Limitations of the Formula

  • Doesn't model reserved-instance or committed-use discounts (typically 30-70% off on-demand)
  • Fixed-VM compute assumes a static server count, not an auto-scaling group
  • Doesn't include request-based object storage operation fees (PUT/GET charges)
  • Egress and storage rates are point-in-time snapshots that providers update periodically
Walkthrough

Step-by-Step: How to Use the API Cost Calculator

From entering your traffic to reading your full monthly cost breakdown

Enter your traffic

Set your expected daily API requests and average response size in KB. These two numbers drive monthly request volume and the egress bandwidth calculation.

Choose a compute option

Pick a fixed-price VM tier from AWS, DigitalOcean, Hetzner, or GCP, or switch to serverless (setting execution time and memory) or Cloudflare Workers' flat-rate pricing.

Set your database plan

Choose a managed database tier, from a free-tier SQLite option up to a large multi-vCPU instance, based on your expected read/write load.

Configure object storage

Select a storage provider — AWS S3, Cloudflare R2, Backblaze B2, Wasabi, or Hetzner Object Storage — and enter your expected storage volume in GB.

Set CDN, egress region, and monitoring

Choose whether to enable a CDN tier, select your egress bandwidth pricing region or provider, and set a monthly monitoring/logging budget.

Calculate your cost

Click "Calculate Cost" to see your full monthly cost breakdown by line item, plus quarterly and annual projections and comparison charts.

Example

Worked Example

Using the calculator's own default scenario — 100,000 daily requests, AWS t3.large ×2, Standard database, 100GB S3 storage

Scenario

Suppose you're budgeting a production API on this calculator's defaults: 100,000 requests/day with a 5KB average response, two AWS t3.large servers, a Standard (2 vCPU, 8GB) managed database, 100GB of AWS S3 storage, a Basic CDN, AWS us-east-1 egress pricing, and a $30/month monitoring budget.

Daily Requests100,000
Avg Response Size5 KB
ComputeAWS t3.large ×2
DatabaseStandard (8GB)
Object Storage100GB (AWS S3)
CDN / EgressBasic CDN / us-east-1
Step 1 — Monthly requests: 100,000 × 30 = 3,000,000 requests/month.
Step 2 — Compute cost: AWS t3.large ($67/mo) × 2 servers = $134.00.
Step 3 — Database cost: Standard (2 vCPU, 8GB) tier = $100.00 flat.
Step 4 — Object storage cost: 100 GB × $0.023/GB (AWS S3) = $2.30.
Step 5 — Egress bandwidth: (3,000,000 × 5 KB) ÷ 1,024 ÷ 1,024 = 14.3 GB/month → 14.3 × $0.09/GB (AWS us-east-1) = $1.29.
Step 6 — CDN and monitoring: Basic CDN $20.00 + Monitoring (custom) $30.00 = $50.00.
Step 7 — Total monthly cost: $134.00 + $100.00 + $2.30 + $20.00 + $1.29 + $30.00 = $287.59/month.
Step 8 — Roll up to quarterly/annual: $287.59 × 3 = $862.77/quarter; $287.59 × 12 = $3,451.08/year.
Total Monthly
$287.59
Quarterly
$862.77
Annual
$3,451.08

Explanation: Compute ($134.00) and database ($100.00) together drive over 80% of this API's monthly bill, while egress bandwidth contributes just $1.29 at this traffic level — a reminder that bandwidth cost scales with response size and volume, and only becomes a major line item at much higher request counts or larger payloads. Swapping the two AWS t3.large servers for two Hetzner CX31 instances (~$10/mo each) would drop compute to $20.00 and cut the total monthly cost to roughly $173.59, illustrating the real savings a provider comparison can surface before you commit to an architecture.

Interpretation

Understanding Your Result

What your projected total monthly infrastructure cost generally implies

Monthly Cost RangeWhat It Generally MeansRecommended Next Step
Under $20Prototype or hobby-scale APIServerless or the smallest VM tier is likely sufficient — don't over-provision yet
$20 – $150Small production API or side projectMonitor traffic growth; a reserved VM is probably already the right call
$150 – $750Growing production workloadCompare providers seriously — a Hetzner or DigitalOcean move can meaningfully cut compute cost
$750 – $3,000Meaningful scale with several line items matteringEvaluate reserved/committed-use pricing and revisit your storage and egress provider choices
Over $3,000High-scale infrastructure spendConsider multi-cloud negotiation, CDN offload, and a dedicated infrastructure cost review

If compute and database dominate your total: that's typical — they're usually the two largest line items for a steady-traffic API. Focus optimization effort there first: right-sizing VM tiers, comparing providers, or evaluating reserved pricing usually moves the needle more than trimming CDN or monitoring spend.

If egress bandwidth looks unexpectedly small (or large): it scales directly with monthly requests × average response size, so a media-heavy API with large payloads will see this line item grow much faster than a lightweight JSON API at the same request volume.

These are cost estimates based on published on-demand list pricing, not exact invoices. Always reconcile projections against your provider's live billing dashboard once traffic is real.

ℹ️

This calculator provides planning estimates only. Actual charges depend on your provider's live pricing, region, reserved or negotiated rates, taxes, and any promotional credits on your account. Always verify against your provider's billing dashboard before finalizing a budget.

Use Cases

Practical Use Cases

Where estimating REST API infrastructure cost up front genuinely helps

💼

SaaS backend budgeting

Project the monthly infrastructure cost of a new SaaS product's backend before writing a line of deployment code.

📱

Mobile app backend infrastructure

Estimate the API cost behind a mobile app's login, sync, and data endpoints as daily active users grow.

🧩

Microservices cost allocation

Run the calculator per-service to understand which microservice actually drives the largest share of infrastructure spend.

🔗

Third-party API integration overhead

Budget the hosting cost of a proxy or middleware layer sitting in front of a third-party API you don't control.

🚀

Startup MVP budgeting

Fold projected infrastructure cost into a startup's monthly burn-rate model before the first fundraising conversation.

🏢

Enterprise procurement comparisons

Bring a side-by-side provider cost comparison into a vendor evaluation meeting instead of relying on list price alone.

🌍

Multi-region deployment planning

Model the egress and CDN cost delta of serving users across two or three regions instead of just one.

📈

Freemium-to-paid tier cost modeling

Estimate how infrastructure cost per user changes as a freemium product's traffic and storage footprint scale up.

🧾

Client cost estimates for agencies

Freelancers and dev agencies can generate a defensible infrastructure cost line item when quoting a backend project.

🛡️

Disaster recovery budgeting

Estimate the added cost of a standby region or redundant compute/storage setup for business continuity planning.

💰

API monetization pricing strategy

Understand your own infrastructure cost per request before setting usage-based pricing tiers for API customers.

⚙️

DevOps scaling decisions

Compare the cost of adding more fixed VMs against switching to serverless or an auto-scaling group at a given traffic level.

Pros & Cons

Benefits and Limitations

What this API cost calculator does well, and where it can't replace live billing data

✅ Benefits

  • Free, instant, and requires no signup or account
  • Runs entirely in your browser — no infrastructure details are uploaded to a server
  • Covers six major providers (AWS, DigitalOcean, Hetzner, GCP, plus serverless and Cloudflare Workers)
  • Six independent, itemized cost line items rather than one blended estimate
  • Supports both fixed-VM and serverless/edge billing models side by side
  • Compares five object storage providers, including zero-egress options
  • Egress rate comparison across eight regions and providers
  • Visual cost breakdown via pie and bar charts
  • Projects monthly, quarterly, and annual costs automatically
  • Downloadable plain-text summary of your estimate
  • Fast-loading, mobile-friendly, no account walls
  • Useful as a repeatable check whenever traffic or provider pricing changes

⚠️ Limitations

  • Doesn't account for reserved-instance or committed-use discounts
  • Doesn't model auto-scaling cost curves under variable or bursty traffic
  • Egress and storage rates are point-in-time snapshots that providers update periodically
  • Doesn't include support-plan, SLA, or premium-tier add-on costs
  • Doesn't model database read replicas or connection pooling overhead
  • Assumes roughly steady daily traffic, not seasonal or event-driven spikes
  • Response compression savings (gzip/brotli) aren't automatically modeled
  • Doesn't include one-time setup, migration, or engineering time costs
  • Not a substitute for your cloud provider's live billing dashboard
Reference

Compute Provider Cost Comparison

Monthly compute cost, egress rate, and best-fit scenario at this calculator's default 100,000 requests/day traffic level

Compute OptionMonthly Compute CostTypical Egress RateBest For
AWS t3.large ×2 (fixed VM)$134.00$0.09–$0.114/GBSteady, predictable production traffic on AWS
GCP e2-standard-2 ×2$96.00$0.08/GBGCP-native stacks needing tight platform integration
DigitalOcean Basic 4GB ×2$48.00$0.005/GB (after 1TB free)Simple, predictable small-to-mid APIs
Hetzner CX31 ×2$20.00$0.01/GBCost-sensitive, EU-friendly workloads
AWS Lambda (serverless)~$0.40*$0.09/GBSpiky or low-volume traffic under ~100K req/day
Cloudflare Workers$5.00 flat$0 (zero egress)Edge-native, globally distributed APIs

*At this calculator's default 100,000 daily requests, 100ms execution time, and 512MB memory allocation — well within Lambda's free-tier GB-second allowance, so only the request-count charge applies.

Common Mistakes and Expert Tips

❌ Common Mistakes

  • Comparing only compute price and ignoring egress bandwidth, which can dominate cost at high traffic or large payload sizes
  • Assuming serverless is always cheaper — steady, high-volume traffic often favors reserved VMs instead
  • Picking a storage provider by sticker price alone without checking its egress fees
  • Forgetting to budget for monitoring and logging, which can add $13-$50+/month at scale
  • Treating this calculator's estimate as a final invoice instead of a planning figure
  • Not re-running the estimate after traffic roughly doubles

💡 Expert Tips & Best Practices

  • Pair this API Cost Calculator with the Cloud Cost Calculator for a broader multi-service AWS/GCP/Azure comparison
  • Cross-check bandwidth needs against the Bandwidth Calculator before committing to an egress-heavy architecture
  • Enable response compression (gzip/brotli) to cut egress bandwidth cost by 60-80% before switching providers
  • Re-evaluate reserved vs on-demand pricing once traffic has been predictable for three or more months
  • Use a zero-egress storage provider (Cloudflare R2, Wasabi) if you serve large files directly to end users
📝

Summary: This API cost calculator gives you an instant, free, itemized projection of REST API infrastructure cost across compute, database, storage, CDN, bandwidth, and monitoring — using real provider pricing — so you can budget an API before you build it instead of guessing. Pair it with the Cloud Storage Cost Calculator and Data Transfer Cost Calculator for a deeper look at your storage and bandwidth line items.

FAQ

Frequently Asked Questions

Common questions about API cost calculator estimates

What is the cheapest way to host an API?
For low traffic: Serverless (AWS Lambda + API Gateway, Google Cloud Run) can be near-free under free tier limits (1M requests/month free). For steady traffic: reserved VMs on DigitalOcean, Hetzner, or Vultr are often 3-5× cheaper than AWS/GCP on-demand. Cloudflare Workers at $5/month for 10M requests is compelling for globally distributed APIs — with zero egress fees. Always compare reserved instance pricing vs on-demand for predictable workloads.
How do I reduce API hosting costs?
Key strategies: (1) Use auto-scaling to pay only for what you use; (2) Enable response compression (60-80% bandwidth savings); (3) Implement caching at CDN and application layer; (4) Use reserved instances for predictable baseline load; (5) Optimize database queries to reduce compute time; (6) Switch from AWS S3 to Cloudflare R2 or Backblaze B2 — R2 has zero egress, B2 is 4× cheaper than S3; (7) Consider Hetzner for compute at 3-5× savings vs AWS.
What is egress pricing and why does it matter?
Egress is the cost of data transferred OUT from your cloud provider to the internet. AWS charges $0.09/GB (us-east-1), $0.109/GB (Mumbai), $0.114/GB (Tokyo). Hetzner charges $0.01/GB — about 10× cheaper. Cloudflare Workers and Cloudflare R2 have zero egress fees. For a high-traffic API serving 5KB responses at 1M requests/day (150GB/month): ~$13.50/month on AWS us-east-1, vs ~$1.50/month on Hetzner, vs $0 on Cloudflare.
Should I use serverless or traditional VMs for my API?
Use serverless when: traffic is unpredictable or spiky, you have <100K requests/day, or you want zero ops overhead. AWS Lambda costs $0.20 per 1M requests + compute time — at 100ms/512MB, 1M requests/day runs ~$24/month. Use VMs when: traffic is steady and predictable (reserved VMs are 5-10× cheaper at scale), you need persistent connections, or have heavy background processing. Cloudflare Workers is a strong middle ground: edge-native, zero egress, $5/month for 10M requests.
How accurate are the cost estimates in this API cost calculator?
Estimates use each provider's published on-demand list pricing as of mid-2026 for compute, storage, egress, and monitoring line items. They don't include negotiated enterprise discounts, reserved/committed-use pricing, taxes, or promotional credits. Treat the total as a planning figure and confirm against your provider's own pricing calculator or billing dashboard before finalizing a budget.
What counts toward the Object Storage cost line item?
It's your chosen provider's per-GB monthly storage rate (AWS S3, Cloudflare R2, Backblaze B2, Wasabi, or Hetzner Object Storage) multiplied by the GB of data you enter. It does not include separate request-based charges (PUT/GET operations) or egress fees, which most providers bill separately — egress is covered by this calculator's own Egress Pricing field.
How is the serverless compute cost calculated?
It mirrors AWS Lambda-style billing: monthly requests beyond the first 1,000,000 free requests are billed at $0.20 per million, and GB-seconds (monthly requests × execution time in seconds × memory in GB) beyond a 400,000 GB-second free tier are billed at $0.0000166667 per GB-second. Low-traffic or short-duration workloads often land entirely within the free tier and cost close to $0.
Why does Cloudflare Workers show a flat $5/month regardless of traffic?
This calculator models Cloudflare Workers' paid plan starting price, which bundles 10 million requests per month for a flat $5, with additional requests billed beyond that. It doesn't scale line-by-line with the same request/GB-second math as Lambda, so selecting it simplifies the compute estimate to a flat figure rather than a usage-based one, and it also zeroes out the egress rate automatically.
What database costs should I budget beyond the listed tiers?
The four database tiers here (free, $25, $100, $300/month) cover single-instance managed database pricing only. Budget separately for read replicas (often +50-100% per replica), automated backups beyond the included retention window, multi-region replication (typically 2-3× a single region), and connection pooling services like RDS Proxy or PgBouncer if your API has many concurrent connections.
How much does a CDN typically add to API hosting costs?
This calculator models a basic CDN at roughly $20/month flat and an advanced tier at $50/month, which suits most small-to-mid APIs. A CDN is most valuable when you're serving cacheable responses or static assets to users spread across multiple regions or continents; for a single-region API with a small user base, it often adds cost without proportional latency benefit.
What's the difference between this calculator and the AI Token Calculator?
This API Cost Calculator estimates general REST API infrastructure costs — compute, database, object storage, CDN, egress bandwidth, and monitoring — for any backend service. The AI Token Calculator instead estimates AI/LLM API spend based on token usage and per-model pricing for providers like OpenAI, Anthropic, and Google. Use this calculator for infrastructure budgeting and the AI Token Calculator for AI model spend specifically.
How do reserved instances compare to on-demand pricing?
This calculator's VM tiers reflect on-demand, pay-as-you-go pricing. Reserved instances (1-3 year commitments) on AWS and GCP typically cost 30-70% less than the on-demand rate shown here for the same instance type, in exchange for a usage commitment. If your traffic has been steady for several months, re-price your chosen tier against the provider's reserved-instance calculator before committing.
Does this calculator account for auto-scaling costs?
No — the fixed-VM compute option assumes a static number of always-on servers at the tier and count you specify, not a scaling group that grows and shrinks with load. To approximate auto-scaling, estimate an average server count across your traffic pattern (peak and off-peak blended), or model peak and off-peak scenarios separately and compare the results.
What monitoring and logging costs should I expect?
This calculator's presets range from $0 (self-hosted Grafana + Prometheus, or Grafana Cloud's free tier up to 50GB logs) to roughly $13-$25/month for hosted options like AWS CloudWatch or Better Stack, up to $46/month modeled for Datadog across two hosts. Actual cost scales with log volume, metric cardinality, and retention period, so treat these as starting-point estimates.
How often should I re-run this API cost estimate?
Re-run it whenever your daily request volume roughly doubles, whenever you add a new infrastructure component (a cache layer, a second region, a new storage bucket), and at least quarterly to catch provider pricing changes. The cheapest provider or compute tier at low volume isn't always the cheapest choice once traffic scales up significantly.
What's a realistic monthly budget for a small SaaS backend API?
Using this calculator's own defaults — 100,000 requests/day, two mid-tier AWS servers, a standard managed database, 100GB of S3 storage, a basic CDN, and light monitoring — the estimated total lands around $288/month. A leaner stack on Hetzner or DigitalOcean with the same traffic can bring that closer to $80-$120/month, illustrating how much provider choice alone affects the bill.
Learn More

Authoritative Resources

Official documentation to complement this calculator — always verify live rates before finalizing a budget

Related Calculators

Explore other AI and tech tools