Provider budget routing in LiteLLM

Provider budget routing in LiteLLM caps spend per provider, deployment or tag and shifts traffic to other routes once a budget is used. This page explains how it works, where it fits and what to confirm before relying on it.

On this page

Provider budget routing in LiteLLM: when a committed spend cap should move traffic

A platform team that holds a committed spend agreement with one cloud provider needs a guarantee that LLM traffic cannot push that provider past the commitment. LiteLLM can set budgets per provider, per model deployment and per tag, and it can route traffic away from a provider once that budget is used. The control lives in the proxy configuration under provider_budget_config, where each provider gets its own spend limit and budget period such as 1d, 30d or 1mo, as described in the LiteLLM provider budget routing docs. Confirm the exact keys and accepted period values against that page for the release you run, because the configuration shape is what your change control will review.

Provider budgets answer a different question than virtual key budgets. Per-key, per-user and per-team budgets cap what a person, service or team may spend, which is the right tool for internal chargeback and fair use. A provider budget caps what the organization spends with one vendor, regardless of who sends the request. Use provider budgets when the constraint sits with the contract, such as a committed spend tier, a prepaid credit pool or a cloud marketplace obligation. Team or key budgets alone will not stop a sum of permitted teams from exhausting a commitment. Per-deployment and per-tag budgets narrow the cap further, for example to one region of a provider or to one cost center, and the team should decide which level matches the contract before writing any configuration.

Before enabling routing away from a provider, decide what the fallback is and whether it is allowed under the contract, data handling rules and model approval list. A fallback deployment on another provider changes where prompts are processed, so the security and compliance owners should sign off on it. Test the behavior in a non-production environment by lowering a budget to a small value and confirming that new requests move to the fallback while the capped provider receives no further calls. Also confirm how the budget counter is shared across proxy instances, since multi-instance deployments depend on the shared Redis and PostgreSQL state described in the production guide, and check how spend is measured against the provider invoice, because a cap is only as accurate as the cost data behind it.

Budget scopes and when each fits

This table compares the three budget scopes LiteLLM supports for routing: per provider, per model deployment and per tag. Read each row for its typical use, its limits and what to confirm with your router settings before you rely on it. The main takeaway is that provider scope fits committed cloud spend, while deployment and tag scopes fit narrower cost questions.

ScopeTypical useWhat it cannot doConfirm before relying on it
Per provider (provider_budget_config)Keeping spend within a committed amount on one cloud or model vendor, such as a Bedrock or Azure commitmentSeparate a cheap deployment from an expensive one on the same providerWhich routing strategy and fallback order move traffic to other providers once the cap is reached
Per model deploymentCapping one costly deployment, such as a premium model or a self-hosted GPU endpoint with its own budgetReflect a commitment that spans several deployments or providersWhether the router skips the capped deployment in its own group or fails the request instead
Per tagLimiting spend for a cost center, project or feature that sends requests with a shared tagGuarantee a provider-level commitment, since tags follow the caller rather than the vendorWhether tagged requests are tracked consistently across every calling application and SDK
Period value 1dDaily caps that stop runaway usage within a daySmooth spend across a month, so a short burst can exhaust the cap earlyThe reset time LiteLLM uses and the time zone that applies to your reports
Period value 30dRolling caps that approximate a monthly limit without a calendar boundaryAlign with an invoice month or a commitment term that starts on a fixed dateHow the rolling window compares with your provider's billing period
Period value 1moCalendar-month caps that align with monthly invoices and finance reportingProtect against a spike late in the month without a separate daily capHow the reset behaves at month boundaries and whether the value appears in your LiteLLM version as documented

Setting up provider budgets on a self-hosted gateway

