AI Help

How do I estimate the API cost of one completed AI task?

Measure all billable work for the task, including retries and tools, then divide total cost by verified completed tasks.

Steps to follow

  1. Assign a task ID to each attempt and record model usage, cached usage, tool charges and any separately billed storage.
  2. Apply the provider's current prices to the matching model and billing category. Keep estimated charges separate from the final bill.
  3. Include failed attempts in total cost and define completion using the actual business result. Record the price date and currency.

Example in practice

Illustrative example. If ten accepted tasks and two failed attempts cost $0.60 in total, the observed cost per accepted task is $0.06.

Related AI help

Official guidance

OpenAI documentation