API Token Cost Calculator

Paste an API response from GPT, Claude, Grok, or Gemini to see what one request costs.

Request JSON

Select a model if you paste only usage.

How to get usage JSON GPT-6.2 Sol

OpenAI Responses API

  1. Open the JSON response from POST /v1/responses in your API client or application logs. With streaming, take the response object inside response.completed.
  2. Paste the response here, or copy its entire usage object and select the model that made the request. Keep the cache read and write details.
Responses API usage fields (OpenAI SDK)
Using Codex Desktop or CLI?

Desktop app. To check your ChatGPT plan usage, open Settings or the Codex usage dashboard. For a chat in the app, there is no documented export of the single-request API JSON this calculator accepts.

Terminal (Codex CLI). To see token counts for a new run:

  1. In a Git project, run codex exec --json --sandbox read-only "Reply with OK" > codex-run.jsonl.
  2. Open codex-run.jsonl and find the line with "type":"turn.completed". Its usage object holds the reported counts.

The CLI counts can cover several API calls. To calculate a price here, paste one original Responses API reply from your API client or logs.

Codex plan and usage help Codex CLI JSON events (official source)

For other agent apps, look for a single provider response in your request logs. The estimate uses public API token rates.

Want to try the format? Load sample above replaces the editor contents with an example for this model.

Processed locally

Estimated request cost

—USD

GPT-6.2 Sol · Applied token rates

Without caching
—
Cache impact
—
Cache write break-even
—

View cost breakdown

Cost breakdown

No charges to show yet.

Token usage

No token counts yet.

Same tokens, three different bills

Each example uses 12,000 input and 1,000 output tokens on GPT-6.2 Sol at Standard rates. Trying an example replaces the calculator input.

No cache

$0.0340

All 12,000 input tokens are billed at the regular input rate. Use this as the baseline.

Mostly cache reads

$0.0131

Reading 11,000 tokens from the cache saves $0.0209 compared with the baseline.

Cache reads and writes

$0.0399

4,000 cache reads and 7,000 cache writes across two durations cost $0.0059 more on this request.

Try another API

How to estimate a real request

Use the actual response

Use the final API response so the calculator can read the model and token counts together. For a standalone usage object, choose the model yourself.

Compare requests that reuse the prompt

Check the no-cache estimate first. A cache write can cost more up front. Use the break-even estimate to see how many comparable cache hits would cover the extra write cost.

Which JSON fields does the calculator read?
GPT and Grok

Paste a final Responses API object. input_tokens includes cache reads, and output_tokens includes reasoning.

Claude

Paste a Messages response. Cache reads and the 5-minute and 1-hour writes are separate from input_tokens.

Gemini

Paste a generateContent response. The estimate adds thoughtsTokenCount to candidate output.

Only have token counts?

Paste usage or usageMetadata and select the exact model. A complete response can select it for you.

How is the estimate calculated?

Each token count is multiplied by its rate per million and divided by one million. The estimate adds uncached input, cache reads, any supported cache writes, and output. The no-cache estimate prices all the same input at the regular rate.

When do long-context rates apply?

The threshold depends on the model. For example, the GPT-6 models listed here switch above 272,000 input tokens and Grok switches at 200,000. The rate card shows the prices applied to the full request.

Why might my invoice differ?

The estimate uses the listed first-party rates for standard paid text requests. Check your invoice for free-tier usage, Batch or Fast pricing, regional surcharges, tool fees, explicit Gemini cache storage, taxes, and discounts.

Privacy

Request JSON is processed in your browser. Token Cost Check does not send or store the JSON, prompts, token counts, or cost estimates. The copy button writes your estimate to your clipboard.