This sequence takes a self-hosted LiteLLM proxy from a database-backed spend record to per-provider budget caps, with fallback routes that keep traffic flowing when one provider's budget is used up.

  1. Confirm PostgreSQL is storing spend

    The platform engineer confirms the LiteLLM proxy is connected to PostgreSQL, the primary supported database, before any budget is set. Budget and spend tracking depends on that database. Make a test request through a virtual key and check that the spend record appears in the Admin UI. Done means the spend shows up with the correct key and model, so later budget checks have a reliable base to compare against.

  2. Add Redis when running several proxy instances

    If more than one proxy instance will serve traffic, the platform team adds Redis 7.0 or newer so that rate limits, router state and cache are shared across instances. Without shared state, each instance can track budget use separately and one provider can overshoot its cap. Confirm that every instance points to the same Redis endpoint and that the instances report the same spend totals after a short test run.

  3. List providers and deployments in config

    The platform team defines each provider and model deployment in the proxy configuration file, including the model names callers will use and the credentials each deployment reads from a secret manager. Keep the master key in that secret manager as well. Done means the proxy starts cleanly, and a request to each listed model returns a response, which confirms every deployment is reachable before any budget is applied.

  4. Set provider budget limits and periods

    Using the provider_budget_config setting, the platform team sets a spend limit for each provider along with a period such as 1d or 30d. Match the limits to the committed or planned spend for each provider, and confirm the period values against the LiteLLM documentation for the version in use. Done means the configuration loads without errors and the limits appear as expected when the proxy reports its budget state.

  5. Configure fallback and priority ordering

    Next, the team sets the routing order so that when one provider's budget is used, traffic moves to a named alternative. Priority ordering and failover settings in the router define which deployment is tried first and which takes over. Choose fallbacks that serve the same models or acceptable substitutes, because callers will see the substitute's behavior. Done means each primary deployment has a documented next route that is listed in the configuration.

  6. Simulate spend on a non-production key

    With a non-production virtual key restricted to the test models, the team sends requests until the spend for one provider approaches its limit. Use a low, deliberate budget for the test so the outcome is visible quickly. Check that tracked spend in the Admin UI rises in step with the requests. Done means the spend totals match the expected amount within your own tolerance.

  7. Verify the router switches to the fallback

    Once the test budget is exhausted, the team sends another request and checks the proxy logs and response metadata to confirm that the router sent it to the fallback deployment rather than the exhausted provider. Confirm that the exhausted provider receives no further calls. Done means the fallback route is confirmed in logs, and the team documents the exact test steps and results so the same check can be repeated before any production change.

  8. Record the test and review the limits

    The team saves the configuration, the test results and the Admin UI screenshots in its change record, then assigns an owner to review the provider limits on a set schedule. Confirm the production limits against the current committed spend and the budget period before enabling them for live keys. Done means an approved change record exists and the production budgets match the reviewed values.

Security and operational risks of budget-driven routing

Budget-driven routing decides where live traffic goes, so a wrong budget value or a quiet change to the routing config can move spend without anyone noticing. The cards below cover the change, access, visibility and outage risks that connect budgets to routing, and the controls to put in place before the first cutoff reaches production.

Budget config changes without review

The provider_budget_config block decides which provider stops receiving traffic and when. A typo in a limit or period can cut a provider off early or let spend run past committed levels. Keep the config in version control, require a second reviewer for any change to limits or periods, and deploy it through the same pipeline as other gateway configuration. Check that the period values in use match the billing cycle your provider contract uses.

Provider budget routing docs

Provider silently removed from routing

If a provider's deployments drop out of the router, all traffic can concentrate on the remaining, often more expensive, route. This can happen through a config edit, a deleted deployment or a failed model entry, and it may not raise an error. Test the failover order in a staging gateway, and confirm after each change that traffic still reaches the intended providers. Alert on a sharp shift in the share of requests by provider.

Admin access to edit budgets

Anyone who can change budgets or routing can also change where money goes. Keep LITELLM_MASTER_KEY, which must start with sk-, in a secret manager rather than in config files or environment files checked into source control. Limit admin UI and API access to named operators, and issue service keys for automation with only the permissions they need. Review who holds admin rights each quarter.

Production best practices

Audit trail for budget changes

A budget change without a record makes spend anomalies hard to explain to finance or to the provider. Keep a record of who changed a limit, when, and what it was before. Git history covers file-based config, while audit logs in LiteLLM Enterprise cover changes made in the admin UI. Confirm which of these your edition provides before relying on it for an audit, and store exported logs outside the gateway.

LiteLLM Enterprise docs

Alerts before a budget is reached

A cutoff that arrives without warning can stop production calls in the middle of the business day. Set alerts on spend approaching each provider budget, so the platform team and the budget owner can act before routing changes. Decide in advance who receives the alert, what action they take, and whether a planned temporary increase is available. Test the alert path with a low threshold in staging before relying on it.

Provider outage combined with a budget cutoff

When one provider is down and another has used its budget, the router may have no healthy route left, and callers see errors. Plan the failover order with both conditions in mind, and decide whether critical workloads may exceed a budget to stay available. Retries and cooldowns in the router limit how quickly traffic moves, so rehearse this scenario with a simulated outage and a low budget before go-live.

Trade-offs: hard cutoffs, routing quality and committed spend

The central decision in provider budget routing is whether a provider's budget should be a hard cutoff that moves traffic elsewhere, or a soft signal that alerts finance and platform owners while requests keep flowing. A hard cutoff protects a committed spend commitment but changes behavior for callers without their consent: once the budget for a provider is used, requests that would have gone there are routed to another deployment, which may be a different model with different context limits, tool-calling behavior, latency and output quality. Before you enable the cutoff, list which model groups each application uses, agree with the owners which fallback models are acceptable for each, and confirm in a staging environment that the fallback behaves acceptably under the same prompts. Soft alerts avoid that disruption but leave the cap to a person, so decide who responds, how fast, and what happens overnight or on weekends.

