LiteLLM tag budgets for cost centers and projects

LiteLLM tag budgets attach cost centers, projects, customers or features to requests so spend can be tracked and capped per category. This page covers the design, setup and limits to confirm.

On this page

How LiteLLM tag budgets allocate AI spend to cost centers and projects

A platform team that runs one LiteLLM gateway for the whole company must charge model spend back to departments and projects, and a single shared key cannot tell them apart. LiteLLM tag budgets solve this by attaching category tags to requests, such as a cost center, project, customer or feature, so the gateway tracks and limits spend per tag. They require a PostgreSQL database, the same database that holds virtual keys and spend records. Tags are the right tool when one application or team key serves several cost centers, or when one team's traffic must be split across projects. Virtual key budgets are the better fit when the owner of the spend is a person, a team or a service account that maps cleanly to one budget holder. Tag-based budgets are listed among LiteLLM Enterprise features, so confirm your edition before designing around them (see the LiteLLM Enterprise documentation).

Before writing any tag policy, decide which dimension finance will report on and which one will be enforced. A tag that reports spend but never blocks is a different control from a tag with a budget, and mixing them in one taxonomy creates confusion when a team hits a limit. Choose a small, fixed set of tag keys and a naming convention, for example one value per cost center code. Callers then add the tags to requests, and the platform team checks that untagged traffic is either rejected or routed to a default bucket. Ask the vendor or your own tests to confirm exactly how tags are passed in each SDK and proxy request, and how untagged spend is reported, because those details decide whether the numbers match your chargeback model.

Expect the tag taxonomy to change after the first billing cycle. Projects end, cost centers are renamed and customers are added, so plan an owner for the tag list, a review cadence and a rule for retiring old tags without losing their history. Test the design in a non-production gateway with two or three illustrative tags and a small budget before rolling it out, and confirm that the spend totals for each tag add up to the provider invoice for the same window. The settings that control how long tag rollups are kept are covered in the next section.

Tagging and budget options and when each fits

This table compares request tags, virtual key budgets, team budgets and a single shared key across granularity, who sets the value, and the reporting each produces. Read each row against your chargeback model, and use the category rows to decide which tag fits each kind of internal owner. The main takeaway is that tags allocate and cap spend by category, while keys and teams map to identities that your access model already controls.

OptionGranularity and who sets itReporting it producesWhen it fits
Request tagsAny category the calling application attaches to each request; set by the application or gateway configuration ownerSpend and budget tracking grouped by tag valueAllocating spend across cost centers, projects, customers or features that do not map to a person or team
Cost center tagOne value per finance cost center; usually set by the platform team from a finance-approved listMonthly spend per cost center for finance reviewChargeback where finance bills a fixed organizational unit and needs totals that match its ledger
Project tagOne value per funded project or initiative; set by the project owner or platform teamSpend per project against its planned budgetTime-limited work where the project ends and its spend must be reported separately
Customer or feature tagOne value per customer account or product feature; set by the application that makes the callSpend per customer or feature, useful for unit cost analysisUsage-based billing or cost-per-feature reviews, where values must be stable and consistent across callers
Virtual key budgetOne key per application or service account; set by a gateway administratorSpend and usage per key, tied to the key's owner recordLimiting a single service or integration, with a hard cap on what that key can spend
Team budgetOne budget per team, covering all keys and users assigned to it; set by the administratorSpend per team with reset periods and alerts to the team leadDepartment-level accountability where teams already own their keys and users in the gateway
Single shared keyNo per-owner split; one key used by all callersOnly total spend for the gateway or keyEvaluation, proofs of concept or very small deployments where internal allocation is not needed
Tag budgets in practiceTag budgets are listed among LiteLLM Enterprise features; confirm the edition and tag behavior in your environmentConfirm with the LiteLLM docs which reports and API fields expose tag spendUse tags for cross-cutting categories and keys or teams for ownership, and confirm both fit the chargeback model

Setting up tag budgets in a self-hosted LiteLLM proxy

