API-based AI is metered by the token, and workflows that cost nothing in a chat window can cost real money at automation scale. Professionals trusted with AI budgets can do two things: estimate a workflow's cost before building it, and cap it so a bug or usage spike can't produce a surprise bill.
Tier: Core · Hands-on time: ~45 minutes
This playbook walks one worked example end-to-end and leaves you a reusable calculator.
Learn the one formula. Everything reduces to:
monthly_cost = runs_per_month ×
( (input_tokens / 1,000,000) × input_price_per_Mtok
+ (output_tokens / 1,000,000) × output_price_per_Mtok )
Two facts to internalize: output tokens usually cost 3–5× input tokens, and English text runs ~4 characters (≈0.75 words) per token, so 1,000 words ≈ 1,300 tokens.
Measure, don't guess, the tokens. Run your representative input once through the real prompt and read the usage report — every provider's API response includes exact input/output token counts (and chat consoles/AI dashboards expose them too). Record: input_tokens, output_tokens. Remember input includes your entire prompt: instructions, few-shot examples, and the document itself.
Do the worked calculation. Example — nightly support-ticket summarizer: 400 tickets/day, each ticket ~600 words plus a 300-word prompt template (~1,200 input tokens), ~150-token summary out, on a mid-tier model at illustrative rates of $0.60 per M input / $2.40 per M output tokens:
per-run input: 1,200/1M × $0.60 = $0.00072
per-run output: 150/1M × $2.40 = $0.00036
per-run total: $0.00108
monthly: 400 × 30 × $0.00108 ≈ $13.00/month
Now stress it: same workflow on a frontier tier at 10× rates ≈ $130/month; with a verbose prompt that doubles output ≈ $17. You've just seen which knobs matter — tier first (pb-10), output length second.
The dollar rates above are illustrative, in the realistic range for mid-2026 mid-tier models; always substitute the current numbers from your provider's pricing page.
Build the calculator once. Put the formula in a spreadsheet with cells for the six variables (runs, in-tokens, out-tokens, two prices, days). Add rows for pessimistic cases: 2× volume, 2× output. If the pessimistic monthly number is still fine, proceed; if it's scary, you've found that out for free.
Cap it in the provider console. Estimates guard the plan; caps guard the wallet. In your API provider's billing/limits settings, configure before going live:
Reduce the big terms. Attack in order of leverage: route to a cheaper tier if your eval allows (pb-10); shrink the prompt template, or use prompt caching if offered (repeated prefixes typically become ~90% cheaper); cap output with explicit length limits ("max 100 words") — output is the expensive direction; and use batch processing where available (~50% discounts for non-urgent jobs like nightly runs).
input_tokens include the prompt template? It must.