---
title: "Hard budgets, rate limits and organization currencies"
description: "How Kaeso counts and stops spend in real time: worst-case reservations in Valkey for hard budgets, nested project and key limits, kaeso-limits headers, and organization display currencies at daily ECB rates."
url: https://kaeso.app/articles/budgets-limits-and-usage
markdown: https://kaeso.app/articles/budgets-limits-and-usage.md
language: en
alternates:
  de: https://kaeso.app/de/articles/budgets-limits-and-usage.md
  zh-CN: https://kaeso.app/zh-CN/articles/budgets-limits-and-usage.md
published: 2026-11-22
authors:
  - Kaeso Team
tags:
  - gateway
  - budgets
  - limits
  - currencies
  - billing
  - guide
image: https://kaeso.app/articles/budgets-limits-and-usage/cover.jpg
index: https://kaeso.app/llms.txt
---

# Hard budgets, rate limits and organization currencies

How Kaeso counts and stops spend in real time: worst-case reservations in Valkey for hard budgets, nested project and key limits, kaeso-limits headers, and organization display currencies at daily ECB rates.

> Every page, article and docs page of Kaeso is listed in https://kaeso.app/llms.txt.

- Published: 22 November 2026
- Reading time: 5 min
- Author: Kaeso Team

A spend budget that only checks historical database rows after requests finish is not a hard budget: twenty concurrent requests from a coding agent or batch script will sail past a `$50` cap before the first stream completes.

Kaeso enforces limits and budgets in **Valkey** on the request path, using exact decimal arithmetic and worst-case in-flight reservations, while storing permanent usage totals in PostgreSQL. And in Kaeso 0.7.0, each organization can view its spend, model prices and budgets in **its own currency** — converted at the European Central Bank's daily reference rates while every calculation underneath stays in exact US dollars.

![Project Analytics in the Kaeso console showing requests, tokens, cost and cache efficiency over 14 days with model and key breakdowns](https://kaeso.app/articles/kaeso-demo/analytics-light.png "Analytics and spend budgets show every amount in the organization's chosen currency while costing requests in exact US dollars.")

## Three nested levels, five kinds of limit

In any project, limits apply at three levels — **Project**, **Member or Service account**, and **API key** — and a request must pass every level that applies to it:

| Kind | What it counts | Period | Behaviour when reached |
| --- | --- | --- | --- |
| **Spend budget** | Cost at the model's prices (set in the organization's currency, checked in USD) | Calendar day (UTC), calendar month (UTC) or total | **Hard** (default): refuses with `429`. **Soft**: lets through and alerts |
| **Token budget** | Input + output tokens | Calendar day (UTC), calendar month (UTC) or total | **Hard** (default): refuses with `429`. **Soft**: lets through and alerts |
| **Request rate** | Requests | Sliding minute | Always refuses with `429` and `Retry-After` |
| **Token rate** | Input + output tokens | Sliding minute | Always refuses with `429` and `Retry-After` |
| **Tool call rate** | MCP tool calls through the project's [MCP portal](https://kaeso.app/articles/mcp-portal) | Sliding minute | Always refuses with `429` and `Retry-After` |

