QUICK ANSWER
Token Cost Calculator
A token cost calculator converts model usage into an API cost estimate. Multiply input tokens by the model’s input rate, multiply output tokens by its output rate, add the two charges, and then multiply by the number of requests. Use the provider’s current rate and billing unit for the exact model.
The calculation
Convert each published rate to a per-token rate using the provider’s stated billing unit. Calculate the input and output portions separately because they can have different prices. Add any separately priced usage only when the provider documentation says it applies.
Use measured token totals
A character- or word-based conversion is useful for planning but is not an exact billed count. For a completed API call, use the usage values returned by the provider. For a forecast, use the tokenizer associated with the selected model whenever it is available.
Check for additional pricing rules
Some providers publish separate rates for cached input, batch processing, long contexts, images, audio, tools, or other features. These charges should not be silently treated as ordinary text input or output tokens.
From count to cost
Use the OpenAI Token Counter when you need a text count for an OpenAI encoding. Use the Token Cost Kit homepage to compare current token-based model costs. Read Counter Token if you need to clarify what the search phrase means.