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

# Cost cap

> A stateless per-request guard that rejects or downgrades any model whose list price per 1k tokens exceeds a configured ceiling.

The **`cost_cap`** policy ("LLM Cost Cap") is a **stateless, per-request** price guard. Unlike
the [LLM Budget](/trustgate/policies/rate-limiting) — which tracks *cumulative* spend over a
window — cost cap looks only at the **list price** of the requested model and rejects or
downgrades it before the call is made. It runs at `pre_request`.

Use it to stop expensive models from being used at all on a given consumer or gateway,
independent of volume.

## Settings

| Setting                         | Type   | Default  | Notes                                                                      |
| ------------------------------- | ------ | -------- | -------------------------------------------------------------------------- |
| `max_input_cost_per_1k_tokens`  | number | —        | Global input-price ceiling (USD per 1k tokens).                            |
| `max_output_cost_per_1k_tokens` | number | —        | Global output-price ceiling (USD per 1k tokens).                           |
| `per_model_overrides`           | map    | —        | Per-model ceilings keyed by model slug / wildcard (most specific wins).    |
| `behavior_on_violation`         | enum   | `reject` | `reject` or `downgrade`.                                                   |
| `downgrade_to`                  | string | —        | Target model for `downgrade` (must be on the same provider).               |
| `unknown_model`                 | enum   | `reject` | Price not resolvable: `reject`, `pass_through`, or `assume_max`.           |
| `custom_pricing`                | map    | —        | Per-token USD rates by model pattern, consulted before the built-in table. |

Each `per_model_overrides` entry and `custom_pricing` value carries `{ input, output }` price
fields.

```json theme={null}
{
  "slug": "cost_cap",
  "settings": {
    "max_input_cost_per_1k_tokens": 0.005,
    "max_output_cost_per_1k_tokens": 0.015,
    "behavior_on_violation": "downgrade",
    "downgrade_to": "gpt-4o-mini",
    "unknown_model": "reject"
  }
}
```

## Cost cap vs LLM Budget

|         | `cost_cap`                                 | `token_rate_limiter` (LLM Budget)          |
| ------- | ------------------------------------------ | ------------------------------------------ |
| State   | Stateless (per request)                    | Stateful (Redis counters)                  |
| Guards  | Model **list price**                       | Cumulative **tokens or USD** over a window |
| Use for | "Never let anyone use a model over \$X/1k" | "Cap this tenant to \$50/day"              |

Pair them: a cost cap blocks premium models outright, while an LLM Budget bounds total spend
on the models that remain allowed.