This sequence takes a self-hosted LiteLLM proxy from a database check to verified, tag-level spend and a test budget that blocks as configured, so finance and platform teams can trust the numbers before anyone is charged internally.

  1. Confirm PostgreSQL is in place

    The platform team confirms that the LiteLLM proxy is connected to a PostgreSQL database, because tag budgets and spend tracking depend on it. Check the database connection in the proxy startup logs and confirm the proxy can write to its spend tables. Ask your DBA to confirm backups cover this database, since spend history lives here. The step is done when a test request appears in the spend records with no connection errors in the logs.

  2. Define a tag taxonomy with finance

    Finance, platform and team leads agree on the tag categories and the exact value for each, such as a cost center code, a project identifier, a customer code or a feature name. Write the list down with one owner per category and a rule for creating new values. Tag values should match the codes finance already uses in its ledger so the chargeback report can be joined to it later. The step is done when the agreed list is approved and every category has a named owner.

  3. Configure tag budgets on the proxy

    The platform team adds the agreed tags and their budgets to the proxy configuration, following the tag budgets documentation for the exact keys and fields in your LiteLLM version. Start with one tag that has a generous, clearly labeled test budget so the first run is low risk. Store the configuration as code and record the version under change control. The step is done when the proxy starts cleanly and the admin view or API lists the configured tags with their budget values.

  4. Have callers send tags on requests

    Application teams update their clients to send the agreed tags with each request, using the metadata field that the LiteLLM documentation describes for tags. Each team tests its own integration in a non-production environment first. Ask teams to reject requests with missing tags in their own code, since untagged spend is hard to allocate later. The step is done when a sample request from each calling application shows the expected tag in the logs.

  5. Verify spend appears under each tag

    Send a set of known test requests with one tag at a time, then check the spend records to confirm each request is attributed to the correct tag and no spend lands under a blank or default value. Compare the totals with the token counts in the provider response for a small sample. Repeat this for each category in the taxonomy. The step is done when every test tag shows the expected spend and the sample totals agree with the provider's usage figures.

  6. Test that a budget blocks as expected

    Set a deliberately small test budget on a dedicated test tag, then send requests until the proxy refuses them. Confirm the rejection message, the HTTP status returned to the caller and the log entry that records it. Then raise or remove the test budget and confirm requests succeed again. Keep the test tag separate from production tags so no real team is blocked. The step is done when the block and the reset both behave as the configuration says.

  7. Hand over tag ownership and reports

    Once the tests pass, the platform team documents each tag, its owner, its budget and the process for changing either. Finance receives access to the spend view or export they will use for monthly review. Agree who approves budget increases and how temporary increases are recorded. The step is done when the owners sign off on the taxonomy document and the first monthly review date has been set.

Decisions that shape a usable tag taxonomy

Tags only produce useful budgets when the team agrees on what they mean before traffic arrives. The decisions below connect naming, ownership, enforcement, change handling, untagged spend and finance mapping, so each tag value has one owner and one meaning from request to invoice.

Naming conventions for tag values

Agree on a fixed format for every tag key and value, such as lowercase words, no spaces and a stable prefix per category. Tag values are matched as text, so Payments-EU and payments-eu can become two separate budgets and two separate spend lines. Write the convention down, then test one sample request per category to confirm the value is stored exactly as intended.

Tag budgets docs

Ownership of each tag value

Every cost center, project or customer value needs a named owner who approves new values and answers spend questions. Without an owner, teams invent values for convenience and budgets drift from the org chart. A simple register listing value, owner, budget and finance code is usually enough to start, and it should be reviewed on a fixed schedule.

Required versus optional tags

Decide which keys every request must carry, usually the cost center, and which are optional, such as a feature name. Enforcement happens in the calling application or gateway configuration, so confirm with your team how a request without a required key is handled before go-live. Optional keys are easier to adopt but produce less complete reports.

Renamed and merged cost centers

Reorganizations change cost center names while historical spend must stay attributable to the old name. Decide whether a rename creates a new tag, keeps the old tag for past periods, or maps both to the same finance code. Record the change date in the register so monthly reports can explain a sudden drop in one tag and a rise in another.

Treatment of untagged traffic

Requests without a tag still cost money, so decide where that spend lands before anyone reads a report. Common choices are a visible catch-all value owned by the platform team or a required-tag rule that rejects the call. Whichever you choose, track the untagged share each month, because a growing catch-all bucket is an early sign that callers are not being updated.

Mapping tags to finance billing codes

