Entry 026Comparisons · Guides7 min readBy Mandare Labs

Langfuse AI Gateway budgets: what they cap, what's unsaid

Langfuse AI Gateway budgets cap spend in USD per gateway key, per user, by default for keys without one, and for the whole organization. Per the documentation read on 23 November 2026, a reached budget makes the gateway return HTTP 429 spend_limit_exceeded, requests already in flight still complete, and spend is computed from model prices. The feature is in public beta, and the pages leave several enforcement details unstated.

A Langfuse budget is a USD cap at four levels

On 19 November 2026 Langfuse announced budgets for its AI Gateway: "per API key, per user, a default for every key or user without one, and one for the whole organization". The budgets page, read on 23 November 2026, defines them as "spend limits: they cap what gateway traffic may cost in USD".

BudgetCapsWho can set it
API keyOne gateway keyAdmins and owners, and any user on their own keys
UserAll gateway keys of one userAdmins and owners
DefaultEach key or user without its own budgetAdmins and owners
OrganizationAll gateway spend of the organizationAdmins and owners

A budget resets daily (00:00 UTC), weekly (Monday), monthly (on the 1st), or never. It counts spend from the moment it is set. Changing the amount keeps the spend counted so far. Changing the reset interval starts counting again.

For an agent fleet the useful setup is one gateway key per agent, each with its own key budget, under a user or organization budget that bounds the sum. The page supports that layering: a default budget applies to "every key, or every user, that has no budget of its own, including service account keys", and each key counts its own spend against the default instead of sharing it.

A request counts against every budget that applies

The page states the precedence in one sentence: a request counts against its key's budget, the key owner's user budget and the organization budget, and "whichever is reached first blocks the request". A key's own budget replaces the default. Removing it puts the key back on the default.

Two consequences follow.

The Langfuse overview describes the gateway as one that "calls the external model provider (OpenAI, Anthropic)". Budgets here are fields on gateway keys, users and the organization. The LiteLLM entry covers another gateway where the budget is also a field on a key.

The refusal is a 429 that names the budget

When a budget is reached, the gateway responds with 429 and the error code spend_limit_exceeded. The message names the budget. The page's example reads: This key's user has spent $12.00 of its $10.00 monthly budget. The error troubleshooting page gives the remedy: "Wait until the budget resets, or ask an admin to raise it."

The same page lists a second 429, the organization's per-minute request limit, and says of it that "Most clients retry on their own". Both refusals share a status code. Whether a given agent client retries a spend_limit_exceeded 429 is a property of that client, and the pages do not cover it. An agent loop that retries every 429 will keep sending requests into a budget that stays shut until the next reset, so check how your client treats the body, not only the status.

A request that would fail the pricing requirement gets a different code. For a key with a budget, the gateway answers 400 spend_limit_unpriced_model when "Langfuse has no price for the model".

Spend is computed from prices, so a wrong price is a wrong cap

The budgets page says the spend "is calculated from model prices", and that a keyed budget therefore limits the key to models Langfuse can price. Refusing a model without a price is the safe default for a cap: a call that cannot be priced cannot be counted.

The same documentation set is honest about the price table itself. The known limitations page lists "Cost bugs, fixes in progress":

OpenAI cache_write_tokens are priced at $0. Anthropic 1-hour cache writes are priced at the 5-minute rate, 37.5% too low.

That page speaks about cost reporting. It does not say whether budgets read the same numbers, so a reader should not assume either way. It does show the dependency: a cap built on a price table is as accurate as the table, and a table row that is too low lets more calls through than the number on the budget suggests.

The page adds one more line relevant to caps: "Failed or cancelled calls may not return provider usage. Without submitted usage or cost, Langfuse leaves usage and cost breakdowns empty instead of estimating them from request or response text." For reporting that is a defensible choice. For a ceiling, the open question is what a cancelled call that the provider still bills counts for. The budgets page does not address it.

What the documentation leaves open, and a test for each

The budgets page makes one statement about timing: "Requests that are already in flight still complete." It does not say whether the budget is checked before the request is forwarded, whether the check and the spend update are one atomic step, how long spend takes to appear after a call, or how streamed responses are counted. These are the questions that decide whether a number is a ceiling or an estimate. The Cloudflare entry and the fail-closed entry cover the same questions for other gateways.

A way to answer them on your own deployment: create a key with a small budget, send a burst of concurrent requests, and count how many are admitted against the spend recorded afterwards. The request shape comes from the first-request guide, which gives the OpenAI route as $LANGFUSE_GATEWAY_HOST/openai/v1/chat/completions with the key as a Bearer token:

seq 1 50 | xargs -P 25 -I{} curl -s -o /dev/null -w "%{http_code}\n" \
  "$LANGFUSE_GATEWAY_HOST/openai/v1/chat/completions" \
  -H "Authorization: Bearer $LANGFUSE_GATEWAY_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<model-id>","messages":[{"role":"user","content":"Say hello"}]}' \
  | sort | uniq -c