The budget period is the second trade-off, and it is easy to get wrong. Provider budgets in LiteLLM are set per period, such as 1d, 30d or 1mo, and those windows run on their own schedule. If your cloud or provider contract resets on a fixed calendar date, a rolling 30-day window can cut traffic off in the middle of a contract period and leave committed spend unused at the end of it, or allow overspend against a commitment that resets earlier. Ask finance for the exact commitment start date, the measurement basis (list price or discounted cost), and whether unused commitment carries over. Then confirm how your LiteLLM version resets and reports provider spend, because the spend you track must match the invoice you are measuring against.

Routing strategy interacts with budget decisions, so test them together. The router's cost-based option, its priority ordering for failover and its cooldowns after repeated failures can each send traffic to a provider you intended to exclude, or concentrate load on a single fallback until it is saturated. Write a test plan that drives one provider to its budget limit under realistic concurrency, then checks which deployment each model group uses, whether cooldowns and retries behave as expected, whether latency and error rates stay within your service targets, and whether spend stops at the cap. Repeat the test after any change to routing configuration, model pricing or LiteLLM version, and record the results so the next upgrade has a baseline.

Limits to confirm in your environment

Provider budget routing depends on version-specific behavior, shared state and how spend is counted. The cards below list the points to verify in your own LiteLLM release and infrastructure before a budget is allowed to redirect production traffic.

Supported budget scopes and periods

Confirm that your LiteLLM version supports each scope you need: provider, model deployment and tag. Then confirm the period values you plan to use, such as 1d, 30d or 1mo, since the accepted values are set by the provider_budget_config behavior in your release. Test each combination in a non-production proxy before you write it into configuration as code.

Provider budget docs

Budget reset alignment with billing

A rolling 30-day window will not match a calendar-month invoice from a provider. Confirm when each budget resets, which timezone applies, and whether the reset point lines up with the billing cycle on your committed spend. Mismatched windows cause budgets to block traffic early or to allow spend beyond the commitment.

Shared budget state across instances

Budget counters must be consistent across every proxy replica. Confirm with the LiteLLM production guidance how router state is shared when more than one instance runs, including the Redis version and connection settings your deployment requires. Test with concurrent requests from two instances to see whether both enforce the same limit.

Production guide

Cached responses and zero-cost models

Decide whether responses served from cache count against a provider budget, and whether models with zero configured cost are excluded from budget checks. Both choices change how fast a budget is consumed. Confirm the behavior for your release with a test that sends repeated identical prompts and a zero-cost model, then compare the recorded spend with your expectations.

Per-request enforcement and overshoot

Find out whether a budget is checked before each request or only after usage is recorded. If checks run after the fact, a burst of concurrent or long requests can push spend past the cap. Ask the vendor or test whether a request in flight at the limit completes, and set a margin below the committed amount to absorb that overshoot.

Failover behavior once a budget is used

Confirm which deployments the router selects after a provider is excluded, and whether the fallback provider has its own budget, pricing and model names. Test that requests fail cleanly when every eligible provider is exhausted, and that callers receive an error they can handle.

Questions buyers ask about provider budget routing

What does provider budget routing cost and what drives the price?

The cost comes from the written scope, so no fixed price applies to every gateway. The main drivers are the number of providers, model deployments and tags that carry budgets, how many fallback paths you need when a provider's budget is used, and how much testing the routing needs before go-live. Each provider you add also means another billing contract to read, another budget owner to agree with and another set of routing rules to verify. Ask a partner to quote these as separate line items: scope definition, configuration, fallback design, testing, handover, and any retainer for ongoing budget changes. Ask which items are one-time and which recur.

How long does provider budget routing setup take?

Duration depends mostly on inputs you control, not on the configuration itself. The longest steps are usually agreeing budget periods with finance, confirming how each provider's billing cycle lines up with your reset dates, and deciding what should happen when a budget runs out. A small set of providers with one fallback each moves faster than a multi-cloud setup with per-tag budgets and several fallback chains. Ask any partner for a timeline tied to a written scope and a list of client dependencies, and check which dates depend on your approvals.

What does our team need to provide before the work starts?

Several inputs must be in place before anyone edits configuration. You need the contract terms for each provider, including any committed spend and how it is measured, so the budget matches what you actually owe. You need a list of the providers and model deployments in use, plus the tags that represent cost centers or projects. Each budget also needs a named owner who can approve changes and respond when routing shifts traffic. Finally, decide which model or provider should receive traffic after a budget is used, because that choice affects both users and spend.

Can our own platform team set up provider budget routing without a partner?

