Token cost
Token cost depends on measured usage, the applicable input and output rates, cache rules and any additional service fees. Estimate with explicit assumptions and verify against actual billing.
Before you start: Review Guardrails first. Python-like examples use variables, lists and functions.
Follow the mechanism
Usage
Measure input and output per request.
Start with an everyday explanation
A phone bill depends on how much you use and which rate applies. Counting users alone cannot tell you the bill without their usage pattern.
See a concrete example
At assumed prices of 2 per million input and 8 per million output, 1,000 input plus 200 output tokens cost 0.0036 currency units per request. 10,000 such requests cost 36, excluding other fees.
A claim to question
A fixed cost per thousand users is not portable across workloads or providers.
Try before revealing the answer
Use the cost calculator to double output length while holding input fixed. Explain the cost increase.
Show the worked answer
Output cost doubles; total cost rises by the additional output charge rather than doubling automatically. Specify currency, units and whether rates are real or hypothetical.
Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.
Engineering details and trade-offs
Separate input, cached input and output tokens. Include retries, tool loops, failed requests where billed, embeddings and infrastructure as applicable.
Use editable rate assumptions rather than presenting old example prices as current quotes. Track distributions and spend limits, not only the average request.
Reason through the example
At assumed prices of 2 per million input and 8 per million output, 1,000 input plus 200 output tokens cost 0.0036 currency units per request. 10,000 such requests cost 36, excluding other fees.
Implement and test
Use the cost calculator to double output length while holding input fixed. Explain the cost increase.
Inspect the reasoning and expected result
Output cost doubles; total cost rises by the additional output charge rather than doubling automatically. Specify currency, units and whether rates are real or hypothetical.
What to measure
State the expected result before changing a control. Record your inputs, compare the observed result and explain one limit of this model. In a real implementation, test the failure case as well as the normal path.
Answer before reading the reference
How would you reduce cost without hiding quality regressions?
A defensible answer
Measure token use and repeat work, improve evidence selection, cap loops, cache safely and compare smaller models on the same held-out tasks. Track quality, tail latency and real charged usage together.
Prepare the follow-up
How would you set a per-user budget for a multi-step agent?
Show follow-up reasoning
Assign a per-task maximum token and call budget, estimate worst-case spend from allowed rates and reject requests that cannot fit. Charge actual usage to the user scope, include eligible retries and concurrent runs and stop when limits are reached. Estimates do not replace billing reconciliation.
Use the engineering explanation and worked task above to support your response. Identify which assumptions you would need to verify in production.
Choose a practice depth
- New to GenAI
- Define token cost with the everyday example and name its key limitation.
- Applied experience
- Explain the example, implementation choice and a measured failure case. Use the exercise as a small design review.
- Senior or systems depth
- Answer the follow-up, compare alternatives and justify an evaluation or rollout plan with operational constraints.
Self-review your answer
0/4 checks selected. This is self-assessment, not an interview score.
Your explanation and revision notes
Loading local notes…