Repository navigation
Conversation
An API key can now be limited to a list of models, given an expiry date, rate-limited by requests and tokens per minute, and capped by a token or cost budget per day, per month or in total. As in LiteLLM's open-source proxy these limits are free; they live in internal/keygov with a spend ledger (spend.db) that counts every metered request against its key, its owner and the owner's team. The Enterprise part, gated by feature.lite.budgets, is budgets for users and teams, counted across every key and the web UI, and the warning at 80% of any budget (X-CSGLite-Budget-Warning, and a flag in list responses). Only that lives in ee/budget. Inference requests past a limit are refused before they run: 401 api_key_expired, 403 model_not_allowed, 429 budget_exceeded or 429 rate_limited with Retry-After. /v1/models lists only allowed models. Anyone may restrict a key they create; afterwards only an administrator changes limits, so a member cannot lift what was set for them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A member, like an internal user in LiteLLM, uses the instance rather than running it, so the dashboard, apps, models and datasets are for administrators and auditors. A member who opens one of those pages is taken to chat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The member page had an always-visible name field; it now opens the same dialog the AI gateway uses, shared as CreateKeyDialog, which also lets a member add optional limits to their own key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
E2 of the EE plan. Split the same way as E1, following LiteLLM's open-source proxy: limits on a key are free, and budgets that span people are Enterprise.
Free (Apache-2.0,
internal/keygov) — per API key:Qwen/*prefix matching);/v1/modelslists only thoseEnterprise (
ee/budget,feature.lite.budgets):X-CSGLite-Budget-Warning: key=85%, team=92%on responses,spend.warningin list responses, amber marker in the UIHow it works
~/.csghub-lite/spend.dbagainst its key, its owner and the owner's team (per local day and currency). Deleting and recreating a key does not reset a user's or team's budget.401 api_key_expired,403 model_not_allowed,429 budget_exceeded,429 rate_limitedwithRetry-After. OpenAI/Anthropic routes put the code inerror.type, Ollama routes incode.PUT /api/api-keys/{id}). Members can only rename.API
PUT /api/api-keys/{id}: rename a key or replace its limitsPOST /api/api-keys: now acceptslimitsPUT /api/team/users/{id}/budget,PUT /api/team/teams/{id}/budget: Enterpriselimits/budget,spendandstatusOpenAPI is updated and the static copy is in sync.
UI
Docs
docs/guides/key-governance.mdteam-management.md,ee-license-design.mdandee/README.mdTest plan
go test ./...passesinternal/keygov: limits, ledger, limiteree/budgetinternal/server/key_governance_test.go: allowlist, rate limit, expiry, key budget, admin-only limit changes, unlicensed 403, user/team warning and exhaustion, spend attribution, model list filtering, body peeking for JSON and multipartnpm testpasses (100 tests, 5 new)tscpasses🤖 Generated with Claude Code