import { UserInfo, TeamInfo, VirtualKey } from './types'; import { Tone } from './components/ui'; /** One concrete budget limit the signed-in user is subject to. */ export interface BudgetLimit { kind: 'key' | 'user' | 'team'; /** Display name: key_alias / "Personal budget" / team_alias. */ label: string; /** Secondary identifier: masked key, team_id, etc. */ sublabel?: string; /** Spend cap in USD (> 0 when a cap exists). */ budget: number; /** Spend so far in the current window. */ spend: number; /** Reset window, e.g. "30d". Missing means the budget never resets. */ budgetDuration?: string; /** User-facing warning threshold (soft limit). */ softLimit?: number; /** Share of the cap spent, 0..100+ (unclamped). */ pct: number; /** * True when the backend redacted the dollar amounts (team budget hiding). * `budget`/`spend` are then 0 and only `pct` carries the signal — render * the meter without `$` figures. */ hidden?: boolean; } /** The budgets that apply to the current user, grouped by enforcement level. */ export interface BudgetSummary { /** Budgeted keys, capped at `maxKeys`, closest to the cap first. */ keys: BudgetLimit[]; /** Budgeted keys hidden by the cap. */ hiddenBudgetedKeys: number; /** Every key owned by the user (budgeted or not). */ totalKeyCount: number; /** Personal budget, when one is set (undefined otherwise). */ user?: BudgetLimit; /** Team budgets shared by the user's teams. */ teams: BudgetLimit[]; } /** * Collapses the current user's data into the budget limits that LiteLLM * actually enforces for them: key budgets (top `maxKeys`, closest to the cap * first), then the personal budget (when set), then each team budget. Team * budgets are enforced for every key bound to that team; a key *without* a * team falls back to the owner's personal budget. */ export declare function buildBudgetSummary(user: UserInfo | null, teams: TeamInfo[], keys: VirtualKey[], maxKeys?: number): BudgetSummary; /** * Every concrete limit across all levels, keys first then personal then * teams. The per-level slices are already sorted by proximity to the cap, so * each level's limits stay ordered; this is the flat list for a "show all * limits" view. Keys beyond a display `maxKeys` are not included — build the * summary with a large `maxKeys` when the full list is needed. */ export declare function allBudgetLimits(summary: BudgetSummary): BudgetLimit[]; /** One gauge in the condensed homepage card — a single enforcement level. */ export interface BudgetGauge { kind: 'key' | 'user' | 'team'; /** * The limit of this level nearest its cap, or undefined when the user has * no cap at this level (render an empty gauge). */ limit?: BudgetLimit; /** How many limits apply at this level (1 for a personal budget). */ count: number; } /** * Collapses a `BudgetSummary` to exactly one gauge per enforcement level — * key, user, team — carrying the limit nearest its cap and how many limits * that level holds. Every level is always returned, with `limit` undefined * when the user has no cap there, so the caller can render a stable row. * * Pass a summary built with a large `maxKeys` (e.g. `keys.length`) so the * nearest key is present even when it falls outside the display cap; a key * count hidden by that cap is still reflected in `count`. */ export declare function buildBudgetGauges(summary: BudgetSummary): BudgetGauge[]; /** * One-line summary of a `BudgetSummary`, for a collapsed/compact header: * how many concrete limits the user is subject to, and the one closest to * its cap — kept as the whole `BudgetLimit` so the caller can name its * level (key / personal / team). `closest` is null when there are no limits. */ export declare function budgetHeadline(summary: BudgetSummary): { count: number; closest: BudgetLimit | null; }; /** "30d" → "every 30 days"; "1d" → "daily". Returns null when duration is unset. */ export declare function fmtBudgetDuration(duration?: string): string | null; /** status pill tone + meter tone for a budget at `pct`. */ export declare function budgetTone(pct: number): Tone;