Request body
First find the model and provider pair that matches the service you used. The example below prices 1,200 prompt tokens and 340 completion tokens forgpt-4o on openai. These are illustrative usage counts, not the expected length of a particular prompt.
Response
The response identifies the priced pair and exposescost_breakdown.total in USD. At the rates checked on September 9, 2026, the example returned:
1200 × 0.0000025 + 340 × 0.00001 = 0.0064. Re-run the request for a current estimate. Preserve full precision when summing many calls and round for display afterward. The published response schema guarantees the total, so avoid depending on undocumented itemized response fields.
Optional usage fields
The request also acceptscache_read_tokens, cache_write_tokens, reasoning_tokens, and web_search_count. The cache and reasoning fields default to zero. Supply the provider’s usage breakdown rather than inferring cache hits from repeated prompt text.
Token totals and their subcategories must follow the selected provider’s accounting. For direct DeepSeek, verified calls use total prompt tokens including cache hits and total completion tokens including reasoning. Do not subtract those subcategories before sending the totals; the DeepSeek example demonstrates the arithmetic. If your tracing system stores disjoint buckets, reconstruct totals before calling the endpoint. Do not assume that an unfamiliar provider or modality follows the same mapping without checking its usage contract.