The true cost of building AI billing in-house
Two engineers, four months, and a permanent owner after launch. A line-by-line estimate of what in-house AI billing costs in people and AWS infrastructure over three years.

Engineering teams usually estimate an in-house billing system the way they estimate a feature: a few sprints, a couple of developers, some infrastructure that is "basically free" at current volume. The real bill only becomes visible a year later, spread across salaries, cloud invoices, incidents, and roadmap work that never shipped.
A production-grade AI billing system has seven parts: an ingestion tier, two event streams, rating workers, Redis, a relational ledger, ClickHouse, and an S3 archive. Priced out for a US team at moderate scale, that design costs about $735,000 over three years, and more than 90% of it is engineering time.
All prices are October 2026 list prices, rounded. Treat them as estimates: every assumption is stated below so you can swap in your own numbers.
The assumptions
Architecture: AWS in us-east-1, with ECS on EC2 for ingestion and rating workers behind a load balancer, two Kinesis Data Streams (on-demand), a consumer on EC2, self-managed ClickHouse on EC2, Upstash Redis, Supabase as the relational store, and S3 for archives.
Event size: About 1 KB per usage event, and about 1.2 KB per rated record on the second stream.
Volume tiers: Three levels of monthly usage events:
| Tier | Usage events per month | Rough profile |
|---|---|---|
| Starter | 10 million | A few dozen paying customers, early product |
| Growth | 100 million | Hundreds of customers, a few enterprise accounts |
| Scale | 1 billion | Agent-heavy product, large enterprise workloads |
Environments: One production environment plus one smaller staging environment, which is the minimum for a revenue-critical system.
Pricing basis: On-demand list prices, before Savings Plans or reserved capacity, which could cut compute costs by roughly a quarter. People costs use $200,000 per engineer per year, explained below.
Team location: This estimate is written for US-based teams, so people costs use US pay. Pay scales vary widely by region, and teams elsewhere should substitute their own cost per engineer.
People cost
People are the largest line in this estimate, by a wide margin. The system needs senior backend engineers who are comfortable with streaming, distributed state, and money.
What one engineer costs
This estimate uses $200,000 a year per senior backend engineer in the US. That is close to the average US base salary for a senior software engineer, about $196,000 a year, and it does not include benefits, payroll taxes, equipment, hiring, or management overhead. Every people figure below is on the low side as a result. Teams elsewhere can substitute their own cost per engineer and scale every people figure proportionally.
Building it: about four months with two developers
AI coding assistants have changed how fast this kind of system gets written. Scaffolding services, writing schemas and SQL, generating client SDKs, building dashboards, and producing test suites now take a fraction of the time they used to.
What AI does not compress is the work that depends on real systems and real time: agreeing on pricing semantics with product and finance, load testing at production volume, letting the pipeline soak under real traffic, running failure drills, and reconciling computed costs against actual provider invoices over at least one full billing cycle. That work sets the floor on the timeline.
The work splits naturally into two tracks that run in parallel, with one senior engineer on each, both using AI tools throughout.
Engineer 1 builds the billing microservice. This is the system itself: everything that runs outside the product and turns usage into rated, billable records.
| Workstream | Weeks |
|---|---|
| Design, event schema, data model, rate card, and cost catalog | 1 |
| Ingestion service and event streams | 2 |
| Rating workers, pricing, and margin logic | 4 |
| Wallets, ledger, atomic debits, authorize and settle | 3 |
| Consumer, ClickHouse schema, materialized views, S3 archival | 2 |
| Hardening: load tests, failure drills, reconciliation, monitoring, runbooks | 4 |
| Total | 16 weeks |
Engineer 2 integrates it with the product. A billing service is useless until every billable action in the product reports to it, and until customers and internal teams can see and act on the results.
| Workstream | Weeks |
|---|---|
| Client SDK with local buffering, retries, and idempotency keys | 2 |
Instrument every model, tool, and agent call, and propagate run_id | 3 |
| Pre-run balance checks and insufficient-balance handling in product flows | 2 |
| Customer-facing wallet, top-up, and usage log screens | 3 |
| Internal revenue, cost, and margin dashboards and wallet adjustment tools | 3 |
| Billing platform integration for invoices and top-up payments | 2 |
| End-to-end testing and shadow billing against current invoices | 1 |
| Total | 16 weeks |
The two tracks meet at the event schema and the service API, which is why both start from the same one-week design phase. Integration is often underestimated: an AI product can have dozens of places where models and tools are called, and every one of them has to report usage correctly, including retries, streaming responses, and partial failures.
Hardening barely shrinks compared with a pre-AI estimate, and it should not be cut: it is the difference between a demo and a system that can be trusted with revenue. With a single developer covering both tracks, the same scope takes roughly seven to eight months. Nice-to-have requirements, such as per-customer conversion rates, composite units, and hybrid payment, typically add another four to six weeks.
Build cost: 2 engineers × $200,000 × 4/12 ≈ $133,000
Running it: one engineer, permanently
After launch, the work does not stop. Someone has to handle new pricing models, enterprise plan exceptions, provider price changes, new models and agents, scaling work, reconciliation drift, incidents, and on-call. AI tools make each individual change faster, but they do not remove the need for an owner who understands the system end to end and answers the page at 2 a.m. A realistic steady state is one dedicated engineer, usually the one who built the microservice, with on-call backup shared across the wider team. The integration engineer returns to the product roadmap, but integration work never fully ends: every new agent, model, or tool call has to be instrumented correctly, and that work lands on the product team.
Annual run cost: 1 engineer × $200,000 = $200,000 a year
Infrastructure cost
Monthly estimates per component, for each volume tier:
| Component | Starter (10M events) | Growth (100M events) | Scale (1B events) |
|---|---|---|---|
| Kinesis Data Streams, two streams | $61 | $85 | $322 |
| ECS on EC2: ingestion, workers, consumer | $210 | $490 | $980 |
| Application load balancer | $25 | $50 | $150 |
| ClickHouse on EC2, with storage | $190 | $490 | $1,100 |
| Redis (Upstash) | $20 | $60 | $300 |
| Supabase (Pro plus compute) | $40 | $135 | $300 |
| S3 archive | $5 | $25 | $100 |
| DynamoDB lease tables for stream checkpoints | $5 | $10 | $25 |
| Monitoring, logs, and alarms | $50 | $150 | $400 |
| Networking and data transfer | $40 | $80 | $200 |
| Backups and snapshots | $10 | $40 | $120 |
| Production subtotal | $656 | $1,615 | $3,997 |
| Staging environment | $200 | $450 | $900 |
| Total per month | ≈ $850 | ≈ $2,100 | ≈ $4,900 |
| Total per year | ≈ $10,000 | ≈ $25,000 | ≈ $59,000 |
How the main lines were sized
- Kinesis. On-demand Standard pricing in us-east-1 is $0.08 per GB ingested, $0.04 per GB read, and $0.04 per stream-hour. Two streams cost about $58 a month before any data moves. At high, steady volume, the newer On-demand Advantage mode is cheaper per GB.
- Compute. Starter runs on three m6i.large instances at about $0.096 an hour each. Growth moves to three m6i.xlarge at $0.192 an hour plus a separate consumer. Scale doubles the worker fleet.
- ClickHouse. Starter is a single r6i.xlarge at about $0.252 an hour. Growth and Scale run two replicas, r6i.xlarge and then r6i.2xlarge at $0.504 an hour, plus three small coordination nodes and EBS storage for several months of rated records. A single node is cheaper but means a billing outage whenever it fails.
- Redis. Each event costs roughly five Redis commands: auth, deduplication, the wallet debit, counters, and rate card lookups. Upstash charges $0.20 per 100,000 commands on pay-as-you-go, so fixed plans with unlimited commands are the better fit at every tier here.
- Supabase. The Pro plan is $25 a month and includes $10 of compute. A ledger under real write load needs a larger compute add-on as volume grows.
Infrastructure scales with usage and stays modest: about $10,000 to $60,000 a year across the three tiers. At every tier, it costs less than the one engineer who keeps it running.

