Create a usage ledger
Export one billing period of API usage. Keep timestamp, request ID, exact model ID, input tokens, output tokens, cached read/write tokens if reported, and any tool or non-text units. Add account and project IDs when several teams share a bill. Avoid logging prompt text unless needed; counts and identifiers are enough for cost reconciliation.
Match line items to rates
Group rows by model, route and billing category. Apply the provider's rate for that period: tokens × dollars per million / one million. Do not apply a standard input rate to cache reads or a text rate to images. If a model changed price mid-period, split the rows by effective date.
Find the mismatch
Compare your calculated subtotal with the provider dashboard before comparing with a card charge. Check for retries, failed requests with billable usage, asynchronous jobs, service tiers, credits, taxes and a time-zone mismatch at month end. A request omitted from your app log can still appear in the provider dashboard.
Make next month easier
Store a daily aggregate by model and category, and compare it with a daily provider report. Alert on unusual cost per request and growth in input history. Document exceptions so the finance total can be reproduced without guessing. Convert token counts or read the price formula as a quick check.
Worked reconciliation example
Suppose the dashboard shows 2 million standard input tokens at $2 per million and 500,000 output tokens at $8 per million. Those text items total $4 + $4 = $8. A further 1 million cached-read tokens at an illustrative $0.20 per million adds $0.20. If the invoice's usage subtotal is $8.20, the ledger matches. If it is $9.20, investigate the remaining dollar by model and category rather than changing a global multiplier. The example rates are invented for arithmetic; use the provider's published rates for the actual billing period.
What to keep in the audit trail
Save the rate-sheet URL or exported price table, the date it applied, the time zone used for grouping and the provider usage export. Keep a note of credits and taxes outside the usage subtotal. If your own logs and provider records disagree, request IDs make it easier to locate duplicate retries or traffic from another API key. This documentation also makes a future price change visible instead of silently altering your cost history.