> This page is for NeMo Relay, version v1.0.0.
> For other versions, use one of these documentation indexes:
> - Latest (v0.11.2) (default): https://docs.nvidia.com/nemo/relay/latest/llms.txt
> - dev: https://docs.nvidia.com/nemo/relay/dev/llms.txt
> - v1.0.0: https://docs.nvidia.com/nemo/relay/v1.0.0/llms.txt
> - v0.11.2: https://docs.nvidia.com/nemo/relay/v0.11.2/llms.txt
> - v0.10.4: https://docs.nvidia.com/nemo/relay/v0.10.4/llms.txt
> - v0.9.4: https://docs.nvidia.com/nemo/relay/v0.9.4/llms.txt
> - v0.8.4: https://docs.nvidia.com/nemo/relay/v0.8.4/llms.txt

> For clean Markdown of any page, append .md to the page URL. For a task-oriented documentation index, fetch https://docs.nvidia.com/nemo/relay/llms.txt. Use the documentation version matching the installed NeMo Relay package: latest follows the latest stable release, vX.Y.Z identifies a retained release snapshot, and dev documents development changes. Preserve the selected version when following links; do not mix examples or API contracts from different versions. Fetch the relevant section's /llms.txt before individual pages instead of loading a complete version index.

# Model Pricing

> Configure file and inline pricing catalogs for LLM cost estimates.

Use the built-in `pricing` component to configure model pricing catalogs for
cost estimates on managed or manually observed LLM responses. Manual lifecycle
end events must supply a response codec or normalized response annotation with
model and token usage. Relay leaves cost absent when no configured source
matches the provider, model, and token usage.

The configured sources apply to transparent agent runs, standalone gateway
runs, and evals or custom agents that initialize the same gateway plugin
configuration. Framework integrations, harnesses, and custom hosts can use the
same pricing sources when they emit managed LLM calls or manual lifecycle
events with normalized response annotations.

## Configuration

Add the `pricing` component to `plugins.toml`. The following configuration
loads a JSON catalog and defines an inline catalog. Relay searches sources in
the listed order, so place overrides before their fallbacks:

```toml
version = 1

[[components]]
kind = "pricing"
enabled = true

[[components.config.sources]]
type = "file"
path = "./pricing.json"

[[components.config.sources]]
type = "inline"

[components.config.sources.catalog]
version = 1

[[components.config.sources.catalog.entries]]
provider = "openai"
model_id = "gpt-4o-mini"
aliases = ["openai/openai/gpt-4o-mini"]
currency = "USD"
unit = "per_token"
pricing_as_of = "2026-06-06"
pricing_source = "internal-pricing-snapshot"

[components.config.sources.catalog.entries.rates]
input_per_million = 0.15
output_per_million = 0.60
cache_read_per_million = 0.075

[components.config.sources.catalog.entries.prompt_cache]
read_accounting = "included_in_prompt_tokens"
```

Use `type = "file"` with a JSON catalog path or `type = "inline"` with the
catalog in `plugins.toml`. Relay checks sources and catalog entries in listed
order, and it uses the first entry that matches the provider and model.

Relay publishes a numeric total only when every nonzero usage category has a
configured rate. If a response reports nonzero cache-read or cache-write usage
and the matching catalog entry omits the rate for it, Relay keeps the priced
components but omits the aggregate total. Set a rate to `0.0` when a category is intentionally free.

`cache_write_rates` prices cache writes by duration in seconds. A write uses the
entry for its duration, or else the entry with no duration. Anthropic reports 300
and 3,600 when it splits its cache writes:

```toml
[components.config.sources.catalog.entries.rates]
input_per_million = 3.0
output_per_million = 15.0
cache_write_rates = [
  { duration = 300, per_million = 3.75 },
  { duration = 3600, per_million = 6.0 },
  { per_million = 3.75 },
]
```

If usage reports nonzero writes with no matching entry and no default entry, Relay
omits the whole cache-write cost and the aggregate total.

Some usage reports `uncached_input_tokens`, a count of input tokens without
cache reads or cache writes. Relay picks the input count to bill as follows:

* When usage has `uncached_input_tokens`, Relay bills that count at the input
  rate and ignores `read_accounting`. If usage also has `prompt_tokens`, that
  count must equal `uncached_input_tokens` or `uncached_input_tokens` plus the
  cache reads and writes. Otherwise, Relay leaves the usage unpriced.
* For other usage, `read_accounting` tells Relay whether `prompt_tokens`
  includes cache reads. When `prompt_tokens` includes them, Relay subtracts them
  before billing. If cache reads are larger than `prompt_tokens`, Relay leaves
  the usage unpriced.

Relay bills cache reads and writes at their own rates. To pick a threshold
tier, Relay counts all input tokens, including cache reads and writes.

When Relay merges explicit-or-user and system configuration files, it prepends
higher-priority `sources` instead of replacing lower-priority sources. The
effective order is system, then explicit-or-user. This lets an
enterprise catalog override narrower catalogs while preserving those catalogs
as fallbacks.

## Create a Catalog

Create a Relay model pricing catalog JSON file:

```json
{
  "version": 1,
  "entries": [
    {
      "provider": "openai",
      "model_id": "gpt-4o-mini",
      "aliases": ["openai/openai/gpt-4o-mini"],
      "currency": "USD",
      "unit": "per_token",
      "rates": {
        "input_per_million": 0.15,
        "output_per_million": 0.6,
        "cache_read_per_million": 0.075
      },
      "prompt_cache": {
        "read_accounting": "included_in_prompt_tokens"
      },
      "pricing_as_of": "2026-06-06",
      "pricing_source": "internal-pricing-snapshot"
    }
  ]
}
```

## Manage Catalog Sources with the CLI

Run the following commands to validate a catalog and add it to user
configuration:

```bash
nemo-relay model-pricing validate <path/to/pricing.json>
nemo-relay model-pricing init --user
nemo-relay model-pricing add-source <path/to/pricing.json> --user
```

Replace `<path/to/pricing.json>` with the path to your pricing catalog before
running either command. Use `--user` for the user configuration file or
`--global` for system configuration at `/etc/nemo-relay/plugins.toml` on Unix or
`%ProgramData%\nemo-relay\plugins.toml` on Windows. `add-source` places a new
source ahead of existing sources by default. Use `--append` to keep it as a
fallback.

## Verify the Active Configuration

Run the following command to resolve a model against the configured catalogs:

```bash
nemo-relay model-pricing resolve gpt-4o-mini \
  --provider openai \
  --prompt-tokens 1000 \
  --completion-tokens 500
```

`model-pricing resolve` prints the source that won, the matched provider/model,
and an estimated total when token counts are supplied. Use it to debug
overlapping system, explicit, and user sources.

Use `nemo-relay doctor` to validate configured model pricing sources with the
rest of the gateway configuration. For check interpretation, refer to
[Troubleshoot the CLI](/nemo/relay/v1.0.0/nemo-relay-cli/troubleshooting#check-configuration-and-exporters).

Relay does not ship a canonical price catalog. Unknown models and missing token
fields leave cost absent instead of defaulting to zero. For the catalog schema,
provider-aware lookup behavior, threshold-based model pricing, and custom
`PricingSource` integrations, refer to
[Model Pricing API Reference](/nemo/relay/v1.0.0/reference/api/model-pricing#cost-estimation).