Skip to content

Per-API-key budget limits for the LLM API #2308

Closed

Description

@yannickmonney

Problem

Budget / spend limits can be set at user, team, role and organization scope, but not for an individual API key. Consumption made through a specific API key cannot be capped or isolated.

Change

  • Add an apiKeyId dimension to the usage ledger so per-key consumption is measurable.
  • Add an apiKey budget scope (targeting a specific key) to the governance budget schema, with a versioned migration.
  • Enforce it in the OpenAI-compatible request path (/api/v1/chat/completions).
  • Surface it in the budgets UI (scope = API key → key picker).

Acceptance

  • An admin can attach a budget to a single API key.
  • Two keys owned by the same user have independent, enforced budgets (key A capped → rejected; key B still works).
  • User/team/org budgets unaffected; migration present; bun run check green.

Branch: feat/compliance-must-requirements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featservice: platform

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions