Study FAQ
How do you estimate token usage and model cost for a generative AI workload?
Also asked as 2
- How can I estimate input and output token costs per AI task?
- What goes into a token cost forecast for a generative AI workflow?
Answer
Forecast the number of business tasks and how many model calls each task takes, then estimate input and output tokens separately. Inputs can include application instructions, user prompts, conversation history, and retrieved passages. Count all calls, including retries and failed attempts. Apply current rates for the selected model and deployment when the service uses token billing.
For an illustrative workload of 800 tasks per period, assume 1.25 model calls per task, 1,600 input tokens per call, and 400 output tokens per call. That is 1,000 calls, 1.6 million input tokens, and 0.4 million output tokens. With rates expressed per million tokens, the model charge is 1.6 × input rate + 0.4 × output rate. If 650 tasks produce an accepted AI result, divide that charge by 650 to estimate the token charge per accepted result.
Replace the assumptions with measurements from representative pilot tasks. Vary adoption, context length, output length, retries, and acceptance across scenarios. Track separately billed search, embedding, storage, or application services as applicable. Price cached input separately only if the selected service meters it differently, and avoid counting it again in ordinary input tokens. Include deployment capacity and other metering terms if they affect the selected option.
Microsoft Learn on generative AI cost drivers · Microsoft Foundry’s agent optimizer token estimate and exclusions
Full explanation
AB-731: Generative AI Cost Drivers, Tokens, and ROI
Study guide · AB-731
Read the full explanation