# Automatic pricing

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

You don't need to enter the price of every model. The gateway reads the public catalogs (the community cost map, models.dev, OpenRouter, DeepInfra), cross-checks the sources and shows, for each target of each alias, what a million input and output tokens cost, along with the published context and parameters. That price feeds [valuation](/docs/features/usage-valuation/), the [cost strategy](/docs/features/routing-strategies/) and `/v1/model/info`.

## How to turn it on

```yaml
features:
  external_model_catalog: true
  automatic_price_catalog: true     # requires external_model_catalog
  price_source_cost_map: true       # optional
  price_source_modelsdev: true      # optional
```

You can turn sources on and off in the console under **Settings & sources**, without restarting. To approve every catalog price before it applies, turn on [catalog review](/docs/features/catalog-review/) (`catalog_review`). The result appears in **Model catalog** and in `GET /api/v1/admin/pricing`, for anyone who can read the global catalog.

## Discover metadata in the console

**Model catalog → Discover available models** reads OpenRouter, DeepInfra, the community cost map and models.dev under `external_model_catalog`. The same sources are available through `GET /api/v1/admin/catalog/models?source=...` (use `modelsdev` for models.dev). This is the privileged discovery inventory; it is separate from the models a client key may call and from public model publication. Source selectors for valuation do not turn an advisory catalog read into an approved billing rate.

Each API snapshot includes `source`, `source_url`, the original successful `fetched_at`, and explicit `stale`. On a failed refresh, an expired successful snapshot is returned with `stale:true` and Warning110; the timestamp is not advanced. Missing freshness on an older server is shown as unknown. The combined public view keeps every source's timestamp and freshness, including unavailable sources; partial success is visibly partial. Reload rereads the existing bounded cache and does not bypass its fifteen-minute TTL. No public catalog read sends a provider key.

The console shows only published context, parameters, input/output modalities and lifecycle facts. An expiration, deprecation, shutdown or replacement is advisory: a successor ID never retargets an alias, and missing metadata never guarantees availability. Search and filters apply before pagination. models.dev text rates are already USD per million tokens; other sources retain their own explicit units and raw price details. Community aggregation sources do not automatically prepare routable aliases.

## Where the price comes from