Finance systems use their own codes, ledgers and approval hierarchies, so each tag value needs a documented mapping to a billing code. Confirm with finance whether the mapping is one to one, whether a project can span several codes, and who updates the mapping when codes change. Keeping this mapping in version control makes chargeback exports reproducible when auditors or finance teams ask how a number was produced.

Pruning daily tag rollups with a retention period

Set a retention period for daily tag rollups before the first chargeback cycle, because tag spend data accumulates one row per tag per day and never shrinks unless something removes it. Each tag your teams create (a cost center, project, customer or feature) adds a daily aggregate, so a gateway with many tags and several years of history carries a table that grows with time as well as with usage. Retention is the control that sets how far back that daily detail is kept. Before you choose a value, confirm the retention configuration keys, their default behavior and whether pruning runs automatically in your release by reading the LiteLLM tag budgets docs at LiteLLM docs: Tag budgets and testing the setting in a non-production instance.

Be clear about what pruning removes and what it leaves alone. A retention period removes old daily rollup rows for tags. It does not change the spend already reported for past periods in your finance exports, it does not delete the underlying request logs unless your logging configuration does so, and it does not remove the tag definitions or the budgets attached to them. Confirm each of these separately in your environment, because the request log store and the rollup table are governed by different settings. Chargeback reports that need a historical month should be generated and archived before that month falls outside the window, since a rollup that has been pruned cannot be recomputed from the summary alone.

Align the retention period with your audit and chargeback obligations rather than with the default. Finance usually needs a full fiscal year and any disputed invoice period, while internal audit may ask for evidence of who set a budget and when it changed. Write the retention value into the same decision record as your log retention and export schedule, and assign an owner to confirm that archived monthly reports open and reconcile to the provider invoice. Ask your implementation partner to include a restore test of an archived period in the scope, so the first time someone needs old chargeback data is not during a dispute.

Security and operational considerations for tag-based spend controls

Tag budgets are only as trustworthy as the people who can change them, the keys that authorize writes, and the database that records spend. The cards below cover who controls tags and budgets, how the master key is protected, what Enterprise adds for change control, how spend writes load the database, and where callers can undermine tagging.

Who can create and change tags

Tag names, tag budgets and the keys that carry tags all sit in the proxy's admin layer, so anyone with admin rights can move spend from one cost center to another. Decide in advance which roles may create tags, edit budgets and raise limits, and which teams only read spend. Confirm in your own environment how the admin UI and API restrict these actions before you hand out admin access to finance or team leads.

Protecting the master key

The LITELLM_MASTER_KEY can administer keys, budgets and tags, so it is the most sensitive credential in the gateway. LiteLLM recommends keeping it in a secret manager and it must start with sk-. Do not place it in container images, shared configuration files or chat threads, and rotate it through your secret manager after any staff change on the platform team.

Production guide

Change control with Enterprise RBAC and audit logs

Organization and team RBAC limit who can edit budgets for which teams, and audit logs record who changed a tag budget and when. These controls are part of LiteLLM Enterprise, so an open-source deployment needs its own process for approvals and change records. Ask whether your finance and security teams need audit evidence for budget changes, and confirm which edition gives you that evidence before you design the approval workflow.

Enterprise docs

Database load from spend writes

Every tagged request adds spend to the PostgreSQL database that tag budgets read from. At scale, LiteLLM recommends batching spend updates to the database every 60 seconds, and multiple proxy instances need Redis 7.0 or newer for shared state. Load test with your real tag cardinality, since a large number of distinct tags increases the rows written and the daily rollups you must retain and prune.

Callers that omit or spoof tags

A tag budget only counts requests that carry the tag, so a caller that omits it lands outside the cost center's budget, and a caller that sends another team's tag charges the wrong team. Decide whether tags are set server-side on the key or team, rather than trusted from request bodies, and monitor for untagged spend. Illustrative check: a weekly report of requests with no tag can reveal integrations that need configuring.

Questions buyers ask about tag budgets and outside help

What drives the cost of setting up LiteLLM tag budgets?

The main cost drivers are the number of tags, how many callers and applications must send them, and how many integrations the budgets must reach, such as finance exports or identity records. Cost also rises with the number of providers and environments, since each needs the same tagging and budget checks. Tag design is one-time work, while monitoring, budget changes for new cost centers and rollup retention are recurring. In a quote, ask which items are one-time, which are recurring, who performs each task, and what changes would trigger a change order.

