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 each user’s spend and token count, so you can enforce budgets. Each model price has its own currency. Formal never converts between currencies, so spend in each currency is totalled separately.Steps
1. Set Token Prices
Open Token Pricing in the Control Plane. The author made the model; the provider serves it. For example, Anthropic authors Claude, while Anthropic and Cursor can both provide access to it.- Click Add model price and pick the model. Known models fill in their Author.
- Leave the provider as All providers to set the author’s default price, used on every provider.
- To price a provider differently, such as Anthropic models through Cursor, add a price for that provider. It replaces the author’s default for that provider.
- Pick the Currency the prices are in. It defaults to USD, and known models fill in their USD list prices.
- Add aliases for names the model is requested under, such as
opus-4.1in Cursor.
cost and currency.
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 ininput.user.spend. See Spend object for details.
Each window has
cost, a map from currency code to amount, and token_count. For example, input.user.spend.today.cost.USD is today’s spend in USD. A currency is absent until the user spends in it, so read it with object.get. token_count also counts unpriced models.
Spend refreshes every few minutes, so a burst of requests can exceed a budget slightly.
The following policy blocks a user’s requests after $50 in a day or $500 in a month of USD-priced models:
token_count, for example input.user.spend.this_week.token_count >= 5000000.
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 provider for a provider’s price, author for an author’s default, or none.
The following policy blocks models without a model price, so new models need a price before use:
Troubleshooting
Cost is missing from logs
Cost is missing from logs
Cause: neither a price for the request’s provider nor a default for the model’s author matches the request. Fix: price the model from Seen in logs without a model price.
A budget policy never triggers
A budget policy never triggers
Cause: the policy reads spend in the
response rule, or the request has no Formal user. Fix: read input.user.spend in the request rule.Next Steps
AI Usage
See which models and clients people use
Policy Evaluation
Every field LLM policies can read