This is a recipe, not a result: the journal did not run it against a Langfuse account. Compare the count of 200 responses with what the budget page shows afterwards. Repeat with "stream": true, and once with a client that disconnects mid-response. Three runs tell you whether the budget behaves as a ceiling under your traffic.

Who can change the number

The table above says admins and owners set budgets, and any user can set one "on their own keys". A budget on a key is therefore configuration inside the organization's Langfuse account, edited through the Budgets page. The documentation does not describe a signature over a budget or a record of who changed it. It does describe an email to the key owner and the organization's owners when a key or user budget is reached.

That fits what the product is for. The overview frames the gateway around visibility: "Cost and usage for every call land in one AI spend dashboard", with each call logged "as a complete trace". Spend caps sit next to tracing, analytics, model approval and per-key attribution. If the question is who spent what and in which session, that breadth is the strength. The observability and audit trail entry draws the line between a trace and evidence.

Where Langfuse is the better choice

Where a signed mandate fits, and where it stops

Mandare is an open-source control layer. Its gateway, the door, enforces a mandate that the owner signs once and records every call and refusal in a hash-chained ledger. The concepts page says mandates are "signed by the owner and self-verifying" and that caps are enforced by reservation: an intent reserves its estimated cost inside the ledger transaction before the call, and the result settles the true cost. Statements about Mandare apply to v0.1.0 (npm view @mandarelabs/cli version printed 0.1.0 on 23 November 2026), checked at repository commit 327442e.

On the open questions above, the repository answers differently:

QuestionLangfuse budgets (pages read 23 November 2026)Mandare door (v0.1.0)
Checked before the call?Not statedYes: the estimate is reserved inside the ledger transaction before forwarding
Model without a price400 spend_limit_unpriced_model on a budgeted keyRefused, code MODEL_UNPRICED (packages/gateway/src/reservation.ts)
Aborted or cut streamNot stated for budgetsSettles at the reserved estimate, never zero (providers docs)
Refusal status429403 DENIED, written to the ledger as an entry
Where the limit livesA budget in the Langfuse accountA signed mandate; caps are per transaction, day, task and total

This is the demo capture pinned to the checked commit, file docs/demos/S2-runaway-demo.txt, cut with …:

pnpm demolive capture
  call # 72  403 DENIED — THE LOOP DIES HERE
    code:   PER_DAY_EXCEEDED
    reason: per-day budget exceeded: reserved 0.00 EUR + settled 19.723587 EUR + estimate 0.278853 EUR > cap 20.00 EUR
    the refusal itself is ledger entry 59034994bfacad09…

[demo] runaway made 71 calls in 0.1s before the mandate killed it.
…
  mnd_dev_d9c14527fd81: settled 19.723587 EUR · open reservations 0.00 EUR · 71 call(s) · 1 refused

The limits are stated next to the claim. The overshoot guarantee holds only given a correct price table, and a model with no price is refused. The demo uses a mock provider: the enforcement is real, the money is not. Mandare has no external audit yet. The door proxies two routes, Anthropic POST /v1/messages and OpenAI or OpenRouter POST /v1/chat/completions, and nothing else. There is no hosted service.

The routes Langfuse exposes, /openai/v1 and /anthropic, and the door's two routes share the same provider families. No test or example in the Mandare repository runs one behind the other, so this entry makes no claim about combining them.

Questions

What does a Langfuse AI Gateway budget cap?

Gateway spend in USD, at one of four levels: a single API key, all keys of one user, a default for every key or user without its own budget, or the whole organization. A request counts against every budget that applies to it, and whichever is reached first blocks it. Budgets reset daily, weekly, monthly or never.

What error does Langfuse return when a budget is reached?

HTTP 429 with the error code spend_limit_exceeded. The message names the budget, for example that a key's user has spent $12.00 of its $10.00 monthly budget. A model without a Langfuse price on a budgeted key gets a 400 spend_limit_unpriced_model instead.

Can a Langfuse budget be exceeded?

The documentation says requests already in flight still complete, so the final requests before the limit can push spend past it. The pages do not say whether the check runs before or after the call, how streaming is handled, or what a cancelled call counts for. Test these on your own setup before relying on the number as a ceiling.

Is the Langfuse AI Gateway stable enough to rely on?

Langfuse labels it a public beta that can still change. Its known-limitations page lists open cost bugs, no retries, fallbacks or caching, and a 600-second limit per call. Treat budgets as a spend control to verify, not as a guarantee.

Sources

  1. Cap AI Gateway spend with budgets (changelog, 19 November 2026) · Langfuse · 2026-11-19
  2. Budgets (Langfuse AI Gateway documentation) · Langfuse
  3. How do I troubleshoot AI Gateway errors? · Langfuse
  4. What are the known limitations of the AI Gateway beta? · Langfuse
  5. How do I get started with the Langfuse AI Gateway (first request) · Langfuse
  6. AI Gateway overview (Langfuse documentation) · Langfuse

Run it yourself: 3 commands, no API keys.

github.com/mandarelabs/mandare →
← All journal entries