Yes, a platform team with LiteLLM experience can configure provider budgets in the proxy configuration, because the feature is documented in the LiteLLM provider budget routing docs. The harder part is the surrounding work: reading each provider's billing terms, reconciling gateway spend with invoices, deciding fallback behavior, and proving that routing changes behave as expected under load. Teams that own the gateway already and have time for testing often do this in-house. Teams without those skills, or with a deadline tied to a committed spend date, often bring in a partner for the design and verification steps.

Does provider budget routing require LiteLLM Enterprise?

Provider budget routing is part of the open-source LiteLLM proxy, so the feature itself does not require an Enterprise license based on the supplied documentation. Enterprise adds capabilities such as SSO and SCIM beyond the free user limit, audit logs, team RBAC and secret manager integrations. Those may matter for how you administer budgets and prove who changed them. Confirm the license position against the current LICENSE file and the Enterprise documentation before you commit, because the license split between the enterprise/ directory and the rest of the code affects what you can deploy.

What breaks when a provider budget is used and traffic is rerouted?

The most common problems are unexpected shifts of traffic to a provider with a higher cost, applications that depend on a model that is no longer reachable, and budgets that reset at different times from the provider's own billing cycle. Routing also interacts with retries and cooldowns, so a poorly ordered fallback can send requests to a provider that is already failing. Test each fallback path with real budget thresholds in a non-production environment, and confirm that alerts reach the budget owner before the switch happens.

How do we know provider budget routing matches our committed spend?

Start by recording the commitment terms for each provider, including the period, the amount and how the provider counts usage. Then compare gateway spend with invoices over a stable window, since mismatches often come from ingestion timing, token categories such as cache, or outdated pricing data. Only after that reconciliation should you set budgets, because a budget built on wrong numbers will route traffic at the wrong moment. A partner should show how it plans this check as part of the written scope.

Who should own provider budget routing after go-live?

A named platform owner should keep the routing configuration, while finance owns the budget amounts and reset periods, and each provider or cost center owner approves changes that affect their spend. Without this split, budgets drift from contracts and nobody knows who should answer when traffic moves. Document the change process, the escalation path and the review cadence before go-live. Ongoing support, upgrades and continuous testing can be covered by a retainer if your team wants a partner to keep this running.

How a request flows through budget checks and fallback

The diagram starts with a client sending an OpenAI-format request to the LiteLLM proxy. The router checks the provider budget for the target provider, deployment or tag before choosing a route. If the budget has room, the request goes to the primary deployment; if it is used up, the router sends the request to a fallback deployment on another provider. Check that spend is written to PostgreSQL so the budget counters survive restarts and match what the proxy enforces.

Budget check routes each request to a primary or fallback deployment.

Where to read the LiteLLM documentation

Read the LiteLLM provider budget routing docs before you write any provider_budget_config block. That page explains how budget limits are set per provider, per model deployment and per tag, and which period values the feature accepts, such as 1d, 30d or 1mo. Keep a copy of the page version that matches the LiteLLM release you run, because budget behavior is tied to the release line and the docs change between versions.

Budget routing depends on two other mechanisms that you should also read in full: the router, which decides where a request goes once a provider is excluded, and virtual keys, which carry the per-key and per-team limits that interact with provider budgets. The LiteLLM routing docs cover retries, cooldowns and priority ordering for failover, and the LiteLLM virtual keys docs cover key-level budgets and model restrictions. Note which router strategy your gateway uses, since the fallback order you expect depends on it.

Before production use, confirm exact field names, period values and the behavior when a budget is exhausted against the running release, not only against the documentation. Run a test in a non-production environment with a deliberately low provider budget, then check which deployment receives the request, what error or fallback the caller sees, and whether the spend log records it. Record the release number you tested so the result can be repeated after an upgrade. If the documentation and the running gateway disagree, treat the running gateway as the source of truth and raise the gap with LiteLLM before you rely on it for committed spend.

How DeployOpen scopes and delivers provider budget routing

Most DeployOpen engagements are fixed-scope, so the first deliverable is a written scope that names every provider, deployment and tag that will carry a budget. Provider budgets in LiteLLM are configured through provider_budget_config, and the scope should state which providers have committed spend, which period each budget uses (for example 1d or 30d), and what happens at the limit. Teams often find that the hard part is not the YAML but agreeing who owns each number. The scope should therefore record the business owner for each budget and the finance contact who will reconcile it.

  • Provider inventory: list each provider and deployment, its billing account and the commitment it must stay within.
  • Budget definitions: record the limit, period and reset behavior for each provider, deployment or tag.
  • Fallback map: state which deployment receives traffic once a budget is used, and whether that fallback is allowed for the data involved.
  • Ownership: name the approver for every budget change and the person who receives threshold alerts.
  • Exclusions: list providers or models that must never be routed away from, such as those under data residency terms.

Confirm with your finance team whether the budget counter should match your invoice period, since that choice drives every later reconciliation step.",

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.