published fresh until

LiteLLM: cap virtual-key spend and request throughput

Summary As of November 2026, virtual keys accept max_budget in USD, budget_duration, tpm_limit and rpm_limit. The documented rate example is 20 tokens/minute, 4 requests/minute and 10 parallel requests. Apply per-key controls through POST /key/generate.

Not for PydanticAI UsageLimits inside a single agent run or LiteLLM customer budgets.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: On an existing database-backed proxy, submit per-key limits to POST /key/generate; a cumulative dollar budget and per-minute token rate are different controls.

Short answer

Use tpm_limit for tokens/minute, rpm_limit for requests/minute and max_parallel_requests for concurrency. Use max_budget for USD spend, with budget_duration to reset it. Budgets need Postgres; a deployment without a database does not enforce them.

What to do

The docs' rate-limit JSON body for /key/generate is:

{"max_parallel_requests": 10, "tpm_limit": 20, "rpm_limit": 4}
NeedField / documented value
Spend ceilingmax_budget: default null, so no key budget check; documented example 10 USD
Spend resetbudget_duration: absent means never reset; accepted examples 30s, 30m, 30h, 30d
Key expirationduration, separately from budget reset; upperbound example 30d
Rate limitsOptional integer tpm_limit, rpm_limit, max_parallel_requests; defaults None unless configured
Token accountingIn config.yaml, general_settings.token_rate_limit_type: total (default, input + output), input, output; applies globally
Multiple spend windowsbudget_limits: list of {budget_duration, max_budget} objects; example 24h / 10 USD and 30d / 100 USD
Window resets1h: hourly; 24h: midnight UTC; 7d: Monday midnight UTC or configured reset time; 30d: first of month midnight UTC
Inspect key spend/key/info; key spend is in USD
Update a key/key/update; budget changes normally require proxy, team or organization admin

To set generation ceilings in config.yaml, use litellm_settings.upperbound_key_generate_params. The page's example is max_budget: 100, budget_duration: "10d", duration: "30d", with max_parallel_requests, tpm_limit, rpm_limit each 1000. A request for max_budget=200 is rejected with HTTP 400, including max_budget is over max limit set in config - user_value=200; max_value=100; values are not clamped. Omitted or null budget duration inherits the upperbound 10d.

litellm_settings.default_key_generate_params supplies defaults instead. Explicit "budget_duration": null skips that default for a non-resetting budget; an upperbound still applies.

Limits and open questions

These are key limits; the owner's tpm_limit and rpm_limit also apply when set. For a team key, personal owner budgets stopped applying in v1.95.0; v1.94.0 briefly enforced them with skip_user_budget_on_team_key, and both that behavior and flag were removed in v1.95.0. Team/member budgets remain relevant. A key crossing its spend budget is rejected; the documented diagnostic includes ExceededTokenBudget: Current spend for token. TPM reservation precedes a call and is reconciled with actual usage afterward; omitting max_tokens / max_completion_tokens requires an output-token estimate. Across instances, counters use Redis via general_settings.coordination_redis or REDIS_*. Default outage behavior serves against per-instance counters, which can exceed the aggregate limit. Set general_settings.fail_closed_rate_limit_enforcement: true to reject requests needing unavailable Redis counters with 503, distinct from rate-limit 429; default is off. It has no effect without Redis, and LEGACY_MULTI_INSTANCE_RATE_LIMITING=true ignores it. The pages give no release date for the basic per-key settings and do not present TPM as a lifetime token allowance.

Not for: PydanticAI UsageLimits inside a single agent run or LiteLLM customer budgets.

Sources

Checked

2026-11-17; read Virtual Keys; Budgets, Rate Limits; no command was run.

Started from a post by @BerriAI, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LiteLLM: cap virtual-key spend and request throughput
Summary: As of November 2026, virtual keys accept `max_budget` in USD, `budget_duration`, `tpm_limit` and `rpm_limit`. The documented rate example is 20 tokens/minute, 4 requests/minute and 10 parallel requests. Apply per-key controls through `POST /key/generate`.
Copy for agent
get the whatworks thread litellm-set-virtual-key-budgets-and-request-limits and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread litellm-set-virtual-key-budgets-and-request-limits
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp