Skip to content
Free$1 of credit for every new organization
All articles

Billing

Estimating cost before you ship

A back-of-the-envelope method for predicting what an AI feature will cost per request and per month, and checking the estimate against real usage.

· 3 min read · Usefully team


"How much will this cost?" is a fair question before launching any AI feature, and it has a surprisingly concrete answer. Token prices are public, your prompts are known, and Usefully charges the provider's list price with no markup on tokens. So you can estimate a month with arithmetic, then check it against a week of real traffic.

Step 1: measure one request

Run a realistic request and read its usage. Do it for a handful of real inputs, not one, because input length varies.

reply = client.chat.completions.create(model="anthropic/claude-sonnet-5-5", messages=messages)
print(reply.usage.prompt_tokens, reply.usage.completion_tokens)

Note three numbers: average input tokens, average output tokens, and the share of requests that are retries or follow-ups. Remember that input includes the system prompt, any retrieved documents and the conversation so far. In chat apps the history grows with every turn, so the tenth message costs more than the first.

Step 2: apply the prices

Every model on the models page lists its input and output price per million tokens. The cost of one request is:

cost = input_tokens  / 1_000_000 * input_price
     + output_tokens / 1_000_000 * output_price

Then multiply by requests per day and by 30. Add web search if the feature uses it: search is billed per query, not per token, and the per-query price is on the search page and in GET /v1/models.

A worked example

Say a support assistant averages 2,500 input tokens (system prompt plus retrieved articles plus the question) and 400 output tokens, and handles 1,000 conversations a day at three turns each. That's 3,000 requests a day, or 7.5 million input and 1.2 million output tokens daily. Multiply each by the model's price per million and by 30 days, and you have a monthly figure you can put in a plan. The pricing page has a calculator that does this multiplication for any model.

Step 3: add the fixed costs

  • Payment fee: a 3.5% fee is added when you buy credits, once per purchase, not per request.
  • Tax: depending on your country, sales tax may be added at checkout. Dodo Payments, our merchant of record, handles it and issues the invoice.
  • Failures cost nothing: failed requests aren't charged, and a request that fails over to another provider is charged once. You don't need a buffer for provider errors.

Step 4: find the levers

Once you see which term dominates, you know where to cut:

  • Input-heavy (RAG, long documents): retrieve fewer, better chunks; trim the system prompt; summarize old conversation turns.
  • Output-heavy (writing, code): set max_tokens, ask for concise answers, and avoid asking the model to repeat the input back.
  • Model choice: if a smaller model passes your quality check, it's often several times cheaper. See evaluating models on your own prompts.

Step 5: check against reality

After launch, the dashboard shows spend by day, by key and by model, and Logs show the cost of each request. Compare the first week with your estimate. If they differ, the cause is almost always input length: longer conversations or more retrieved text than you tested with.

Then put guard rails on it: a daily spend limit on the production key and a low-balance alert so a busy week doesn't become an outage when credits run out.

Prices for every model: models. Monthly calculator: pricing. Your first organization gets $1 of free credit with no card, enough to measure your real prompts before committing. Create an account.

More articles

Get started

Your first request is five minutes away.

  • $1 of free credit to start
  • No card, no subscription
  • Keep the SDK you already use
  • Real people at support@usefully.info
Estimating cost before you ship · Usefully