> ## Documentation Index
> Fetch the complete documentation index at: https://docs.barndoor.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Managing Model Pricing

> Control the per-million-token prices the Barndoor LLM Gateway uses to cost requests, so spending budgets and cost reporting are accurate.

## Overview

**Model Pricing** sets how much each model costs per million tokens. Those prices drive every cost figure on the platform:

* **spending budgets** in [LLM Controls](/how-tos/use-llm-controls#budgets)
* the **cost recorded for each request**
* cost in **Reporting → LLM Usage Dashboard** — see [Reading the LLM Usage Dashboard](/how-tos/read-llm-usage-dashboard)

Model Pricing lives in the Barndoor portal under **LLM Management → Model Pricing**.

<Frame>
  <img src="https://mintcdn.com/barndoor/la1TQbfBQ5KqGqlz/images/model-pricing/01-pricing-tab.png?fit=max&auto=format&n=la1TQbfBQ5KqGqlz&q=85&s=c806abd559e0df2384c69baf2658b2b5" alt="Model Pricing section showing the Org rules, Archive, and Barndoor defaults tabs" width="2896" height="1197" data-path="images/model-pricing/01-pricing-tab.png" />
</Frame>

<Note>
  Barndoor maintains a curated catalog of default prices for common models across OpenAI, Anthropic, AWS Bedrock, Google Vertex AI, Azure OpenAI, and more, and applies it automatically. **Those models are costed out of the box, with no setup.** You only need your own rules to override a Barndoor price (a negotiated discount, a different vendor rate) or to price a model the catalog doesn't cover (a fine-tune, a private deployment, a brand-new model).
</Note>

<Warning>
  A request for a model that no rule covers — neither yours nor a Barndoor default — still succeeds, but is recorded at **\$0**. Spending budgets don't move and reports show zero cost. These models are shown as **Unpriced** wherever the portal lists pricing.
</Warning>

## Before You Begin

* A Barndoor account with **admin** privileges.
* An LLM Gateway with at least one provider and one model configured — see [Using the LLM Gateway](/how-tos/use-llm-gateway).

## The Three Tabs

| Tab | What it lists |
| - | - |
| **Org rules** | Your organization's own pricing rules — imported defaults and custom rules — with scope, catalog, provider, input and output prices, cache prices, and **Last Updated**. |
| **Archive** | Rules you've archived. Their full history is kept, and they can be restored. |
| **Barndoor defaults** | Every price in Barndoor's catalog, each marked **Imported** or **Not imported**. |

Search matches the model pattern. You can also paste a pricing rule ID (for example from a request log) to find the rule, or an older version of it, on whichever tab it lives. Filter by **scope** and **catalog**, and sort by the column headers.

## How Cost Is Computed

Cost is calculated after a successful upstream response, from the token counts the provider reports. Failed requests record no cost. All prices are USD per million tokens.

```text theme={null}
cost = input tokens        × input price
     + output tokens       × output price
     + cache-read tokens   × cache read price
     + cache-write tokens  × cache write price
```

* **Input tokens** exclude tokens served from the prompt cache, which are billed separately at the **cache read** price.
* **Output tokens** include any reasoning tokens the provider reports; reasoning isn't billed separately.
* A rule with no **cache read** or **cache write** price bills those tokens at the rule's **input** price.
* If the rule has a **long-context surcharge** and the request's total prompt (input plus cache reads and writes) is at or above its threshold, the *whole* request — output included — is billed at the surcharge rates.
* Rules match the **underlying model name** the provider is called with (for example `anthropic.claude-opus-5-5` on a Bedrock provider), not the route name the caller sent.

<Note>
  A provider whose **Calculate token cost** setting is turned off (a flat-rate subscription, self-hosted inference, or usage billed elsewhere) records **\$0** for every request, even where a pricing rule matches. Those requests are labelled **Not metered**, not **Unpriced**: the rate is known to be zero rather than unknown. Change this in the provider's settings.
</Note>

## How Pricing Resolves

For each request, Barndoor looks for a matching rule in this order. The first tier with a match wins.

<div className="bd-diagram bd-fc" role="group" aria-label="Pricing resolution order: an unmetered provider costs $0; otherwise each tier is checked in turn and the first match sets the price; no match costs $0 as Unpriced.">
  <div className="bd-fc-term">Request to cost</div>

  <div className="bd-fc-arrow" />

  <div className="bd-fc-node"><span className="bd-num">?</span><div className="bd-flow-body"><strong>Provider calculates token cost?</strong><span>Set in the provider's settings</span></div></div>
  <div className="bd-fc-out"><span className="bd-pill bd-pill-muted">No: \$0 · Not metered</span></div>
  <div className="bd-fc-arrow bd-fc-arrow-label"><span>Yes: most specific tier first</span></div>
  <div className="bd-fc-node"><span className="bd-num">1</span><div className="bd-flow-body"><strong>Provider Instance rule</strong><span>This provider connection</span></div></div>
  <div className="bd-fc-out"><span className="bd-pill bd-pill-ok">Match: use rate</span></div>

  <div className="bd-fc-arrow" />

  <div className="bd-fc-node"><span className="bd-num">2</span><div className="bd-flow-body"><strong>Catalog rule</strong><span>This vendor line, such as OpenAI or AWS Bedrock</span></div></div>
  <div className="bd-fc-out"><span className="bd-pill bd-pill-ok">Match: use rate</span></div>

  <div className="bd-fc-arrow" />

  <div className="bd-fc-node"><span className="bd-num">3</span><div className="bd-flow-body"><strong>Generic rule</strong><span>Any provider</span></div></div>
  <div className="bd-fc-out"><span className="bd-pill bd-pill-ok">Match: use rate</span></div>

  <div className="bd-fc-arrow" />

  <div className="bd-fc-node"><span className="bd-num">4</span><div className="bd-flow-body"><strong>Barndoor default</strong><span>Barndoor's catalog price</span></div></div>
  <div className="bd-fc-out"><span className="bd-pill bd-pill-ok">Match: use rate</span></div>

  <div className="bd-fc-arrow" />

  <div className="bd-fc-node bd-fc-end-deny"><span className="bd-pill bd-pill-deny">No match</span><div className="bd-flow-body"><strong>\$0, labelled Unpriced</strong><span>Add a pricing rule to cost this model</span></div></div>
</div>

| Tier | Scope badge | Use when |
| - | - | - |
| **1. Provider instance** | **Provider Instance** | You have a custom rate on one specific provider connection (for example one Azure deployment). |
| **2. Catalog** | **Catalog** | The price applies to a whole vendor line — every OpenAI provider, every Bedrock provider — but not across vendors. |
| **3. Generic** | **Generic** | The price applies wherever the model name matches, regardless of provider. The simplest and most common choice. |
| **4. Barndoor default** | — | Barndoor's catalog. Applies automatically when none of your rules match. |

**Within a tier, the most specific pattern wins**: an exact name beats a wildcard, and a longer wildcard beats a shorter one — so `claude-sonnet-5-5*` beats `claude-*`, and a catch-all `*` loses to everything. A higher tier always wins, however specific a lower-tier pattern is.

In the portal, each model shows the price it resolves to and where it came from: **Org rule (this provider)**, **Org rule (provider type)**, **Org rule**, **Barndoor default**, **Not metered**, or **Unpriced**.

<Tip>
  Stick to **Generic** rules for everyday pricing. Use **Catalog** or **Provider Instance** rules only when the same model genuinely has a different price on different vendors or connections.
</Tip>

## Importing Barndoor Defaults

Importing copies a Barndoor default into your org rules so you can edit it, pin it, or keep it in sync. You don't need to import a default for it to apply.

<Steps>
  <Step title="Open LLM Management → Model Pricing → Barndoor defaults">
    Or click **Add Pricing Rule → A Barndoor default**.
  </Step>

  <Step title="Import one row">
    Click **Import** on a row and choose how it should track Barndoor: **Tracking**, **Pinned**, or **Auto-sync** (see [Keeping Prices in Sync](#keeping-prices-in-sync-with-barndoors-catalog)).
  </Step>

  <Step title="Or import several">
    Click **Select to import**, tick rows (filter by catalog and use the header checkbox to select a whole vendor), pick a **Sync behavior**, and click **Import N**.
  </Step>
</Steps>

An imported row shows **View rule**, which jumps to your org rule.

## Creating a Pricing Rule

<Steps>
  <Step title="Click Add Pricing Rule → A custom rule">
    The **Add Pricing Rule** dialog opens.
  </Step>

  <Step title="Model Pattern">
    Pick a model you've enabled from the dropdown, or type a pattern. Use `*` as a wildcard at the start, the end, or both:

    * `gpt-5.4-mini` — exactly that model.
    * `gpt-5.4*` — any model starting with `gpt-5.4`.
    * `*-mini` — any model ending in `-mini`.
    * `*claude-sonnet-5-5*` — any model containing `claude-sonnet-5-5` (useful for Bedrock IDs with regional prefixes).

    A `*` in the middle of a pattern (`gpt-*-mini`) and regular expressions aren't supported.
  </Step>

  <Step title="Catalog and Provider (optional)">
    * **Catalog** — restrict the rule to one vendor line. Leave on **Any catalog** for a Generic rule.
    * **Provider** — restrict it to one configured provider connection. Available once a catalog is picked; leave on **Any provider in catalog** for a Catalog rule.
  </Step>

  <Step title="Prices">
    * **Input Cost ($/1M tokens)** and **Output Cost ($/1M tokens)** — required.
    * **Prompt caching** — **Cache Read** and **Cache Write** prices (\$/1M tokens). Leave cache read blank and cached tokens are billed at the full input price, which overstates cost against the provider's cache discount. Cache write applies to Anthropic models.
    * **Long-context surcharge** (optional) — tick it for models whose price rises once a prompt is large. Set **Applies at or above (prompt tokens)** (pre-filled with `200000`) and the input and output prices above the threshold; blank cache prices above the threshold bill at the surcharge input price.
  </Step>

  <Step title="When this takes effect">
    Choose **Take effect immediately** or **Schedule for later** and pick a date and time (in your local time zone, accurate to about ±5 minutes).
  </Step>

  <Step title="Sync behavior and reason">
    * **Sync behavior** — only **I'll manage it** is available unless the pattern and catalog match a Barndoor default.
    * **Change reason (optional)** — recorded in the rule's [Pricing History](#pricing-history).
  </Step>

  <Step title="Save">
    An immediate rule applies to requests within a few minutes. A scheduled rule shows a **Scheduled** badge until it activates.
  </Step>
</Steps>

<Frame>
  <img width="500px" src="https://mintcdn.com/barndoor/la1TQbfBQ5KqGqlz/images/model-pricing/03-create-pricing.png?fit=max&auto=format&n=la1TQbfBQ5KqGqlz&q=85&s=1e77ace0746ee941a3638cde78f0ba6e" alt="Add Pricing Rule dialog with model pattern, catalog, provider, prices, scheduling, and sync behavior" data-path="images/model-pricing/03-create-pricing.png" />
</Frame>

<Tip>
  If enabling a model is blocked because it has no price, the portal can bring you here with the model pre-filled. Save with **… & return to** to go straight back to where you were.
</Tip>

## Editing and Scheduling Price Changes

Click the pencil icon on a row to open **Edit Pricing**. Every save creates a **new version** of the rule; an existing price is never overwritten in place. That means:

* **Past and current versions are an audit trail** and can't be changed or removed.
* **Scheduled future versions can be edited or cancelled** from the rule's [Pricing History](#pricing-history).
* **Changes are forward-looking.** They apply only to requests after the new version becomes active; they don't re-cost past requests or adjust spending already counted against a budget.

In **Edit Pricing** you can change the prices, cache prices, long-context surcharge, timing, sync behavior, and change reason. The **model pattern, catalog, and provider can't be changed** — create a new rule for a different scope, and archive the old one if you no longer need it.

Rows with pending future versions show **Scheduled** (or **N scheduled**). To change or cancel one before it activates, open the row's history and use the pencil (**Edit Scheduled Change**) or trash icon next to the scheduled entry.

### Reset to default

When your price for a pattern differs from Barndoor's, the row's badge shows **Custom** and a **Reset to default** action appears on the row and in **Edit Pricing**. It creates a new version with the current default input and output prices, recorded with the reason `Reset to default`.

<Tip>
  **Reset to default uses the *current* default**, not the one you originally imported. If Barndoor has changed its price since, Reset moves you to the new value.
</Tip>

## Archiving and Restoring Rules

To stop using a rule, click the archive icon on its row (or **Select rules**, tick several, and click **Archive N**). Archiving:

* removes the rule from **Org rules**, so cost falls back to the next matching tier — typically the Barndoor default, or \$0 if nothing else matches;
* cancels any scheduled changes on the rule;
* keeps the rule's full history, visible on the **Archive** tab.

To bring a rule back, open **Archive** and click restore (or select several and click **Restore N**). The rule returns to **Org rules** at its last live price, and costing resumes within a few minutes. Edit it afterwards if the provider's rate has moved on.

## Pricing History

The clock icon on a row opens **Pricing History** — every version of that rule, newest first. Each entry shows:

* the input, output, and cache prices at that version, with the change from the previous version;
* when it took effect (or will take effect);
* who made the change;
* how it was made: **Created**, **Edited**, **Scheduled**, **Imported**, **Synced (manual)**, **Auto-sync**, **Archived**, or **Restored**;
* the **Change reason**, if one was given.

Future-dated entries carry edit and cancel icons. Past entries are part of the audit trail and can't be removed — they're what Barndoor uses to know what a past request cost at the time.

## Keeping Prices in Sync with Barndoor's Catalog

Barndoor updates its defaults as provider prices change. Each imported rule has a **Sync behavior** that decides what happens when a default it was imported from changes. Pick it when importing, and change it later in **Edit Pricing**.

| Sync behavior | Import option | What it does |
| - | - | - |
| **Prompt me on updates** | **Tracking** | Keeps your imported price. When the default changes, the row shows **Update available** and a **Review updates** banner appears. |
| **I'll manage it** | **Pinned** | A fixed price you maintain. Barndoor never changes it and never prompts you. The row shows **Custom** with a lock icon. |
| **Auto-sync to Barndoor** | **Auto-sync** | Barndoor applies default changes automatically, within about a minute. Each change is recorded in the rule's history. The row shows **Auto-sync**. |

### Reviewing updates

When tracked rules are behind Barndoor's defaults, a banner reads *N imported prices have a new Barndoor default*. Click **Review updates** to open **Review pricing updates**, which lists each affected rule with its current and new prices. Tick the rules to adopt and click **Sync N Prices**; unticked rules keep their current price and stay flagged. To stop being prompted about a rule, set its sync behavior to **I'll manage it** in **Edit Pricing**.

<Tip>
  **Auto-sync** keeps you on Barndoor's prices with no interaction, at the cost of prices changing underneath you. **Prompt me on updates** surfaces each change for review first — a good fit when prices feed spending budgets you don't want to shift quietly.
</Tip>

## Badges on Org Rules

| Badge | Meaning |
| - | - |
| **Default** | Tracking a Barndoor default, and your price matches it. |
| **Custom** | Your price differs from the Barndoor default. With a lock icon: the rule is set to **I'll manage it**. |
| **Manual** | Barndoor has no default for this pattern; you created it from scratch. |
| **Update available** | A tracked rule whose Barndoor default has changed. Use **Review updates**. |
| **Auto-sync** | The rule follows Barndoor's default automatically. |
| **Scheduled** / **N scheduled** | The rule has future-dated versions waiting to activate. |
| **Provider Instance** / **Catalog** / **Generic** | The rule's [resolution tier](#how-pricing-resolves). |

## Require Pricing for Model Routes

The **Require pricing for Model Routes** toggle at the top of Model Pricing stops models that would be recorded at \$0 without anyone deciding so.

<Frame>
  <img src="https://mintcdn.com/barndoor/la1TQbfBQ5KqGqlz/images/model-pricing/04-require-pricing-toggle.png?fit=max&auto=format&n=la1TQbfBQ5KqGqlz&q=85&s=e3c6c9e1d6108f954e606310a6d84e41" alt="'Require pricing for Model Routes' toggle at the top of the Model Pricing section" width="2846" height="188" data-path="images/model-pricing/04-require-pricing-toggle.png" />
</Frame>

When **on**:

* A model can't be enabled, and a route can't be added or re-enabled, unless the model is covered by **an org rule or a Barndoor default**. The save is refused with a message saying the model has no pricing.
* Models on a provider whose **Calculate token cost** setting is off pass automatically — they're \$0 by design.
* Already-enabled models with no coverage keep serving traffic at \$0 and are flagged **Unpriced** in the model list, with a **Disable N unpriced** action to switch them off in bulk.

When **off** (default), any model can be enabled; uncovered models are recorded at \$0.

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="A spending budget or report shows $0 for a model" icon="dollar-sign">
    Check the model's pricing label in the portal:

    * **Unpriced** — no rule matches. The model may be missing from Barndoor's catalog (a fine-tune, a private model, a very new model), or your pattern doesn't cover the underlying model name — remember rules match the name the provider is called with, not the route name. Add a rule.
    * **Not metered** — the provider's **Calculate token cost** setting is off. This is intentional; change the provider setting if it shouldn't be.
    * A price is shown but it's `$0.00` — one of your rules sets zero prices and outranks the default. Edit or archive it.
  </Accordion>

  <Accordion title="I changed a price but past costs didn't move" icon="rotate-left">
    Price changes are forward-looking. They affect requests after the new version is active; they don't re-cost past requests or change what's already counted against a budget. To correct a budget after a price fix, contact [support@barndoor.ai](mailto:support@barndoor.ai).
  </Accordion>

  <Accordion title="A new price isn't being used yet" icon="clock">
    The gateway picks up pricing changes within a few minutes. If you used **Schedule for later**, the price won't apply until the scheduled time — open the rule's history to confirm the **Scheduled** entry.
  </Accordion>

  <Accordion title="I scheduled a price change but want to cancel it" icon="calendar-xmark">
    Open the rule's **Pricing History** (clock icon) and click the trash icon next to the scheduled entry. Only future versions can be cancelled.
  </Accordion>

  <Accordion title="Two rules match the same model — which one wins?" icon="circle-question">
    The higher [tier](#how-pricing-resolves) wins (Provider Instance, then Catalog, then Generic, then Barndoor default). Within a tier, the most specific pattern wins. Avoid two different patterns that are equally specific and both match the same model — there's no principled winner between them.
  </Accordion>

  <Accordion title="Cached requests look more expensive than the provider's invoice" icon="receipt">
    The rule probably has no **Cache Read** price, so cached tokens are billed at the full input price. Set the cache read price in **Edit Pricing**.
  </Accordion>
</AccordionGroup>

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Do imported defaults follow provider price changes?">
    That's your choice per rule: **Prompt me on updates** flags changes for review, **I'll manage it** never changes, and **Auto-sync to Barndoor** follows the default automatically. See [Keeping Prices in Sync](#keeping-prices-in-sync-with-barndoors-catalog).
  </Accordion>

  <Accordion title="What currency is supported?">
    **USD** only. All prices are entered, recorded, and reported in US dollars.
  </Accordion>

  <Accordion title="Can I price the same model differently on different deployments?">
    Yes — use a **Provider Instance** rule for each provider connection that needs its own price. Rules match the underlying model name, so two route names that reach the same model on the same provider share one price.
  </Accordion>

  <Accordion title="What if my provider lists prices per 1,000 tokens?">
    Multiply by 1,000. If your provider quotes `$0.0025 per 1K input tokens`, enter `2.50` as the input cost per million.
  </Accordion>

  <Accordion title="Do I need a rule for embedding models?">
    Only if Barndoor's catalog doesn't cover the model. For a custom or self-hosted embedding model, add a rule with the input price and leave output at `0` — embeddings consume input tokens only.
  </Accordion>

  <Accordion title="Can I delete a pricing rule?">
    Archive it instead. Archiving takes it out of use and keeps its history; you can restore it from the **Archive** tab.
  </Accordion>
</AccordionGroup>

## Need Help?

Reach out to [support@barndoor.ai](mailto:support@barndoor.ai) with:

* The model name (and provider) you're trying to price.
* The pattern and prices you've configured (a screenshot of the row helps).
* What you're seeing — `$0` cost, a budget not moving, an **Unpriced** label, and so on.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.