Skip to main content

Overview

Formal estimates the cost of every LLM request from token prices you set. Each log carries the cost, and policies read it. Policies also see what each user has spent, so you can enforce budgets. All amounts are in USD.

Steps

1. Set Token Prices

Open Token Pricing in the Control Plane.
  • Set a provider default to price every model of that provider.
  • Click Add model price to price one model. A model price overrides the provider default.
  • Add aliases for names the model is requested under, such as opus-4.1 in Cursor.
Formal matches a model price when the requested model contains its name or an alias. The longest match wins. Formal has no built-in price list. Seen in logs without a model price lists models requested in the last 30 days that no model price matches. Click Set price to price one. Verify: send a request, then open its log. The LLM section shows cost_usd.

2. Add Advanced Prices

Expand Advanced pricing in the price dialog. Each empty field falls back to the base price.

3. Enforce Budgets

Request rules read spend in input.llm. See LLM resources for every field. Spend refreshes every few minutes, so a burst of requests can exceed a budget slightly. A field is absent when nothing was spent, so read it with object.get. The following policy blocks a user’s requests after $50 in a day or $500 in a month:
Verify: lower a budget below your own spend, send a request, and confirm the block appears in logs.

4. Block Unpriced Models

priced is false when no price matches the request. price_source is model, provider_default, or none. The following policy blocks models without a model price, so new models need a price before use:
Use not input.llm.priced instead to accept provider defaults.

Troubleshooting

Cause: no model price or provider default matches the request. Fix: price the model from Seen in logs without a model price.
Cause: the policy reads the spend field directly, and it is absent before any spend. Fix: read it with object.get(input.llm, "user_spend_usd_daily", 0).

Next Steps

AI Usage

See which models and clients people use

Policy Evaluation

Every field LLM policies can read