FerryAPI

Billing operations

Multi-Provider AI Invoice Reconciliation for SaaS Teams

A practical reconciliation checklist for SaaS teams matching OpenAI-compatible gateway usage records against multiple AI provider invoices, currencies, token prices, customer charges, and customer usage exports.

Why reconciliation gets messy after the first provider

Most AI products can explain early spend by opening one provider dashboard and checking total tokens. That breaks when production traffic uses several model providers, fallback rules, cached-token pricing, customer API keys, prepaid balances, and different invoice periods. Finance sees provider invoices; product sees customer usage; engineering sees traces. Reconciliation is the work of proving that all three views describe the same requests.

An OpenAI-compatible gateway is the best place to create the shared record because every request already passes through it before provider routing, retry, fallback, quota checks, and customer charging.

Reconciliation data you need per request

Field groupExamplesWhy it matters
Gateway identityrequest_id, trace_id, idempotency_keyDeduplicates retries and ties application logs to provider records.
Customer ownertenant_id, workspace_id, api_key_id, featureMaps provider spend back to the customer, plan, or product surface that caused it.
Provider callprovider, provider_request_id, served_model, regionLets finance match gateway usage to provider invoice rows and support tickets.
Usage quantitiesinput_tokens, output_tokens, cached_tokens, image_unitsPreserves the unit basis for token, multimodal, and cached-context pricing.
Pricing versionprovider_price_version, customer_price_version, exchange_rate_idPrevents historical usage from changing when provider pricing or currency rates change later.
Billing outcomeprovider_cost_usd, customer_charge_usd, balance_delta, invoice_periodSeparates what the business paid from what the customer was charged or allowed.

Daily reconciliation workflow

  1. Close the gateway usage window: freeze a UTC time range and export all billable, free, failed-after-provider, and retried requests.
  2. Normalize provider units: convert each provider's token, cached-token, image, embedding, and request units into a common schema.
  3. Join by provider request id: match exact provider ids where available, then use timestamp/model/token tolerance only for records missing ids.
  4. Compare cost and quantity: flag mismatches by provider, model, customer, and route instead of only checking one global total.
  5. Separate commercial charge: apply customer price tables, plan allowances, coupons, prepaid balances, and internal/test exemptions after provider cost is verified.
  6. Publish exceptions: send engineering a short list of missing ids, unexpected model substitutions, duplicate retries, and unpriced usage.

Exception categories to track

ExceptionLikely causeResolution
Provider invoice has usage missing from gateway recordsDirect provider key usage, health checks outside the gateway, or logging failure.Block unmanaged provider keys and route all production calls through the gateway.
Gateway has usage missing from provider invoiceLate invoice export, non-billable trial model, cached invoice delay, or failed pre-provider request.Mark the invoice status and recheck after provider billing finalizes.
Cost differs but tokens matchWrong price table version, cached-token discount, currency conversion, or model alias change.Version provider prices and store the resolved model, not only the requested model.
Customer charge differs from provider costExpected markup, plan allowance, prepaid credit, coupon, or enterprise discount.Keep provider_cost, customer_charge, and allowance_applied as separate fields.
Duplicate customer chargeRetry without idempotency or settlement replay.Use gateway request ids and append-only ledger entries with idempotent settlement.

Month-end controls

How this fits with FerryAPI architecture

FerryAPI focuses on the gateway layer that SaaS teams need before AI billing becomes reliable: OpenAI-compatible requests, customer API keys, tenant quotas, prepaid balances, model routing, and usage records that survive reconciliation. The goal is not just cheaper model access; it is a billing trail that finance, support, and engineering can all trust.

Related FerryAPI guides: AI API usage attribution schema, LLM prepaid balance implementation, model routing vs. fallback, and OpenRouter alternatives for SaaS billing.

Related: AI API usage ledger design explains how to make gateway usage events durable enough for billing, refunds, and provider invoice reconciliation.

Related: AI API cost anomaly detection runbook helps catch provider-cost spikes before the monthly invoice reconciliation step.

Need cleaner AI usage reconciliation?
FerryAPI helps SaaS teams route model requests, manage customer API keys, enforce quotas, and track multi-provider AI usage for billing. Explore FerryAPI.