Cost estimation
This page explains how PlainField estimates the cost of each request and why the number is an estimate, not a bill.
How it works
Every provider returns token usage in its response (prompt tokens and completion tokens). After proxying, PlainField reads those counts and multiplies them by a built-in per-model pricing table:
estimated_cost_usd =
input_tokens × price_per_input_token(model)
+ output_tokens × price_per_output_token(model)There is no extra call to the provider to compute this — PlainField already has the token counts from the response body, and the prices are known constants.
The result is stored with the log entry and aggregated by /api/costs and the
dashboard’s Analytics view.
Why it is an estimate
- Pricing drift — providers change prices; the table reflects the values at the time it was last updated.
- Unlisted models — a model missing from the pricing table contributes
0to the cost. Iftotal_cost_usdis unexpectedly0, the model is probably not in the table. See Providers and models. - Provider-side discounts — volume discounts, committed-use rates, and promotional credits are not modelled.
- Non-token charges — features billed outside token usage are not included.
Treat the estimate as a fast, directional signal for comparing prompts, models, and users — not as an invoice.
Keeping it accurate
Cross-check the estimate against your provider’s official billing for the periods that matter, especially if you have negotiated pricing or use models that are not in the pricing table.