The costs that never appear in the estimate
Several real costs sit outside both the payroll and the cloud invoice.
Revenue leakage. Every usage event the system drops is provider cost the company paid and never billed. For an AI product with $1 million a year in usage revenue, losing 1% of events through bugs, deploys, or edge cases is $10,000 a year in lost revenue, usually discovered months later, if at all.
Billing errors and disputes. Double-counted events, wrong rate versions, or rounding bugs produce incorrect invoices. Each one costs support time, finance time, credit notes, and some customer trust. Enterprise customers who find one billing error tend to start auditing every invoice that follows.
Opportunity cost. Four months of two senior engineers is eight engineer-months not spent on the AI product itself. For an early-stage company, that can be the difference between shipping a key feature this quarter or next year.
Pricing change requests. Every new pricing model, enterprise exception, or margin adjustment from product, sales, and revenue teams becomes engineering work. At even one or two requests a month, each taking one to three weeks, this alone can consume most of the maintenance engineer's time.
Scaling migrations. The architecture that works at 10 million events will need changes on the way to 1 billion: re-sharding streams, moving ClickHouse from one node to a replicated cluster, partitioning the ledger. Each migration is a multi-week project on a system that cannot go down.
Key-person risk. Billing systems are often understood deeply by one or two people. When they leave, the company inherits a revenue-critical system that nobody fully understands, and rebuilding that knowledge is expensive.
Compliance and audit. As customers grow, finance teams and auditors ask how usage is measured, how invoices are produced, and how balances are protected. Producing that evidence from a homegrown system is extra work every quarter.
Total cost of ownership over three years
Here is the total for a company at the Growth tier (100 million events a month), built by two engineers over four months and run by one engineer afterwards. In year one, infrastructure covers staging for the full year and production for the eight months after launch.
| Cost line | Amount |
|---|---|
| Year 1: build (4 months, 2 engineers) | $133,300 |
| Year 1: run (8 months, 1 engineer) | $133,300 |
| Year 1: infrastructure | $18,300 |
| Year 1 total | ≈ $285,000 |
| Year 2: people and infrastructure | ≈ $225,000 |
| Year 3: people and infrastructure | ≈ $225,000 |
| Three-year total | ≈ $735,000 |
| Infrastructure share of the total | ≈ 9% |

