---
title: "Usage accounting"
description: "See what each request cost and when the wallet is charged."
---

# Usage accounting

Each successful completion reports its charge in USD three ways:

| Where | When |
|---|---|
| `usage.cost` in the body | In the answer; on a stream, in the final usage chunk. |
| `X-PG-Cost-USD` header | With a non-streamed answer. On a stream, read `usage.cost` in the final usage chunk. |
| [GET /generation](../api/generation.md) | Shortly after the request ends. |

The charge is the token counts the host reported, times our price per token.
An error answered before the host produced output costs nothing. A finished host response that the gateway could not translate can still be charged.

## When the wallet changes

1. Before a request starts, the gateway reserves its largest possible cost from the balance.
2. When it ends, the real cost replaces the reserve and lowers your spendable balance at once.
3. Every 5 minutes, billing writes each closed hour's total to the wallet ledger as one usage row. A later correction to an hour is written as an adjustment row; an hour whose usage disappears is credited back.

The [Activity](https://plaingateway.com/activity) page lists requests and their cost.