Each limit can cover **all models** in the project or **one specific model** (or [model line](https://kaeso.app/articles/kpmr-and-model-lifecycle#model-lines-follow-a-family-s-newest-stable-model-on-your-terms)). Limits nest strictly: a key's budget cannot exceed its owner's budget for the same period and model, and a member's or service account's budget cannot exceed the project's. With **Copy to…** in a limit's menu, you can apply the same limit template across other members, service accounts or keys in seconds.

## How hard budgets prevent concurrent overruns

When a request arrives under a hard spend budget or a token rate, Kaeso does not wait until the reply finishes to count it:

1. **Reserve the worst case before calling the provider.** Kaeso estimates the input tokens from the request size and adds the request's maximum output (`max_tokens` or `max_output_tokens`, or the model's catalogue output limit when omitted). For a spend budget, it prices the input at the highest applicable rate (base input, cache write, 1-hour cache write when requested, or long-context tier price when the prompt exceeds `context_above`) plus the maximum output at the model's output price, and holds at least the average request cost in that period.
2. **Hold while the stream runs.** If in-flight reservations could exhaust what remains of a hard budget or token rate, the next concurrent request receives `429` with `Retry-After: 1` until running requests finish and release their unused reservation. (Sending a smaller `max_tokens` from your app lets more requests run side by side under a tight budget.)
3. **Settle to the exact cost on completion.** As soon as the provider reports usage — or before the reply finishes streaming — Kaeso replaces the worst-case hold with the actual cost. If a step fails or an [alias route](https://kaeso.app/articles/retries-and-fallbacks) falls back to another model, the failed step releases its hold immediately so the fallback step can check its own limits.
4. **Fail closed if Valkey is down.** Because Valkey is configured with `noeviction` and holds the active counters, if Valkey is unreachable Kaeso lets requests under rate limits and soft budgets pass, but refuses requests governed by a **hard budget** with `503` (or `500` in OpenAI formats so SDKs retry) rather than risking an uncounted overrun.

### Features a spend budget refuses upfront (`403`)

Kaeso prices requests from token and media counts. Some provider-hosted features carry separate per-call fees or surcharges that token prices do not cover — such as provider-executed `web_search`, `file_search`, `code_execution` / `code_interpreter`, `priority` service tiers, or Anthropic's `context-1m-…` beta header, as well as models without a known price (unless an admin explicitly set the price to `0` by hand).

While **any** spend budget (hard or soft) applies to the key, its owner or the project, Kaeso refuses requests using those unpriceable features with HTTP `403` before anything reaches the provider, naming the feature and budget level. Tools your own application executes (`function` tools, local bash/editor/computer tools) are priced normally by tokens and pass without restriction.

## Headers for apps: `kaeso-limits` and `kaeso-cost`

Apps do not have to guess how close they are to a cap:

- **`kaeso-limits`:** When the key's owner holds `limits.view` (and `usage.costs` for spend budgets), every model response includes an RFC 9651 structured list of remaining rates and hard budgets with their reset times in seconds:

  ```http
  kaeso-limits: "key.requests.minute";limit=60;remaining=41;reset=17, "project.spend.month";limit="250.00";remaining="184.20";reset=604800
  ```

- **`kaeso-cost`:** On non-streamed responses where the caller may view costs, Kaeso also returns the request's cost in US dollars.
- **Budget alerts and webhooks:** Each budget alerts at up to 10 customizable percentage thresholds (`50%`, `80%` and `100%` by default), emailing organization owners/admins, project admins and (for a key budget) the key's owner, and firing signed [webhooks](https://docs.kaeso.app/console/webhooks).

## Organization currencies at daily ECB reference rates

In Kaeso 0.7.0, an organization admin can open **Organization settings** › **General** and set **Currency** to any of roughly 30 currencies published in the European Central Bank's [daily euro foreign exchange reference rates](https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html) (EUR, USD, GBP, CHF, JPY, CAD, AUD and more).

- **Exact USD underneath.** Kaeso stores and calculates every model price and request cost in US dollars using exact decimals, computing each currency's USD cross-rate to 12 decimal places from the ECB's daily feed (fetching the last 90 days on first start and refreshing every 6 hours).
- **Historical spend uses each day's rate.** Analytics, overviews, request logs, shared links and cost emails convert each day's spend at the ECB rate of that day (weekends and holidays use the preceding working day). CSV exports include both the organization's currency (`cost_eur`) and `cost_usd` side by side for accounting.
- **Budgets in your currency.** Spend budgets are entered and kept in the organization's currency (for example `€40.00/month`) and checked in USD at the latest ECB rate.

## Next steps

- [Limits and budgets in the docs](https://docs.kaeso.app/console/limits-and-budgets): full rules for hard and soft budgets, unpriceable features and reservations.
- [Currencies in the docs](https://docs.kaeso.app/concepts/currencies): ECB rate sync, custom price overrides and Platform API fields.
- [Request logs and privacy](https://kaeso.app/articles/request-logs-and-privacy): inspect cost basis (`reported`, `measured`, `estimated`, `none`) on every request.

Product names in this article belong to their owners and are used only to name the software and services involved. Kaeso is not affiliated with or endorsed by them.

By Kaeso Team

## More articles

- [How Kaeso tracks models, prices and retirements with KPMR](https://kaeso.app/articles/kpmr-and-model-lifecycle.md): How Kaeso syncs signed model data from KPMR, tracks provider deprecations and shutdown dates, shows which apps still call a retiring model, and moves aliases or model lines automatically.
- [Request logs, content retention and privacy controls](https://kaeso.app/articles/request-logs-and-privacy.md): Control what Kaeso stores in ClickHouse and for how long: separate metadata and prompt retention, per-project and per-request content switches, guardrail redaction, media caps and agent session deduplication.

[See all articles](https://kaeso.app/articles.md)

## Own the gateway. Own the record

```bash
curl -fsSL https://kaeso.app/install.sh | sh
```

[Install Kaeso](https://docs.kaeso.app/self-hosting/installation) · [Open the live demo](https://demo.kaeso.app)
