Skip to main content
Calculate a request’s cost when you have its model, provider, and token usage. You can use estimated counts for planning or recorded usage to price a completed call. Narev Cloud calculates a catalog-based dollar amount; this endpoint does not execute inference, charge a customer, or reconstruct a historical invoice.

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 for gpt-4o on openai. These are illustrative usage counts, not the expected length of a particular prompt.
Use counts reported by your inference provider when available. Character counts and word counts are not token counts. For a multi-call agent workflow, price every call, including retries and follow-up generations, before adding them into a workflow total.

Response

The response identifies the priced pair and exposes cost_breakdown.total in USD. At the rates checked on September 9, 2026, the example returned:
That snapshot follows 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 accepts cache_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.

Check the result before using it

Check the HTTP response before reading the total. The API reference documents validation failures, unavailable public pricing, and missing model/provider prices. Do not convert a failed lookup into a zero-cost request. Resolve the identifiers or pricing availability first. This calculation uses the rates available at lookup time. A backfill over older usage is a current-rate estimate unless you separately retain the historical prices. Negotiated discounts and charges outside the supplied usage are also reasons your invoice can differ. For customer billing, define your sell price separately from this inference cost.

Compare models fairly

Reusing this usage object across model pairs isolates rate differences. It does not predict how many tokens another model will consume: tokenization, reasoning, and output length can change. Follow Compare cost between two models to turn the estimate into a workload evaluation.