AI Usage Log Cost Calculator
Turn real API usage into a cost log. Paste a response or enter token counts, price them against current catalog rates, and export the rows you need.
100% free · no signup · browser-local
How do I convert real API prompt_tokens and completion_tokens into cost?
Paste the usage object from a response into the tool above.
Expand the details
It reads prompt_tokens and completion_tokens (or input_tokens and output_tokens), removes cached reads from billable input when the provider already includes them, multiplies each token bucket by the selected model’s per-1M rate, and totals the row. Entries stay in this browser and export as CSV or JSON.
- One response, one row: OpenAI, Anthropic, and generic usage shapes are accepted. The raw JSON is never stored.
- Repeatable math: Set request counts, toggle batch pricing, and compare cost per run across rows.
Runs logged
0
Tokens tracked
0
Estimated spend
$0.00
Cost per run
$0.00
Add one call
Enter the usage object from a single API response.
This entry costs
$0.03
Paste an API response
Accepts OpenAI prompt_tokens and Anthropic input_tokens/cache fields. Raw JSON is never saved.
How the cost is calculated
- Input: billable input tokens × the catalog input rate.
- Cached reads: catalog cache-read rate when published, otherwise the input rate.
- Cache writes: 1.25× the input rate, matching Anthropic's cache-write premium.
- Output: output tokens × the catalog output rate.
- Batch: 50% off the subtotal when the selected model supports Batch API.
Usage log
Saved only in this browser. Clear it whenever you want.
No logged calls yet
Add a row or paste an API response above.
Log a real API call in three steps
- Copy the
usageobject from a response, or use the copyable capture helper next to the paste box to make your own responses loggable. - Paste it above, or add one row by hand. The matching model is detected from the response when possible, and every price comes from the LLM Price Index.
- Label rows by feature or experiment, then export CSV or JSON. Spreadsheet formulas can group by label without a paid dashboard.
What the log prices, and what it does not
| Field | Billing rule used |
|---|---|
| Input tokens | Billable input after cached reads are removed when the provider already includes them in prompt_tokens. |
| Cached reads | Priced at the catalog cache-read rate, or the input rate when no separate cache rate is published. |
| Cache writes | Priced at 1.25× the input rate, matching the Anthropic cache-write premium. |
| Output tokens | Priced at the model’s output rate, usually 3×–5× higher than input. |
| Batch calls | Subtotal reduced by 50% only when the selected model supports the Batch API. |
Tokenizer APIs, image generation, web search fees, and provider subscriptions are outside this log. For workload forecasts before you ship, use the use-case cost guides or the full cost calculator.
AI Usage Log FAQ
5 short answers — tap a question to expand.
Which API response shapes can this usage log parse?
It reads OpenAI Chat Completions usage (prompt_tokens, completion_tokens, prompt_tokens_details.cached_tokens), OpenAI Responses API usage (input_tokens, output_tokens, input_tokens_details.cached_tokens), Anthropic Messages usage (input_tokens, output_tokens, cache_read_input_tokens, cache_creation_input_tokens), and generic camelCase token fields. Only the counts are kept; the raw paste is discarded.
Why are cached input tokens priced separately?
OpenAI includes cached tokens inside prompt_tokens, so billing them twice would overstate cost. Anthropic reports cached reads and cache writes outside input_tokens. The log detects which convention the response uses, subtracts included cached reads from billable input, and prices the cache buckets at their published discount rates.
Where do the prices come from, and are they live?
Prices come from the TokenCalc AI catalog snapshot that also powers the calculator and the machine-readable /api/price-index endpoint. They are not live provider quotes. Check the source link on a model page in the price index before using the export for invoicing or finance reporting.
Is my API data uploaded or stored on your servers?
No. Parsing and cost math run entirely in your browser. Logged rows are saved only in this browser’s localStorage under tc_usage_cost_log_v1, and you can clear them at any time. Exports are generated locally as CSV or JSON. Never paste secrets, keys, or user content into the paste box — only the usage object.
How do I track cost per feature, experiment, or customer?
Add a short label to each row, such as a ticket ID, experiment name, or endpoint. The table totals tokens and estimated spend across all rows, so you can group by label in a spreadsheet after exporting the CSV. For pre-build budgets, use the agent cost simulator or the main token cost calculator instead.
Prices are a catalog snapshot, not a live provider quote. Raw API payloads are parsed in your browser and never uploaded or saved.
Keep exploring
Overpaying Checker
Compare ChatGPT Plus, Claude Pro, Cursor Pro, or Claude Max ($20–$100/mo) against 2026–2027 pay-as-you-go API spend.
Token Cost Calculator
Simulate daily, monthly, and annual LLM bills across every model in the catalog.
Claude Code Cost
Price an agentic coding session: turns, context, tool results, cache hit rate, and output tokens.
Get price drop alerts
We'll email you when model prices change or new tools launch. Unsubscribe anytime.