A token worksheet for MAI Code 2 Flash

Turn usage records into a repeatable cost estimate. Separate cached input, fresh input and output before multiplying by call count.

Start with three quantities

For one representative call, record total input tokens, the number of input tokens billed at the cached rate, and billable output. Providers and logs can label these fields differently. Read the field definitions where the usage was measured. A cache hit is a portion of the original input, so never add it twice.

Quantity Example per call How it enters the estimate
Total input 12,000 Includes the reused context
Cached input 8,000 Priced at the cached input rate
Uncached input 4,000 Total input less cached input
Output 1,500 Priced at the output rate

For each category, multiply its tokens by the number of calls and then by its matching dollars-per-million rate. Divide by one million. Add the three charges. The pricing calculator does this separately for both published schedules. GitHub token billing units

What if the workload varies?

Suppose half your calls carry a large repository context and half are short completions. Make a run for each group using the observed mean tokens in that group and its own request count. Export both CSVs and add their selected totals. A request count represents model calls; a single user task can need several calls. For a pilot, track retries and failed attempts that incurred usage.

How much would a cache hit save?

For the review example over 1,000 calls, setting cached input to zero raises the promotional estimate from $0.615 to $0.975. The $0.36 difference assumes the total input and output stay the same. Cache eligibility and actual reuse depend on your service. Start from your observed usage rather than predicting a hit for every repeated line.

Use the effective-date rate card if your workload spans May 17, 2027.

What does 10,000 input tokens mean on a monthly estimate?

Suppose you make 1,000 model calls a day for 30 days. Each call produces 2,000 output tokens and records 7,500 cached input tokens. At promotional rates, the definition of the reported 10,000 input tokens changes the estimate.

What the usage record means Total input to enter Cached input to enter Cost for 30,000 calls
10,000 total, including cache hits 10,000 7,500 $19.875 (about $19.88)
10,000 uncached, with 7,500 additional cached 17,500 7,500 $31.125 (about $31.13)

Enter 30,000 in Requests for both cases. The first case has 2,500 uncached tokens per call. One chat session can contain multiple model requests, especially when a coding agent calls tools and continues the same task. Count billable model calls from your usage record and compare the model usage total with your plan's credits and other charges separately.