PayAPIKey

API Billing Reconciliation

Match downstream usage, upstream charges, and payment settlements to find missing records, billing drift, wallet funding errors, and negative-margin API traffic.

API billing reconciliationNew API billing auditAI API gateway profitLLM gateway reconciliationAPI payment reconciliation
Local-first, metadata only

Three-ledger reconciliation workbench

Selected files stay in this browser. Consumption revenue, wallet funding, and processor settlement remain separate so prepaid credits are not mistaken for earned revenue.

1. Consumption ledger

Customer charges, usage refunds, model and request IDs.

Example usage ledger
4 records

2. Upstream billing

Provider costs, credits, channels and request IDs.

Example upstream ledger
4 records

3. Funding ledger

Payment captures, fees, refunds and wallet credits.

Example payment ledger
3 records

Reconciliation result

Amounts use decimal arithmetic. Exact request matching requires a shared request ID.

Consumption revenue
$0.119
Customer usage charges minus usage refunds
Upstream cost
$0.1105
3 matched requests
Gross profit
$0.0085
7.1% gross margin
Findings
6
5 critical

Action queue

Critical financial leaks first; completeness notices remain informational.

Critical
negative_request_margin

Request req_1002 cost more upstream than the recognized consumption revenue.

req_1002

-$0.009
Critical
failed_request_charged

Failed request req_1004 still has a net customer charge.

req_1004

$0.009
Critical
upstream_without_downstream

Upstream charge req_orphan_upstream has no matched downstream usage record.

req_orphan_upstream

$0.012
Critical
payment_credit_shortfall

Settled payment pay_9002 issued less wallet credit than the captured amount.

pay_9002

$2.00
Critical
credit_without_settlement

Payment pay_9003 issued wallet credit without a settled capture.

pay_9003

$5.00
Review
downstream_without_upstream

No unique upstream charge matches request req_1004.

req_1004

$0.009

Funding reconciliation

Net settled cash
$29.43
Processor fees
$0.57
Payment refunds
$0.00
Wallet credits issued
$33.00

Funding is shown separately from consumption revenue. A top-up increases wallet liability until the customer consumes it.

Automate this workflow

Use the connector manifest, native normalizer, and stateless reconciliation API with New API, One API, one-hub, or VoAPI exports.

Read API documentation

Margin by model

Unmatched upstream charges remain visible as cost with no recognized revenue.

ModelRequestsRevenueUpstreamProfitMargin
claude-sonnet1$0.052$0.061-$0.009-17.3%
gemini-image1$0.04$0.027$0.01332.5%
gpt-5.4-mini2$0.027$0.0225$0.004516.7%

Frequently asked questions

Practical answers for applying this calculator to a production API billing or usage plan.

Does PayAPIKey upload or store my gateway files?

The browser workbench calculates locally and does not upload selected files. The public API is stateless: it processes the submitted payload and returns a report without offering credential storage. Never include API keys, prompts, completions, cookies, or session tokens in an import.

Why are prepaid top-ups not counted as service revenue?

A top-up creates wallet credit that the platform still owes to the customer. The workbench recognizes usage revenue when that credit is consumed, while payment captures, fees, refunds, and wallet credits are reconciled in a separate funding ledger.

Which open-source gateways are supported?

The first release has a verified New API read contract, compatibility adapters for One API and one-hub, and canonical CSV or JSON import for VoAPI. Because fork APIs change, verify the connector manifest against the deployed version before automating live reads.

Can it reconcile cache, reasoning, image, and refund charges?

The canonical schema carries cache-read, cache-write, reasoning, media, expected-charge, refund, and payment fields. The report flags missing records and price-snapshot differences; exact model repricing depends on the fields supplied by the source export.