pricing · 2026-09-28

How input, output and cached usage affect API cost

Check each model's billing units and current prices before estimating cost from its usage fields.

RelayAI · 中文

Identify the billing units

Text models commonly price input and output tokens separately. Image, audio and other modalities may use different units, so one text formula does not cover every endpoint. Check the current pricing page and signed-in console for the model and account in question.

Reconcile a request

Record the model ID, request time, available usage fields and server-side consumption record. Apply a separate cached-input price only when that model explicitly reports cached usage and publishes an applicable rate. Do not assume a cache discount when those details are absent.

Allow room in budgets

Longer output, conversation history and retries can change total usage. Configure project budgets and alerts, then compare a sample of application measurements with console records. This article explains the method without repeating prices that may change.

Sources

Read API docs