Estimate request cost and budget impact
POST/v1/budget/estimate
Enterprise-only pre-flight check for one model request. Supply a model
and optional max_tokens; DVARA estimates the maximum output cost from
the model's output allowance price, the higher of its output and
reasoning rates. Add messages, and optionally tools, in the Chat
Completions shape to price the input tokens too.
DVARA then checks the tightest applicable
budget for the authenticated workspace and API key, and returns the
remaining budget without calling a provider or writing usage or cost.
pricing_known: false means neither your pricing list nor the packaged
model catalogue has a price for the model.
In that case estimated_cost_usd is 0.0 and is not a reliable cost
forecast. would_exceed_budget is still true when the workspace or
key is already at or above its hard cap, even when pricing is unknown.
A nonempty API-key scope list must include completions:write. An
unscoped key remains unrestricted. This endpoint is not included in the
Open Source runtime.
Request
Responses
- 200
- 400
- 401
- 403
- 429
Cost estimate and current budget decision. Nullable remaining-budget fields mean no applicable budget is configured.
The required model field is missing or blank (validation_error), the body is not valid JSON (invalid_json), or messages are not chat messages as /v1/chat/completions takes them (invalid_request).
No key was sent (api_key_required), or the key is unknown (invalid_api_key), revoked (api_key_revoked) or expired (api_key_expired).
The key is valid but its nonempty scope list does not include completions:write (api_key_scope).
The key's rate limit is reached (rate_limit_exceeded, with a Retry-After header), priority admission control throttled the request (priority_throttled), or the provider is rate limiting the call (provider_rate_limited, with Retry-After when the provider gave one).
Response Headers
Seconds to wait before retrying, when known.