Allocate OpenAI and Anthropic costs to customers
Provider cost reports and customer usage logs answer different questions. The provider shows what an organization paid; application events show who caused usage. A defensible allocation needs both views and a visible reconciliation between them.
Collect two independent views
From the provider, collect organization-level cost buckets for the period and scope you are reviewing. From the application, collect metadata-only events with customer or contract ID, provider, model, timestamp, and billable usage. Keep the original source IDs so retries do not double-count.
Use the same time zone and period boundaries for both views. Provider credits, billing adjustments, and reseller charges can make a statement differ from usage priced with public model rates. A cost API is not always a complete supplier bill.
Map before you allocate
Join each application event to a customer contract with an explicit mapping. If a background job benefits several customers, define a documented allocation rule for that job. If ownership is unknown, leave the cost unallocated until someone resolves it.
A provider project or workspace can help narrow scope, but it is not automatically a customer ID. Shared infrastructure, tests, and internal workloads often live in the same provider account as production traffic.
Reconcile the totals
Compare attributed direct usage cost with provider-reported cost for the same scope. Show the variance by provider and period. Investigate model-rate gaps, retries, missing event capture, credits, and scope differences before concluding that a customer margin is complete.
If the provider total is $12,000 and attributed events explain $10,900, the $1,100 gap is a question to resolve. Allocating it proportionally may hide a specific untracked workflow. The gap should remain visible until the cause is known or a documented allocation is approved.
Use the result in contract decisions
Once revenue and direct cost are aligned to the contract, calculate known contribution and compare it with the target margin floor. Show the source coverage next to the figure. Where evidence is incomplete, treat known contribution as an upper bound.
Solvren supports read-only OpenAI and Anthropic organization cost connections, metadata-only application events, CSV imports, and an explicit supplier variance. It does not pull prompt or response bodies or silently assign unmatched spend to customers.
Apply this to your own contracts
Test one contract’s known margin with the free calculator, or explore how Solvren keeps source gaps and decisions together.