How do you convert LLM token usage into credits for billing?

If you charge for an AI product on usage, you’ve probably hit this. Your LLM provider reports tokens, Stripe bills whatever number you send it, and customers want credits they can understand.

I wrote up the full logic step by step: capturing input, output and cached tokens, pricing them from a model rate card, adding margin, converting to credits, and metering on Stripe. There’s a worked example with real numbers throughout.

How to turn AI token usage into credits you can bill on Stripe:

Curious how other makers handle this. Do you bill in credits, pass tokens straight through, or charge for outcomes? And has anyone been caught out by cached tokens or rounding?

85 views

Add a comment

Replies

Best

The underrated part of this whole pipeline is giving customers a way to reconcile. If someone's bill jumps, they want to see which requests cost what — not just a total. We expose a per-request token breakdown alongside the credit charge, and support tickets about billing dropped noticeably. Credits are fine as the customer-facing unit, but the token detail needs to be available underneath or you'll be defending every invoice.

 That answers what I asked above, thank you. Boomship shows the charge and the model on each job's receipt today. Your point pushes me to put the per-request detail underneath it as well, not only the total.

   

Very true! If we take token-to-credit conversion as a simple application logic, then it comes with problems like reconciliation like you said. This must be built as micro-service that tracks, coverts, bill and manage tokens in terms of equivalent credits for every customer. Only then such reconciliation problems will be addressed.

This micro-service should be connected to the billing tools like Stripe, Paddle etc.

Hit me up to know how to solution this.

   Agreed it shouldn't live in app code. We keep ours as a separate credit ledger the app writes to, with the payment provider behind it, so a bill can always be traced back to the calls that made it.

We went with credits, but with a twist: credits are priced off tokens internally, but customers never see tokens at all. They see "runs" or "reports." The reason is simple — token counts are volatile and model-dependent, so the same action gets cheaper every time a provider drops prices, and customers notice. Credits let us absorb that quietly instead of renegotiating every contract.

 If tokens to credits conversion is not happening in a way protecting your margin 100% always, you're actually leaving money on the table. Most early-stage companies don't focus this, rather they'd prefer to bring more customers and ended up with lose-making business.

The margin step is where I've seen the most disagreement inside teams. Do you apply margin to the raw token cost and then convert, or convert first and round up to the nearest credit? We did the latter and it worked fine at scale, but the rounding on small requests added up to a few percent of revenue that nobody had forecasted — in a good way, but it still surprised finance. Worth calling out explicitly in your writeup.

 

Do you apply margin to the raw token cost and then convert, or convert first and round up to the nearest credit?

"Apply margin to the raw token cost and then convert" because the later one will not protect your margin every time.

Also, have multiple credit conversion logics and apply them in different scenarios.

Definitely, will write about this in detail with sample use cases.

The most interesting option in your list is outcomes, and it's the one least covered. Charging per resolved ticket or per successful extraction aligns you with the customer and sidesteps the whole token-to-credit conversion problem — you just need a reliable definition of "outcome." The hard part is disputes: when is a result "successful"? We ended up with credits because outcomes were too fuzzy to bill on without a human in the loop.

 Outcome-based pricing is another conversion of token consumption. The difference is, Outcome is multi-agent workflow and long running processes. For eg: Document processing, Sales meeting bookings. Each agent involved in the workflow consume tokens, those should be tracked to calculate the cost for achieving one outcome, and compare with your pricing value to the customer, so that we can optimize the cost iteratively.

Check out: — This is works exactly the way you expect.

We skipped credits entirely. LinkedInRank sells a one-time pack with plain counts instead: 25 tailored job matches and resumes, 2 full LinkedIn rewrites and 8 section redos over 30 days. Internally that's a budget of about 60 AI calls per pack, plus a daily cap so one person can't burn the shared provider quota in an afternoon.

The other thing that helped: through our MCP server, the user's own assistant (Claude, ChatGPT) writes the resume, and we only check, score and save it. That path costs us no tokens at all, so it doesn't need metering.

Does the credits model hold up when users can't predict how many tokens a task takes? That seems like the hard part.