People dominate. Over 90% of the cost is engineering time. Optimizing cloud spend barely moves the total; the decision that matters is whether engineers build and run this at all.
Running it costs four times as much as building it. AI tools made the build faster, and the build is the smaller number. Over three years, operating the system costs about $533,000, against $133,000 to build it.
These figures exclude the hidden costs. Revenue leakage, billing disputes, scaling migrations, and delayed roadmap work all sit on top. If usage grows to the Scale tier, infrastructure alone rises to about $59,000 a year.
Building with one developer instead of two costs roughly the same in salary, because the same work takes about twice as long. The launch date moves from month four to around month eight.
What the numbers mean for build vs. buy
For a company at moderate scale, building AI billing in-house is a commitment of roughly three quarters of a million dollars over three years for a US-based team, before counting a single lost event or delayed feature.
That gives you a simple way to evaluate any off-the-shelf option. Compare its three-year cost against the totals above, then add the value of two things buying gives back:
- Time. A billing layer that goes live in weeks gives you correct invoices, wallets, and margin visibility from your next enterprise deal.
- Focus. Engineers who would have built and run billing stay on the AI product your customers are paying for.
Building still makes sense in a few cases: pricing that will never change, low volume, or billing logic that is a real competitive differentiator. For most AI companies, none of those hold for long.
We built Clocknext to take this line item off your engineering roadmap: durable usage ingestion, plans that combine credits, outcomes, and units, wallets, and margin per customer, running in front of the billing platform you already use. If you are weighing these numbers for your own team, talk to us, and we'll walk through them with your actual volumes.

Vijayanand Kailash
16 years in tech and counting. In-house billing expert and jack-of-all-trades across product and GTM.