How long does a scoped LiteLLM tag budget setup take?

Duration depends on the tag count, the number of integrations, the state of your existing LiteLLM deployment and whether PostgreSQL is already in place, because tag budgets require a PostgreSQL database. A setup with a small, agreed tag list and few callers is shorter than one that must map dozens of cost centers and projects into finance systems. Ask for a schedule with milestones, the dependencies on your teams and the points where your sign-off is required. Timelines are agreed in the written scope before work starts.

What do finance and engineering teams need to provide?

Finance usually supplies the authoritative cost center and project list, the owner for each tag, the budget amounts and reset periods, and the reporting calendar. They also help by providing recent provider invoices so tracked spend can be compared against bills. Engineering supplies access to the LiteLLM proxy and its PostgreSQL database, the ability to change how callers send tags, a test environment and a change process for production. Name one decision-maker on each side early, since tag ownership disputes are one of the most common delays.

Can our platform team set up tag budgets without outside help?

A platform team with PostgreSQL and LiteLLM proxy experience can configure tag budgets alone, since the feature is documented in the LiteLLM tag budgets docs. The harder work is usually organizational: agreeing a tag taxonomy, getting every caller to send consistent tags, and proving that budgets block or warn as designed. Teams that do this in-house typically test with one department first and check spend against provider invoices before expanding. Decide early whether internal staff have the time to own the design, testing and ongoing tag hygiene.

Do we need LiteLLM Enterprise to use tag budgets?

Tag-based budgets are listed among the features on the LiteLLM Enterprise page, so plan on an Enterprise license if tag budgets are part of your design. Confirm the current edition and license terms with LiteLLM before you design around the feature, because feature lists change between releases. LiteLLM is dual licensed, with content under the enterprise directory governed by its own license and the rest under MIT, so check which license covers each component you deploy. Review the LiteLLM Enterprise docs for the current feature list and support terms.

What does a fixed-scope tag budget engagement include?

A fixed-scope engagement should name the deliverables in writing before work starts, including the tag taxonomy, the budget definitions per tag, the configuration in your environment, test evidence showing that budgets behave as designed, the rollup retention settings and a handover document for your team. Scope should also state what is excluded, such as changes to finance systems or caller code owned by other teams. DeployOpen runs most engagements on this model, with scope, deliverables and timelines agreed in writing. Ongoing support, upgrades and continuous testing are available as retainers, and DeployOpen does not publish a price list, so a quote follows from the written scope.

How do tag rollups and retention affect the database?

Daily tag rollups accumulate over time, so the database grows with the number of tags, days and providers. A retention period keeps that growth bounded, but it must be set against chargeback, audit and finance reconciliation needs, since pruned rollups cannot be reproduced later. Ask the team to confirm the retention settings in the LiteLLM documentation for your release, test pruning on a copy of the database and document the dates and owners who approved the retention period. Back up the database before the first pruning run, and monitor storage and query performance after the change.

How DeployOpen scopes and delivers LiteLLM tag budgets

DeployOpen plans tag budgets as part of a self-hosted LiteLLM gateway that runs in your infrastructure, starting from how your cost centers and projects should be named and reported. The work covers tag design, budget configuration, verification against your own spend records, documentation and handover to your team, with ongoing support available as a retainer.

How we scope

  • Agree the tag taxonomy for cost centers, projects, customers and features before any configuration starts.
  • Document which tags are required on each request path and who owns each tag value.
  • Record in the written scope which teams, keys and budgets are covered, and what is excluded.

How we build

  • Configure tag budgets on the LiteLLM proxy backed by PostgreSQL in your environment, following the agreed taxonomy.
  • Test budget enforcement with sample requests per tag, including rejection at the limit and reset behavior.
  • Set up daily tag rollup retention and pruning so stored spend history matches your records policy.

How we hand over

  • Deliver a written runbook covering tag naming rules, budget changes, and how to add a new cost center.
  • Walk your platform and finance owners through reports so they can read tag-level spend independently.
  • Hand over configuration as code with version history, stored in repositories you control.

How we support

  • Offer ongoing support, upgrades and testing as a retainer after handover, covering tag budgets and related gateway settings.
  • Review tag coverage periodically so new projects and requests without tags are caught early.
  • Confirm with your team which provider invoices will be used to check tracked spend before go-live.

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.