# Advisory cost calculator

**Last updated:** 2026-11-23T10:59:54-03:00 (UTC-3)

Estimate the base model rate for a stated quantity before sending a request. The calculator performs no inference, reserves no budget, writes no ledger and never changes historical spend. It identifies the rate and coverage behind the result; an estimate is not an invoice.

## Enable and open

```yaml
features:
  external_model_catalog: true
  advisory_cost_calculator: true
  # Also needed only for configured-target quotes:
  automatic_price_catalog: true
```

The new flag defaults to false and is runtime-mutable through the normal feature API and Settings & sources. It is a global operator/catalog surface; global readers with `catalog:read` can calculate, while scoped team roles cannot see private global pricing. Flags do not grant permissions. Open **Model catalog**, choose a discovered model or an exact configured target, and select **Estimate cost**. The anonymous Hub remains metadata-only.

## Quantities and units

Choose one profile; the API rejects mixed fields rather than guessing conversions.

| Profile | Request fields | Published unit |
| --- | --- | --- |
| Text | `input_tokens`, `output_tokens` as canonical integer strings; at least one supplied, omitted other defaults to0 | USD per million text tokens |
| Media | Decimal-string `quantity` plus matching explicit `unit` | Per image, character, audio second or video second only when the source publishes that supported unit |

Counts accept up to18 integer digits; media quantity additionally accepts up to9 fractional digits. No signs, exponents, whitespace, nulls or JavaScript numeric coercion. Optional `requests_per_day` is an integer string defaulting to1. Daily and **30-day** planning amounts are exact server-derived values, not a calendar-month bill.

The server uses rational arithmetic and renders exact decimal USD strings. For an illustrative rate of1.50/6.00 USD per million input/output tokens, 1,000,000 input and250,000 output tokens cost3 USD at the base rate; ten such requests/day give30 USD/day and900 USD/30days. These are worked arithmetic values, not a claim about any provider's current price.

## Source identity and review

POST `/api/v1/admin/pricing/estimate` selects one exact public source (`openrouter`, `deepinfra`, `cost_map`, `modelsdev`) plus its exact `model_id`, or `source:configured` plus `alias`, `provider_id` and `model_id`. The latter reuses automatic resolution/voting and the enabled manual price book, whose entry in effect wins (`manual_fallback: true`, plus `override: true` when it replaced an available automatic price). Identifiers are bounded to4096 UTF-8 bytes inside a16KiB JSON body. The server accepts no client price or URL and uses only approved catalog origins.

The response echoes selection `source`, identifies actual `rate_source` when relevant, preserves source URL/time/staleness/confidence, and provides `basis_id`. An optional `expected_basis_id` returns409 when that reviewed rate basis changes; it does not authenticate a payment or approve budget admission. Quantities and projections do not change rate identity. A new quote can be reviewed explicitly after a conflict.

Use API access for the complete session-authenticated curl example. With an existing private cookie jar and an exact selected published model:

```sh
BASE_URL='http://localhost:8080'
: "${COOKIE_JAR:?Use the existing administrative session cookie jar}"
: "${MODEL_ID:?Choose the exact model ID from the selected source}"
jq -n --arg id "$MODEL_ID" '{source:"openrouter",model_id:$id,input_tokens:"1000000",output_tokens:"250000",requests_per_day:"10"}' |
  curl --fail-with-body -sS -b "$COOKIE_JAR" -H 'Content-Type: application/json' \
  --data-binary @- "$BASE_URL/api/v1/admin/pricing/estimate"
```

No provider API key is needed for these public-source reads. Existing snapshots retain the bounded cache policy; the calculator does not bypass TTL or fetch from arbitrary input URLs. For a direct public source with no usable snapshot,503 is an error rather than a zero quote. Configured targets preserve the resolver's unknown/conflict status unless an enabled manual price prices them; unresolved configured sources return200 with an unknown result and no invented total.

## Coverage and unknowns

- **Available:** all applicable requested quantities have supported rates; exact totals and projections are shown. This describes numeric quote coverage, not provider/account/model availability.
- **Partial:** known components have an explicit known subtotal; missing coverage never becomes a grand total.
- **Unknown:** missing/unsupported rates remain unknown, including uncorroborated all-zero community rows under the existing policy.
- **Conflict:** a configured rate-source disagreement remains visible and is not silently averaged.

First-party published zero and corroborated/manual rates retain their existing provenance rules. A stale snapshot may support a clearly labeled reference quote; it never proves the current charge. Public single-source quotes are not a voting/corroboration guarantee.

Text quotes accept optional `service_tier` (`default`, `priority`, `flex`, `batch`; `fast` is read as `priority`): the quote then prices that tier's published rate with its own source, echoes `service_tier`, and stays unknown (`service_tier_unpriced`) when no source publishes the tier. Warnings name the tier covered (`standard_service_tier_only` or `service_tier_<tier>_only`); see [service-tier pricing](/docs/features/service-tier-pricing/).

Coverage excludes cache discounts, context tiers, image-token dimensions, hosted tools, contract discounts, taxes, provider minimum billable durations/rounding and other extras. The calculator does not tokenize a prompt or infer missing quantities. Use measured usage, approved enforcement prices and [billing reconciliation](/docs/features/native-billing-imports/) for their separate financial purposes. Selection/identity/permission changes clear held UI results; the browser never recomputes money with binary floats.

See [registry](/docs/features/model-registry/), [automatic pricing](/docs/features/automatic-pricing/), [manual price book](/docs/features/pricing/) and [valuation](/docs/features/usage-valuation/).

## Public same-workload planning

The separate [public workload calculator](/docs/features/workload-comparison/) uses original source offers under `model_registry_cost_comparison`, independently of this protected interface. It reuses exact arithmetic but has no configured/manual source input, private alias or price-book disclosure. Public all-known-zero text sets remain uncorroborated/unknown, and published bounds/partial coverage control ranking. This page's private configured/manual normalization and authority are unchanged.
