Skip to content
reaatech

Per-tenant LLM cost tracking and chargeback for vertical SaaS

Attribute every LLM call to the right tenant and export cost data to your billing system.

The problem

The VP of Engineering at a B2B vertical SaaS company needs to bill each SMB customer for the AI features they use. Without per-tenant cost tracking, the company absorbs all LLM expenses, eroding margins. Existing observability tools don't tie token usage to tenant IDs, making chargeback impossible. The team manually approximates costs, leading to billing disputes and lost revenue.

Example artifact

A complete, working implementation of this recipe — downloadable as a zip or browsable file by file. Generated by our build pipeline; tested with full coverage before publishing.

161 kB·74 tests·100.0% coverage·vitest passing

SHA-256b55e725fb7f615f13ae97146c292cdb32e608a16ead3b10328c9109721dc4410

Comments

Sign in with GitHub to comment and vote.

Loading comments…