The cost formula
Standard call: `cost = (input_tokens × input_rate) + (output_tokens × output_rate)`. With prompt caching the equation becomes: `cost = (cache_write_tokens × input_rate × 1.25) + (cache_read_tokens × input_rate × 0.10) + (fresh_input_tokens × input_rate) + (output_tokens × output_rate)`.
All token counts are per 1M tokens — divide by 1,000,000 to get the per-call dollar amount. Anthropic counts tokens slightly differently than OpenAI; expect ~10-15% more tokens for the same English text vs GPT-5's tokenizer. Tool definitions, system messages, and prior conversation turns all count as input.