Token cost

Providers bill models by the number of tokens, fragments of text, counted for input and output, often at different rates. The cost of a request therefore depends on the size of the prompt, the context sent, and the length of the response.

Example

cost = input_tokens × input_rate + output_tokens × output_rate

Related concepts

The whole glossary