You already know a request is priced by the token, and that input and output are counted separately. This node is about the arithmetic underneath that: how a provider actually turns your token counts into a number on a bill, and why the same task can cost very different amounts depending on how you run it.
A production LLM has two price tags, not one:
These rates are almost always quoted per million tokens, because a single token is a tiny fraction of a cent and the round numbers only show up at scale. The output rate is usually several times the input rate, since generating text is the expensive half of the work.
The cost of one request is just the two meters added together:
cost = input_tokens x input_rate + output_tokens x output_rate
Nothing more exotic than that. Count the tokens each way, multiply each count by its own rate, add the two.
Because both counts and both rates can move, two requests that look alike on the surface can land far apart on price:
So the price of a request is never fixed by the question you asked. It's set by which model answered and how many tokens flowed each way. Those are both things you control, which is what the rest of this topic is about.
On this lab the cost is covered for you, so you won't see an invoice. But the moment AI work moves into production - a script, a service, anything that runs on real traffic - every request is billed exactly this way. Knowing the formula means you can estimate a feature's cost before you ship it, just from the token counts you can already read off a response.
Your lab setup
This VM comes preconfigured with your AI keys - just type claude to get started. Your key and URL are already set as $OPENAI_BASE_URL and $OPENAI_API_KEY.