| Source | Role | How the model is found |
| --- | --- | --- |
| The provider's own catalog: OpenRouter (`/api/v1/models`) and DeepInfra (`/models/list`) | Wins when it publishes the rate | Literal ID |
| Community cost map (`model_prices_and_context_window.json`, maintained by the community) | Vote | The preset's provider and exact ID, or `provider/ID` |
| [models.dev](https://models.dev/api.json) | Vote | The preset's provider and exact ID; Vertex's `google/` prefix is normalized |
| Custom or self-hosted target | No source | Stays `unknown`, with the reason |

| Sources on | Result |
| --- | --- |
| None | Only the provider's own catalog and the [manual price book](/docs/features/pricing/) |
| One | That source's rate |
| Both | A vote between them |

**Voting:**
- two sources agreeing within 1% give `confidence: corroborated`;
- a single source gives `single_source`;
- diverging sources give `status: conflict` (`sources_disagree`), and the price does not enter valuation until you set a manual price. The divergence warning stays visible;
- an isolated zero price must be confirmed by another source.

The response includes `votes`, with each source's value.

BytePlus ModelArk is read from models.dev only, the one catalog that lists it under the preset's own base URL. Six presets have no catalog entry anywhere (`cometapi`, `kluster`, `maritaca`, `parasail`, `azure_mistral_ocr`, and `anthropic_openai`, whose answers omit the prompt-cache usage the catalog prices); use the manual price book for them.

## How the target is identified

The price is looked up by **provider connection + exact upstream model ID**. The connection is recognized by its [preset](/docs/features/providers/), and the preset only counts while the `base_url` points to the provider's official host. A provider without a preset is recognized by its exact official URL, or, for a cloud preset whose URL carries a region or resource (Bedrock, Azure, Vertex), by a URL that fills that template.

This prevents a wrong price by mistake:
- the name you gave the connection proves nothing;
- similar URLs, ports, query strings, credentials in the URL or the wrong scheme do not count as a known origin;
- the OpenRouter rate is never applied to OpenAI, DeepInfra, Groq or any other intermediary;
- OpenAI's `/models` API is not a price source.

## Refresh

- Each source is cached for 15 minutes. With [valuation](/docs/features/usage-valuation/) on, a background process keeps the sources of active targets warm.
- **Reload**, in the console, rereads the result and refreshes the source when the 15-minute window has expired.
- Sources are queried in parallel, with up to six seconds in total and five per source. Redirects are not followed.
- If the refresh fails, the last valid result keeps being served with `stale: true` and its original date. With no result at all, the target stays `unknown` with the reason.
- **Inference never fetches prices over the network.** It uses only what is already cached.
- Price fetching uses only public feeds and never sends the provider credential.

## Normalization

- Text rates become **USD per million tokens**, in exact decimal (no binary rounding). OpenRouter and the community map publish per token; DeepInfra publishes cents per token and is used only for `text-generation` models.
- Negative, missing or sentinel values become unknown, never zero.
- Published cache pricing, context tiers, conditions and limits go into `published_pricing` and `metadata`. Context and parameters appear only when the source reports them, and they do not change capabilities or routing.
- On OpenRouter, the query uses `output_modalities=all` to include models that do not generate only text.
- Limits per catalog: 16 MiB, 20 pages, 5,000 entries for provider catalogs (10,000 records in the community map and 20,000 in models.dev). An incomplete catalog is never published halfway.

## Service tiers

The cost map also publishes priority, flex and batch prices for many models (`input_cost_per_token_priority`, `output_cost_per_token_flex`, `cache_read_input_token_cost_batches` and so on). When the cost map priced the standard rate, its tier prices appear under `service_tiers` in `GET /api/v1/admin/pricing` and in the model catalog, each with its source and fetch time, and the tier the provider reports in an answer selects them. A tier no source publishes stays unknown. See [service-tier pricing](/docs/features/service-tier-pricing/).

## Media

Image, speech, transcription and video aliases get a per-unit price from the community cost map: per image, per character, per second of audio or per second of video (`unit` and `unit_price`). Valuation counts the unit in the request or response itself. Without a count, the cost stays unknown, never zero.

With the `image_token_pricing` flag (off by default; requires `price_source_cost_map`), a GPT Image model such as `gpt-image-1` is priced per token by category instead, from the cost map row that publishes `input_cost_per_token`, `input_cost_per_image_token` and `output_cost_per_image_token` (and `output_cost_per_token` when the model bills text output). The item then has `unit: per_million_image_tokens` and an `image_tokens` object, and no text rates, so cost routing and `/v1/model/info` never read it as a chat price:

```json
{"alias": "images", "provider_id": "openai", "model_id": "gpt-image-1", "status": "available",
 "unit": "per_million_image_tokens", "source": "cost_map", "confidence": "single_source",
 "image_tokens": {"text_input_per_million": "5", "image_input_per_million": "10", "image_output_per_million": "40"}}
```

Valuation reads the usage each answer reports; see [usage valuation](/docs/features/usage-valuation/#gpt-image-tokens). A row missing one of the three prices, or carrying a context-tiered price, is not read, and the model keeps `media_unit_unpublished`. The advisory cost calculator does not quote these aliases (`image_token_quote_unsupported`): their cost depends on four counts only the answer reports.

A media model no catalog prices in its unit, such as a Replicate image model, takes a [manual media price](/docs/features/pricing/#media-models-no-catalog-prices) in the same unit, shown with `source: manual` and `manual_fallback: true`.

## Manual pricing

For what no catalog publishes, such as a self-hosted open-source model, or a rate you negotiated, use the [manual price book](/docs/features/pricing/) (`manual_price_catalog`). **A manual entry in effect wins over the automatic price** for the model it names, including entries saved through [price book management](/docs/features/price-book-management/); a model without an entry keeps the automatic price. The response shows `source: manual` and `manual_fallback: true`, plus `override: true` when an automatic price was available and the entry replaced it; the catalogs' votes stay listed. Each valued request names the price it used: in its valuation (`rate.source`, `rate.manual_fallback`, `rate.override`) and, with the [span store](/docs/features/traces/), on its spans (`price.source`, `price.override`). To return a model to its automatic price, remove its entry.

The `metadata_source`, `metadata_source_url`, `metadata_fetched_at` and `metadata_stale` fields appear only when a feed actually provided the metadata.

## For clients: `/v1/model/info`

With the `model_info` flag, a key with `route:models` reads from `GET /v1/model/info` the mode, capabilities, context and per-token cost of each alias it can use. The format is the one Open WebUI and several SDKs already understand. Providers, URLs and upstream names do not appear.

## Limits

- The price is a reference: it does not prove what the provider will charge your account. Contract discounts come in through [discounts and margins](/docs/features/usage-valuation/#discounts-and-margins); the real invoice comes in through [billing imports](/docs/features/native-billing-imports/).
- The community cost map is identified as `source: cost_map` and is not a contracted rate.

## See also

- [Costs and pricing](/docs/features/feature-costs/): overview.
- [Valuation](/docs/features/usage-valuation/): the estimated cost of each call.
- [Manual price book](/docs/features/pricing/) and [price book management](/docs/features/price-book-management/).

## Quote a stated workload

The optional [cost calculator](/docs/features/cost-calculator/) uses the same identified public/target rates without changing valuation or budget admission. It computes exact declared base quantities and daily/30-day projections, with separate known subtotals when coverage is partial. It does not simulate routing, retries, fallback, classifier/helper calls or provider billing extras; one configured quote covers the selected exact target.
