Tokens, credits, budgets and total cost
A call’s price is not a complete task’s cost.
What you will learn
- Explain: cost belongs to the whole path
- Apply the idea in an example: Tokens, credits, budgets and total cost
- Recognize limitations and verify the exercise outcome
A call’s price is not a complete task’s cost. Count indexing, conversation and tools separately.
You can follow this course without an account or programming. Examples use synthetic data and AI outcomes need checking.
How it works, step by step
Cost belongs to the whole path
Count model calls, input and output tokens, embeddings, reranking, vision and tools. Reasoning can consume billable tokens without an equally long visible response. Indexing costs and conversation costs differ. Use current prices rather than a permanent number from a course. A simple estimate is tokens/1,000,000 × price plus additional operations; application credits may have their own conversion. Compare cost per successful task, not just per call. Parallel execution can reduce latency while increasing total consumption. A budget needs a verified stopping condition.
Choose by task and capabilities
Check language, context, tool calling, structured output and supported input modalities. Compare models on identical requests using the same rubric and a realistic budget. Temperature changes sampling, not truth. Reasoning effort allocates effort for compatible models and can increase time and cost; accepted values vary. Local models offer infrastructure control but require resources and maintenance. Open weights do not guarantee an unrestricted license or complete training code. Catalogs and prices change; read the current model card.
Define success before optimizing
Prepare representative requests and expected answers or properties. Include ordinary cases, ambiguity, missing data and tool errors. For RAG, measure evidence retrieval separately from answer correctness. Recall@k measures the share of relevant evidence found in the first k results; precision@k measures the share of returned results that are relevant. For agents, also track actions, permissions and stopping. An LLM-as-judge can speed evaluation but needs calibration against humans. Do not change prompt, model and index simultaneously if you want to understand what improved results.
The visual map
Follow the solid arrows for the main flow. Dashed blue arrows supply data or context; dashed pink arrows show feedback or returning results. Colors and shapes distinguish models, stores, decisions and outputs. On smaller screens, scroll horizontally to follow the entire diagram.
A complete example
Using fictional prices of 2 per million input and 10 output, 10,000 input and 1,000 output cost 0.03 monetary units before tools. These are exercise values, not current prices.
Try it yourself
- Estimate three calls and one indexing run, then cost per successful task.
- Record the input, source and expected outcome before running the experiment. Use only the fictional data in the example.
- Follow the diagram stages. At every step record what information is received and produced; do not confuse intermediate output with the final outcome.
- Repeat after removing necessary information or making the input ambiguous. Check whether the system clarifies, stops or invents an answer.
- Compare with the explained solution. Keep the configuration, date, result and an explanation for differences. Change one thing and retest.
An explained solution
Compute 0.02 + 0.01 and add extra consumption separately; compare with actual organization usage. A successful exercise lets you show the connection between input, stages and outcome. When information is missing, a cautious answer is more useful than invented details. Compare more than style: check conditions, sources and operations too.
When it helps and what can go wrong
Application credits and provider currency may have different conversions. Choose this approach when it improves a measured need. Keep a simple baseline and compare outcomes using identical inputs. One successful example does not establish reliability in every situation.
Check your understanding
Are more simultaneous calls automatically cheaper?
No. Elapsed time and total consumption are different quantities.
Does zero temperature guarantee correctness?
No. It may reduce variation, but a stable answer can still be wrong.
What outcome should this exercise produce?
Compute 0.02 + 0.01 and add extra consumption separately; compare with actual organization usage.
Words to remember
- Latență / Latency: Time until a useful result.
- Reasoning effort: A model-dependent setting controlling reasoning effort.
- Regresie / Regression: A change that breaks a previously correct case.
Sources and your next step
To prepare: E04 — Observability and debugging