Why open source usage-based billing for AI and API products needs its own design
For an AI or API product, billing is as much a data problem as a pricing problem. Every prompt, token count, API call or compute second becomes a billable event, and prepaid credits must be drawn down correctly against those events in near real time. Lago fits event-heavy metering, while Kill Bill fits complex subscription and payment logic. The choice depends on your event volume, the shape of your pricing (per token, per call, tiered, committed spend or credits) and who will operate the stack day to day. Neither is the right answer until those three things are written down.
Metering volume shapes the architecture more than any other input. Ask your engineering team to estimate events per day at peak, the retention period for raw events and how often customers will query usage on a dashboard. Those answers determine whether a Postgres-backed event store is enough or whether you need a columnar analytics store such as ClickHouse for aggregation. Confirm with the vendor how each option handles event deduplication using a transaction or idempotency key, because a retried API call that is billed twice is the most common source of disputed invoices in usage billing.
Regulated buyers add a second layer of work on top of the billing logic. Enterprise customers in banking, healthcare or public sector procurement will ask how usage records are preserved, who can change a price or credit balance, and how invoices reconcile to the metered events behind them. Those questions map to evidence you must produce, not just features you must configure. Plan for access logs, change approvals and reconciliation reports from the start, and confirm with your auditor which of them they expect to sample.
Which regulatory and contractual requirements shape usage billing
This table maps the rules most likely to reach a self-hosted usage billing system, from financial customers and their vendors to EU data portability. Read each row as a question to settle with your legal, security and finance teams before choosing the event store and invoicing design.
| Requirement | Source | What it means for the build |
|---|---|---|
| Encryption of customer information in transit and at rest | 16 CFR 314.4 (FTC Safeguards Rule) | Usage events, invoices and account identifiers from financial customers must be encrypted on the Lago or Kill Bill path, the event store and backups. Confirm key management ownership. |
| Multi-factor authentication for any individual accessing systems | 16 CFR 314.4 (FTC Safeguards Rule) | Operator consoles, metering dashboards and database access need MFA. Include break-glass accounts and service access paths in the access review. |
| Change management procedures | 16 CFR 314.4 (FTC Safeguards Rule) | Pricing catalog changes, meter definitions and rating rules need documented approval and release steps, so each invoice can be tied to the rules in force at the time. |
| Logging of authorized user activity | 16 CFR 314.4 (FTC Safeguards Rule) | Log credit grants, manual adjustments, price overrides and usage data corrections with user identity and time. Confirm log retention with the customer's compliance team. |
| Annual penetration testing and vulnerability assessments every six months | 16 CFR 314.4(d)(2), where continuous monitoring is absent | If the operator does not run continuous monitoring of the billing stack, plan a yearly penetration test and six-monthly vulnerability assessments covering the metering API, ingestion and payment connectors. |
| Retention of bills receivable or payable | 17 CFR 240.17a-4(b) (SEC Rule 17a-4) | Where a broker-dealer is a customer or operates the billing platform, invoices and usage-based bills must be kept for at least three years, the first two easily accessible. Define archive storage and retrieval tests early. |
| Processing only on documented instructions and security of processing | GDPR Article 28(3) (processor contracts) | Prompts are not usually billed, but usage logs that carry user identifiers, model names and contact data are personal data. Document the operator's processing instructions, sub-processors and transfers in the data processing agreement. |
| Switching to another provider or on-premises infrastructure | EU Data Act, Articles 23, 25 and 50 (Regulation (EU) 2023/2854) | Customers can require export of their usage history and invoices. Design exports in an open, documented format and set a notice and transitional plan that fits a maximum two-month notice and 30-day transition. |
| No switching charges from 12 January 2027 | EU Data Act, Article 29 | From that date providers of data processing services may not impose switching charges. Ask the implementation partner how export tooling and related labor are priced in the written scope. |
How metered events become invoices
Every invoice line starts as an event. A model call, API request or compute job emits a usage record, which the platform ingests, aggregates per billable metric, rates against a price plan, draws down any prepaid credits and finally writes as an invoice line. Each stage is a place where numbers can drift, so the design question is where each stage runs and who owns its output. In a self-hosted Lago or Kill Bill build, confirm in each platform's documentation how events are received (its event API and any batch or queue path), how billable metrics define aggregation (sum, count, unique count, or max over a period), and whether rating happens at ingestion or at invoice close. Those answers decide when a customer can see a figure and when finance can trust it.
Idempotent event IDs are the control that makes reconciliation possible. Your gateway or application should attach a stable transaction ID to every request, so a retried call or a replayed queue message is recorded once and not billed twice. Late-arriving events are the second risk: a streaming job or a failed upload may deliver usage hours after the period closed. Decide, in writing, whether late events roll into the open period, reopen a closed invoice, or go to a credit or adjustment process. Time-zone cutoffs are the third. Usage timestamped in UTC will not match a billing period cut at midnight in the customer's contract time zone unless you define the boundary explicitly and test it at month end.
Prepaid credits sit between rating and the invoice. When a customer buys a credit balance, each rated usage amount should draw down a wallet with a recorded ledger entry, so the remaining balance can be shown in real time and audited later. Ask each platform's vendor how wallet balances are updated, whether a balance check can block a call before it runs, and how a failed or disputed draw is reversed. Finally, build a reconciliation check that compares raw event counts from your gateway logs with aggregated quantities per customer and period, and with the invoiced quantities. Any gap should be explained before the invoice is issued. This check, run on a schedule, is the evidence your finance team and auditors will ask to see.
Which platforms fit usage-based billing, and when
Usage-based billing for AI and API products depends on two layers: an event pipeline that meters consumption and a billing engine that rates it, applies credits and produces invoices. The cards below cover the self-hosted options and the supporting roles around them, with the fit driven by event volume, pricing shape and how much payment logic you need to own.
Lago for event-first metering
Lago is built around ingesting usage events and rating them against billable metrics, which maps directly to token, request or compute-second pricing. For a self-hosted deployment, the main questions are how events are ingested, how much volume your pipeline must absorb at peak, and which event store backs aggregation. Confirm current ingestion throughput, supported aggregation types and the recommended store against the Lago documentation before you size infrastructure.
Kill Bill for complex subscription logic
Kill Bill fits when recurring commitments and usage share one invoice with prepaid plans, overages, proration and custom payment flows. It runs as a Java service with plugin extension points for payment gateways, tax and reporting. Teams choosing it should plan for plugin development and operations, and should verify the latest release, currently killbill-0.24.22, against their catalog and payment requirements.
Hyperswitch as payment orchestrator
Hyperswitch sits between your billing engine and multiple processors, handling routing, retries and tokenized card storage so the billing system does not hold raw card data. It can pair with either Lago or Kill Bill. Check which processors and payout providers your region needs, how its vault is deployed, and what PCI scope results from your chosen architecture. The current release is v1.128.0.
Pairing billing with a warehouse
Usage events are high volume and short lived, while invoices need a durable, auditable record. Many teams keep raw events in a columnar analytics store for real-time visibility and let the billing engine hold only aggregated charges. Decide early which system is the source of truth for disputed usage, how long raw events are kept, and how reconciliation jobs compare event totals with invoice line items. Confirm each platform's supported event store options in its current documentation.
ERP platforms handle the ledger, not metering
Odoo, ERPNext and similar ERP platforms are useful downstream for revenue recognition, general ledger posting and receivables, but they are not designed to ingest millions of API events or rate them in real time. Plan an interface that posts summarized invoices and payments from the billing engine into the ERP. Confirm the supported invoice and journal interfaces in the ERP version you run, such as Odoo 20 or ERPNext v16.51.1.
Postgres or ClickHouse for the event store
When usage events arrive at a modest rate and billing needs only simple aggregation per customer, per metric and per billing period, a single PostgreSQL instance managed by the platform team is often the lowest-friction event store. The same database already holds customers, subscriptions and invoices, so one backup regime, one access model and one restore procedure cover the whole billing data set. The trade-off is that raw events and invoice data share failure modes, and long retention of high-cardinality events can grow tables faster than teams expect. Confirm the expected event rate and retention period with the billing vendor's documentation and your own traffic estimates before committing.
- Operations skills: Teams already running PostgreSQL for the billing application can usually absorb the event table without a new database technology.
- Query patterns: Sums by customer, metric and period are straightforward SQL, and indexes on customer and timestamp columns usually cover them.
- Retention: Partitioning by time keeps old events manageable, but deletion of raw events must be checked against your retention policy and any dispute window.
- Reconciliation evidence: Invoice line items, raw events and aggregates can sit in one transactional store, which makes tracing a charge back to its source straightforward.
- Backup and restore: Point-in-time recovery covers events and invoices together, so restore tests verify both at once.
Before you decide, check how your billing platform writes events and whether its aggregation queries run acceptably against your projected table size.
When events carry many dimensions such as model, region, endpoint, customer tier and feature flag, and dashboards must refresh close to real time, a columnar analytics store such as ClickHouse becomes a serious candidate. Columnar storage is designed for scanning and aggregating large event sets across many dimensions, which is the usual shape of usage dashboards. The cost is a second database to operate, with its own clustering, merge behavior, upgrades and backup approach, and a team that must understand its ingestion and deduplication semantics. Ask your implementation partner which skills exist in-house before choosing this path.
- Operations skills: Running ClickHouse well requires capacity planning, replication setup and monitoring that differ from PostgreSQL practice.
- Query patterns: Ad hoc dimensional breakdowns and dashboards over large windows fit the engine well, while row-level lookups for a single invoice line fit less naturally.
- Retention: Tiered storage and time-based expiry can be configured, but each retention rule must be tested against the data your auditors may request.
- Duplicate handling: Events that are retried by clients or gateways need an idempotency key and a deduplication strategy that the team can explain.
- Reconciliation evidence: Invoice totals must be derived from a defined, reproducible query, and the link between the analytics store and the billing ledger needs its own control.
Ask the vendor and your partner how the billing platform pulls aggregates from an external store and what happens when the two disagree.
A hybrid design sends raw usage events to a columnar store for dashboards, anomaly views and long analytical queries, while invoice-critical totals are written to PostgreSQL as part of the billing process. The invoice then references a fixed set of totals that do not change when analytics are recalculated. This separates the workload that needs fast scans from the workload that needs transactional integrity, but it introduces a synchronization boundary that must be monitored. Plan for the case where the analytics copy lags or contains late events, and decide in advance which system wins during a dispute.
- Operations skills: Two stores mean two sets of backups, upgrades and access reviews, so the operating model must name an owner for each.
- Query patterns: Dashboards query the columnar copy, while invoice generation reads only the Postgres aggregates that were frozen at period close.
- Retention: Raw events can follow an analytics retention policy, while the invoice aggregates and their source references follow the longer financial record period you set with finance and counsel.
- Reconciliation evidence: Each invoice total should be traceable to a stored aggregation run, including the event window, the query version and the run timestamp.
- Late events: Define a cutoff after which events move to the next billing period or a credit, so totals are not silently changed.
Confirm how the billing platform handles late or corrected usage before you design the split.
How a usage billing rollout moves from metering to first invoice
This sequence takes a metered AI or API product from agreed billable metrics to a first invoice that finance can reconcile against raw usage, with each phase closing on a named artifact that the next phase depends on.
Define billable metrics and pricing with finance
Finance, product and engineering agree which units are billed (tokens by model, API calls by endpoint, compute seconds by instance class), how each unit is priced, which free allowances apply and how prepaid credits convert to units. DeployOpen facilitates the workshops, and the client's finance lead signs the result. The output is a metric dictionary that defines each metric, its unit, its aggregation rule and its owner. The step is done when every line item on a sample invoice can be traced back to one metric in that dictionary.
Design the event schema and idempotency rules
Engineers define the usage event contract: required fields such as customer, metric code, quantity, timestamp, source system and a unique event identifier, plus rules for late and out-of-order events. The idempotency rule states that a retried event with the same identifier is counted once, which protects invoices from double counting during network retries. The output is a versioned event contract with example payloads and rejection rules. The step is done when producer teams in the product codebase have reviewed the contract and a test producer can replay duplicate events without changing totals.
Stand up ingestion and the chosen event store
The team deploys the ingestion path and event store inside the client's own cloud account or data center: the billing service that receives events, the queue or buffer in front of it, and either a Postgres-based or ClickHouse-based event store, chosen from the expected event volume and query pattern. Access controls, encryption at rest and in transit, and logging are configured at this stage. The output is a running environment with documented capacity tests against realistic event volumes. The step is done when the load test results and the chosen store's sizing assumptions are approved by the platform owner.
Configure prepaid credits and drawdown
The team models plans, credit wallets, drawdown order across multiple credit balances and behavior when a balance reaches zero, such as blocking requests, allowing overage or switching to postpaid billing. Top-ups, expiry rules and refunds are configured to match finance policy. The output is a configured catalog and a test matrix covering each credit scenario, including partial drawdowns and concurrent requests against the same balance. The step is done when every scenario in the matrix produces the expected balance and ledger entries in a test tenant.
Run reconciliation in parallel with existing billing
For a defined period, the new pipeline and the existing billing process run side by side on the same usage. A reconciliation job compares event counts, aggregated quantities and computed charges per customer and metric against the invoices the current process produces, and it logs each difference with its cause, such as late events, rounding or a catalog mismatch. The output is a reconciliation report with variance by metric and customer, and an agreed tolerance. The step is done when finance accepts the variances and every open difference has an owner and a fix or an explanation.
Test invoice output, payments and audit trails
Before any customer sees an invoice from the new system, the team checks invoice numbering, tax lines, currency handling, dunning behavior and the export to the general ledger. Payment gateway integration is tested in sandbox mode, and the audit trail for price changes, credit adjustments and manual corrections is reviewed. The output is a test evidence pack that maps each check to the finance or compliance requirement it supports. The step is done when the evidence pack is reviewed by finance and by whoever owns the client's control environment.
Cut over with a signed checklist
The team schedules the switch of customers or product lines to the new billing path, confirms the rollback procedure and freezes catalog changes during the window. Monitoring for ingestion lag, rejected events and balance anomalies is active before and after the switch. The output is a signed cutover checklist covering approvals, rollback criteria, named owners and the first live invoice run. The step is done when the first live invoice run completes, reconciliation against usage matches the agreed tolerance and the checklist is archived with the other rollout evidence.
Integration points and deployment pattern in the client environment
A usage-based billing system for AI and API products is a chain of components: the product emits usage, events pass through a queue, get stored and aggregated, and become invoice line items and payments. Each link can run inside the client's own cloud account, data center or private network, and each one needs its own owner, failure plan and evidence trail.
Usage emitter in the product
The emitter is the code path in the AI gateway, API gateway or compute service that records each billable event, such as a token count, request or compute second. Decide where it runs and whether it counts on the request path or after the response. Check that each event carries a stable customer ID, product or meter ID, timestamp and a unique transaction ID so retries do not create duplicates. Ask the team to test what happens when the emitter fails mid-request.
Event queue between product and billing
A queue decouples the product from the billing pipeline so a slow or unavailable billing component does not slow customer requests. Confirm the queue's delivery guarantees, ordering behavior, retention period and how consumers acknowledge messages. Size it for peak request bursts, not average traffic, and document how replay works after an outage. Keep the queue inside the same network boundary as the event store so usage data does not leave the client environment in transit.
Event store for raw usage
The event store holds every raw usage record before aggregation. This is where Postgres or ClickHouse choices matter most, because volume and query patterns differ. Keep raw events immutable, partitioned by time and tenant, and retained long enough to re-rate invoices or answer a customer dispute. Confirm the backup schedule, restore test frequency and recovery point objective with the team, because lost events mean lost revenue.
Billing engine and worker tier
The billing engine, Lago or Kill Bill, turns aggregated usage into charges against the plan catalog, applies credits and generates invoices. Workers run the periodic jobs that aggregate meters, close billing periods and retry failed steps. Scale workers separately from the API tier, and run more than one instance so a single node failure does not stop invoicing. Ask the partner to document the job schedule, the database each component uses and the upgrade path for both the engine and its worker processes.
Payment gateway integration through tokens
The billing system should hold only gateway tokens and payment method references, never raw card numbers. Each invoice finalization triggers a charge through the gateway or an orchestrator such as Hyperswitch, and the webhook results update the invoice status. Confirm which components receive card-adjacent data, how webhook signatures are verified and how failed charges feed dunning. This boundary also sets the PCI DSS scope, so review it with the payment team before the design is final.
Ledger, reporting export and observability
Finance needs a daily export from the billing engine into the general ledger, along with usage reports that match what customers see. Observability covers metrics on ingestion lag, aggregation job failures, duplicate event rates and invoice totals compared with raw usage. Set alerts for drift between the event store and invoice totals, and keep logs of every credit and price change. Confirm where dashboards, logs and traces are stored and who can access them, because usage logs can reveal customer activity.
What auditors and regulators will ask to see from usage billing
How do auditors confirm that usage events are complete and not duplicated?
Auditors look for an ingestion log that shows every event received, the idempotency key or transaction ID used to reject duplicates, and a reconciliation between events sent by the product and events counted by the billing platform. In a self-hosted Lago deployment, the event ingestion API and its stored event records are the primary evidence, and the product's own request logs are the upstream source to compare against. Kill Bill usage records follow a similar pattern through its usage API. Confirm with your engineers exactly which fields form the deduplication key, how late or out-of-order events are handled, and how dropped events are detected and replayed. DeployOpen prepares the evidence and the test records, but independent auditors and certification bodies issue any opinion on whether these controls are effective.
How do invoices trace back to the underlying usage events?
An invoice line should link to the metric, the billing period, the aggregated quantity and the individual events or aggregation job that produced it. Lago and Kill Bill both record usage against subscriptions and billing periods, so the invoice record, the usage records and the aggregation query can be exported together. Ask for a documented rule for rounding, tiering and credit application, and keep the query version used for each invoice run. Reviewers will sample invoices and ask you to rebuild the amount from raw events, so the trace must work for a closed period months later, not only for the current cycle.
Who changed prices, plans or credit rules, and when?
Auditors expect an change history for every catalog item, price, metric definition and prepaid credit rule, with the user, the time, the old value and the approval. The evidence comes from the billing platform's audit trail for configuration changes, combined with your change management tickets and the code or infrastructure-as-code repository that deploys catalog changes. Record who can publish a price change and whether a second person must approve it. If pricing lives in a database managed outside the platform, the change path becomes harder to prove, so confirm where the authoritative catalog is stored before the first audit.
How are logs of administrator actions kept and protected?
Reviewers ask for logs that show who logged in to the billing administration console, who changed configuration, who issued manual credits or refunds, and who accessed customer or payment data. Forward these logs from the Lago or Kill Bill containers, the reverse proxy and the database to a central, write-protected store with restricted access and a defined retention period. The FTC Safeguards Rule at 16 CFR 314.4 expects covered financial institutions to log the activity of authorized users, and that expectation is a useful benchmark even where the rule does not apply to your business. Confirm the retention period and the access list with your compliance lead.
How long must usage and invoice records be retained?
Retention depends on the jurisdiction, the sector and the contracts, so the answer is a schedule you define with legal and finance, not a single number. For broker-dealers, the SEC's Rule 17a-4(b) requires preservation of records such as bills receivable or payable for not less than three years, the first two in an easily accessible place, which shows how regulators phrase retention. Plan storage for raw usage events, aggregated usage, invoices, credit notes and audit logs separately, because event volumes grow much faster than invoice volumes. Test restores from backups against the retention schedule, and confirm how deletion requests under privacy law interact with records you must keep.
How does a SOC 2 or ISO 27001 scope include the billing platform?
The billing platform is in scope when it stores, processes or can affect customer data or financial reporting, and it should appear in the system description or the ISMS scope document. For SOC 2, the security common criteria CC1 to CC9 apply to every report, and the system description must name the billing components, their hosting and their third-party dependencies, including the payment gateway. For ISO/IEC 27001:2022, the scope statement and the Statement of Applicability must list the relevant Annex A controls for the platform. Accredited certification bodies, not ISO, decide certification, and an independent CPA firm issues any SOC 2 report. DeployOpen can prepare the system descriptions, control mapping and evidence packs for these assessments.
What does DeployOpen deliver for audit readiness, and what does it not do?
DeployOpen plans, implements and documents the billing platform in your environment, then prepares the evidence that auditors and regulators will request, such as configuration exports, access reviews, change records, reconciliation reports and test results. DeployOpen does not issue audit reports, attestations or certifications, and does not decide whether your controls are effective. That decision belongs to independent auditors, certification bodies or your regulator. Scope, deliverables and timelines are agreed in writing before work starts, and a quote follows from that written scope. Ask any partner which evidence they will produce, in what format, and who keeps it after handover.
Evidence that usage billing produces for audits
This table maps each piece of evidence an assessor may ask for from a self-hosted usage billing system to what it proves and the component that produces it. Read it as a checklist for design: if a row has no owner in your architecture, the evidence will be hard to produce when an auditor asks. The main takeaway is that event ingestion, pricing, credits and invoicing must each keep their own logs, because no single report covers all of them.
| Evidence item | What it proves | Component that produces it |
|---|---|---|
| Event ledger export with idempotency keys | Each metered usage event was received once, with a stable key, so billed quantities can be traced to source records (SOC 2 processing integrity) | Event ingestion layer and its event store (Lago or Kill Bill usage ingestion, with Postgres or ClickHouse) |
| Price plan version history | Which rates applied to which usage period, and who approved each change (change management, CC8.1) | Billing catalog or plan configuration with versioned changes, plus the change ticket in your source control |
| Credit grant and drawdown logs | Prepaid credits were granted, consumed and expired against the right customer and period, with no unexplained balance movement | Prepaid credit or wallet module in the billing platform, linked to the payment record for each grant |
| Invoice-to-event reconciliation reports | Every invoice line ties back to aggregated usage and rated events, and differences are explained (processing integrity) | Reconciliation job comparing the event store, rating output and invoice tables, stored as dated reports |
| Access and change logs | Only authorized staff changed pricing, credits or invoices, and each action is attributable (logical access, CC6.1 and CC6.2; logging under the security common criteria) | Billing admin audit trail, database audit logs, identity provider logs and infrastructure change records |
| Backup and restore test records | Usage and invoice data can be recovered within the agreed objectives, and the restore was tested (availability criteria, backup and recovery controls) | Backup tooling for Postgres or ClickHouse, with signed restore test reports and dated results |
| Operational monitoring records | Metering pipeline lag and dropped events were watched and acted on (system operations, CC7.2) | Metrics and alerting stack covering ingestion queues, event store health and billing job runs |
| Security control mapping to ISO/IEC 27001:2022 Annex A | Technological and organizational controls protecting usage data are mapped to named control themes, ready for certification body review | Control register maintained by the operator, referencing evidence from the rows above |
What to ask an implementation partner before signing
Start with prior metering work. Ask the partner to name Lago or Kill Bill projects where usage events were ingested, rated and invoiced, and ask what volume, event shape and pricing model those projects carried. Then ask how they test event idempotency: specifically, what happens when the same transaction_id arrives twice from a retrying SDK or gateway, and whether they can show a test that proves a duplicate is counted once. Ask how they handle late events that arrive after an invoice period has closed, and whether the rule is to re-rate, adjust on the next cycle, or hold the event for review. Each answer should map to a written test case the partner will run against your own event sample.
Ask how they size and operate the event store. The partner should explain why they would choose Postgres or ClickHouse for your expected event volume and query pattern, what retention and partitioning they would set, and how they would monitor ingestion lag. Ask how prepaid credit logic is validated: request their test matrix for balance depletion mid-period, concurrent debits, credit expiry, and refunds. On disputes, ask who owns the reconciliation report, how a customer-disputed usage line is traced back to raw events, and what evidence is produced. For upgrades, ask how they run a new Lago or Kill Bill release against a copy of production usage data before cutover. Finally, confirm who holds the administrator keys, database credentials and logs, where audit logs are shipped, and who can change rating rules. Require a written scope and an evidence list per phase, such as test reports, configuration baselines and reconciliation sign-offs, before any work starts.
How much work and cost does usage billing take to implement?
What drives the implementation effort for usage-based billing?
The effort is driven mainly by how many billable metrics you have, how many events you ingest, how complex your credit and pricing rules are, which payment flows you need, and which regulated controls apply. Each billable metric needs a defined event schema, aggregation logic and test cases, so ten metrics is a very different job from two. High event volume pushes the work toward load testing, partitioning and choosing an event store. Prepaid credits add balance logic, expiry rules and top-up flows. Payment flows and card handling add integration and PCI scoping work, and regulated controls such as audit trails and change approvals add evidence work on top of the build. Ask any partner to size the work against these five drivers in writing before agreeing a price.
What must our team supply before implementation starts?
Most of the delay in usage billing projects comes from decisions that were never made, so the client has to supply three things. First, pricing decisions: the billable units, unit prices, tiers, included allowances, credit bundles and how unused credits are treated. Second, named data owners who can confirm what each event means, which system is the source of truth for usage, and how disputes are resolved. Third, environment access: staging and production infrastructure in your own cloud account or data center, service accounts for the metering source, the payment gateway sandbox, the general ledger and the identity provider. Missing any of these pushes the schedule, and the written scope should list who provides each input and by when.
Can an internal team build usage billing without an implementation partner?
A strong internal team with backend, data and finance engineering experience can build a self-hosted billing stack, and some do. The questions to answer honestly are whether you have people who can operate Postgres or ClickHouse at your event volume, who will own the Lago or Kill Bill upgrades, who understands revenue recognition and tax well enough to validate invoices, and who will produce the evidence an auditor asks for. If those skills are thin, a partner can take on the planning, build, hardening and documentation while your team keeps ownership of pricing and data. DeployOpen works this way: it plans, implements, customizes, integrates, backs up and documents self-hosted platforms inside your own infrastructure, under a fixed scope agreed in writing.
How long does a usage billing implementation take?
Duration depends on scope, so no general timeline can be given. The main inputs are the number of billable metrics, the event volume and store design, the credit and payment flows, the tax and accounting integrations, and how many environments and approval gates your change process requires. Two projects with the same platform can differ widely in length for these reasons. DeployOpen agrees timelines in writing as part of a fixed-scope engagement, after the requirements and pricing decisions are settled. When you request a proposal, ask for the milestones, the client inputs each milestone depends on, and what happens to the timeline if pricing rules change mid-build.
What costs recur after usage billing goes live?
After go-live, costs recur in four areas. Infrastructure is the first: compute, storage and backups for the billing application, the event store and the payment-related components, which grow with event volume and retention. Upgrades are the second, since Lago and Kill Bill release regularly and each upgrade needs regression testing against your metrics and invoices. Monitoring and on-call support are the third, because a missed event batch or a stalled invoice run directly affects revenue. The fourth is ongoing support, which can be bought as a retainer covering upgrades, monitoring, security testing and changes to pricing. Ask any partner to separate one-time build fees from these recurring items so you can compare total cost of ownership over several years.
How does the EU Data Act affect exit planning for usage billing?
The EU Data Act, Regulation (EU) 2023/2854, has applied since 12 September 2025 and requires data processing service providers to let customers switch to another provider or to on-premises infrastructure, with a maximum two-month notice period and a 30-day transitional period under Articles 23, 25 and 50. From 12 January 2027, providers may not impose any switching charges under Article 29, and until then reduced charges may not exceed costs directly linked to switching. For a self-hosted build, the Act applies to a provider, not to you running your own software, so the practical lesson is to design exit now: keep usage history and invoices in documented, exportable formats, and keep your pricing rules and event schemas written down. Confirm with your legal team whether the Act reaches your specific arrangements.
What should we ask a partner to put in the quote?
Ask for a written scope that lists each billable metric, the event sources and expected volume, the event store choice and its reasoning, the credit model, the payment and tax integrations, and the accounting interface. The quote should show deliverables and acceptance criteria for each, the client inputs each one depends on, and the testing approach, including reconciliation of usage with invoices. Ask which items are one-time, which are recurring, and what is excluded, such as platform licenses, enterprise add-ons, cloud fees or third-party tax engine costs. Finally, ask how changes to pricing after sign-off are priced and approved, because that is where usage billing budgets most often move.
Which build decisions change the cost the most?
Three decisions move cost more than the rest. The first is the event store: Postgres may be sufficient for lower volumes, while ClickHouse adds operational skills and infrastructure that pay off at high event volume, so test both against your expected load before committing. The second is the credit model, because prepaid balances, expiry and refunds need careful ledger logic and tests. The third is how tightly usage is reconciled with invoices and the general ledger, since automated reconciliation takes more build effort but reduces manual finance work every month. Ask each partner to show how these three choices affect the quote and the recurring cost.
How DeployOpen scopes and supports usage billing
DeployOpen plans, implements, integrates, hardens, documents and supports self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks. For usage-based billing, that means a written scope covering how your AI and API usage is metered, rated, invoiced and reconciled, delivered inside infrastructure you control.
How we scope
- Written scope covers the metered units, event sources, rating rules and invoice outputs agreed before work starts.
- Scope defines the event volume, retention period and whether Postgres or ClickHouse is the event store.
- Scope lists the payment gateway, tax and accounting integrations, with each one named and confirmed in writing.
How we build
- We configure Lago or Kill Bill, including billable metrics, plans, prepaid credit wallets and usage thresholds.
- We build event ingestion from your API gateway or model serving logs, with idempotent event IDs to prevent double counting.
- We test rating and invoice totals against reference usage data, then run security testing on the metering interfaces.
How we hand over
- Handover includes runbooks for event pipeline monitoring, credit top-ups, failed usage events and invoice reruns.
- Documentation maps each usage field to its invoice line, so finance and engineering reconcile the same numbers.
- Access, change control and backup procedures are documented so your team can operate the platform after handover.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer, scoped separately from the build.
- Upgrade work is planned against the release cycle of the chosen billing platform and tested before production.
- Confirm with us the response model, escalation path and on-call coverage before signing the written scope.

