Your provider bill is one number for one API key. To know whether a customer is profitable to serve, you need that number split by the customer who incurred it. Here is the practical way to get there, and what it takes to keep it accurate.
OpenAI and Anthropic price the API call. They have no idea which of your customers triggered it, because that concept only exists in your application. So the usage page can show a total and a per-key breakdown, but never cost per customer. That mapping has to be added where the run happens, by you.
The unit is the agent run. Tag each run with the customer it serves at run start, send the model and token counts, and let AgentPing price it from a rate card. Cost then rolls up per customer without any manual spreadsheet work.
import agentping agentping.init(api_key=os.environ['AGENTPING_API_KEY']) with agentping.run('support-summary', customer_id='acme-corp', feature='ticket-digest') as run: response = agent.handle(ticket) run.set_output(response)
The SDK sends tokens and model, not a cost number. AgentPing prices the run on our servers, cache aware, so your totals line up with the provider invoice. Tagging is the only change to your code.
customer_id.agentping.run(...) at the start of every agent run that serves a customer.feature tag so you can also see cost per feature.Spend, cost attribution → AgentPing for SaaS teams → Spend docs →