Understanding usage and cost

Lesson 7 of 35 · Working with AI coding agents

An agent task can involve many model requests, not just the message you type. Each request may include instructions, prior history, tool descriptions, and tool results. Some services charge for input and output separately; other arrangements use subscriptions, included allowances, quotas, or combinations. Tool execution, hosting, storage, and network services may have their own charges.

Here is a purely invented usage-based example, not a current offer. Suppose a service charges $2 per million input tokens and $6 per million output tokens. A task uses 100,000 billable input tokens and 10,000 billable output tokens:

  • Input: 100,000 ÷ 1,000,000 × $2 = $0.20.
  • Output: 10,000 ÷ 1,000,000 × $6 = $0.06.
  • Total model usage: $0.26, excluding all other charges and taxes.

The input count is the sum across requests, not necessarily the largest context window shown in a session. If the same material is sent repeatedly, it can contribute repeatedly to usage. Some providers cache eligible input and apply different rates; cache hits, billing categories, and discounts are provider-specific. A cache does not make context space unlimited. Some services also count or charge for additional generated computation differently.

Use current provider pricing and usage reports for an estimate; verify billing units, cached and uncached rates, minimums, limits, and any separate tool fees. A subscription price does not imply unlimited use or a specific equivalent API value. Longer runtime does not always mean more model tokens, but compute or hosted tools can be billed by time. Set budgets and alerts where supported, and balance a cheaper request against the cost of retries and human review.