> For the list of every page, fetch /llms.txt. The API contract is the OpenAPI file linked from the API reference.

# Budget threshold crossed

POST 

Meadow sends this `POST` when spend in a budget's current window first reaches
one of its `alert_thresholds`. A project's budget event goes to that project's
`webhook_url`. An account's budget event goes to the `webhook_url` of every
project that has one, signed with that project's webhook secret. It is sent
once per threshold per window, and retried like a sandbox event. Verify the
signature as for `sandboxEvent`.

Spend is read from the usage records about once a minute, so the event can
be up to a minute late, and it leaves out every record with no cost.
`unknown_cost_records` says how many such records the window has.


Reference: https://docs.usemeadow.ai/api-endpoints/budget-event

## Request

### Payload

- `id` (string, required) — The event id. The same on every retry of one event.
- `type` (enum, required) — Always `budget.threshold_crossed`.
  - Allowed values: `budget.threshold_crossed`
- `created_at` (datetime, required) — When Meadow saw the threshold crossed.
- `threshold` (integer, required) — The percentage of `limit_usd` that was reached.
- `budget` (Budget, required)

## Types

### Budget

- `limit_usd` (double, required) — The amount to watch in one window, in US dollars. The name is the one on OpenRouter budgets. A plain JSON number above 0 and below 10^12 with at most 12 decimal places, read as written.
- `reset_interval` (enum, required) — The window. `daily` starts at midnight UTC, `weekly` on Monday at midnight UTC, `monthly` on the first of the month at midnight UTC: the clock of `limit_reset` on keys.
  - Allowed values: `daily`, `weekly`, `monthly`
- `id` (string, required) — The budget id (`bud_...`).
- `object` (enum, required) — Always `budget`.
  - Allowed values: `budget`
- `scope` (enum, required) — Whether the budget covers the whole account or one project.
  - Allowed values: `account`, `project`
- `spend_usd` (double, required) — What was spent in the current window, from the usage records: model calls and sandboxes with a known cost. The name is OpenRouter's.
- `remaining_usd` (double, required) — `limit_usd` minus `spend_usd`. It can be negative: an alert-only budget does not stop spend, and one call may end above a hard limit.
- `resets_at` (datetime, required) — When the current window ends.
- `unknown_cost_records` (integer, required) — Records in the window with no cost: calls on a provider Meadow has no price for, calls with estimated tokens, sandboxes with no price. When this is above 0, `spend_usd` is lower than what you were billed.
- `created_at` (datetime, required) — When the budget was first set.
- `updated_at` (datetime, required) — When it was last replaced.
- `hard_limit` (boolean, optional, default: false) — False, the default: the budget only alerts and never refuses a call. True makes `limit_usd` a ceiling for the window. Once the dollars counted for the budget reach it, model calls and sandbox creates in its scope are refused with 402 `budget_exceeded`, and a call whose reserved estimate does not fit what is left is refused the same way. A key in the scope of a hard budget is held to the rules of a key with a dollar `limit`: a model call must send an output cap, and a route that includes a provider with no price is refused with 403 `key_spend_price_unknown`. When it is switched on, the count starts at the window's `spend_usd` so far. Sandboxes that are running keep running. Left out of a `PUT`, it is false: a `PUT` replaces the whole budget.
- `alert_thresholds` (list of integer, optional, default: [50,75,100]) — Percentages of `limit_usd` that send an alert when spend first reaches them. Whole numbers from 1 to 100, no repeats. Left out, `[50, 75, 100]`. An empty list sends no alerts.
- `notification_channel` (BudgetNotificationChannel, optional, nullable) — Where alert emails go, shaped as on OpenAI spend alerts. Null or left out sends no email. Webhook events are sent either way.
- `project_id` (string, optional, nullable) — The project
- `enforced_spend_usd` (double, optional, nullable) — The dollars counted against a budget with `hard_limit` in the current window: the number the 402 is decided on. Null when `hard_limit` is false. It can be above `spend_usd`: a call whose cost could not be measured is counted at the estimate that was held for it, and the usage records arrive a little later than the count.

### BudgetNotificationChannel

Where alert emails go, shaped as on OpenAI spend alerts. Null or left out sends no email. Webhook events are sent either way.

- `type` (enum, required) — Always `email`.
  - Allowed values: `email`
- `recipients` (list of string, required) — Addresses that get the alert. At most 20.