انتقل إلى المحتوى
#0708
ExecSqlite

Bill AI customers from a meter, not an estimate

Your SaaS resells AI features, and month-end billing is currently an estimate.

A script fronts the gateway for all of your product's AI calls. Each request carries the customer's id in a header; each response comes back with its actual token usage. The script writes one row per call: customer, model, tokens: into a SQLite table as the traffic flows.

You pay the gateway from your AI Balance, provider cost plus five percent. You invoice customers from the table: a sum per customer of what actually happened, measured at the one point every call passes through.

No metering SDK in the product, no log-scraping pipeline at month end. The invoice is a SELECT over what actually happened.

The invoice is a SELECT over what actually happened.