Use case
How to track OpenAI and Anthropic spend by customer, across providers
Two providers, one customer. Provider reports group usage by model, project or API key; the customer has to come from your application.
Route each provider's supported traffic through Spendline and send the same x-customer-id on each request. One ledger covers the routed providers, so a customer's AI cost is one query rather than two invoices.
How it works
Each ledger entry records the provider and model; the customer header adds who the call was for. Use the same stable customer ID everywhere your product calls a model: the web app, background jobs and any second service. If one path sends an internal account number and another sends a billing ID, the same customer appears twice.
customer provider model cost_usd
cust_4f21a openai gpt-5.2 0.0124
cust_4f21a anthropic claude-sonnet-5 0.0310What to know before relying on it
Attribution is only as consistent as the IDs your services send. Background jobs that run without request context often lose the customer; pass it explicitly into the job, or the cost lands unattributed.
Why it matters
Attribution and enforcement are separate controls on the same ledger: a team can want combined per-customer cost without a shared cap, or the reverse.
Frequently asked questions
Do the two providers need to be tagged differently?
No. The same x-customer-id header works on each supported route. The provider is recorded from the request itself.
Can I see cost by provider within one customer?
Yes. Provider and model are separate fields, so a customer's total can be split without re-attributing anything.
See what this would look like in your product.
Start with a guided 30-day free pilot on live production traffic. The 30 days start when your traffic flows through Spendline, not at sign-up. We agree the scope, success criteria and paid terms before you start. There is no Spendline subscription fee during the pilot; your model-provider charges still apply.
Prefer email? fida@spendline.ai