@acarmisc/backstage-plugin-litellm 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/LiteLLMBudgetGauges.d.ts +26 -14
- package/dist/homeWidgetHelpers.d.ts +13 -0
- package/dist/index.cjs.js +315 -165
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.esm.js +315 -165
- package/dist/index.esm.js.map +3 -3
- package/package.json +3 -2
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Condensed budget card for a homepage column:
|
|
3
|
-
* enforcement level (key → personal → team)
|
|
4
|
-
*
|
|
5
|
-
* limit nearest its cap; where the full `LiteLLMBudgetWidget` lists every
|
|
6
|
-
* limit as a spend-vs-cap meter, this trades detail for density — a single
|
|
7
|
-
* row with a label and spend figure under each gauge, and the MTD token
|
|
8
|
-
* total under the chart.
|
|
2
|
+
* Condensed budget card for a homepage column: spend KPIs on one line,
|
|
3
|
+
* one inline row per enforcement level (key → personal → team), and a
|
|
4
|
+
* month-to-date daily spend strip, in a fixed card that never reflows.
|
|
9
5
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* The card is deliberately *row*-shaped rather than four side-by-side
|
|
7
|
+
* columns: a four-column grid lets one long key alias widen its track (a
|
|
8
|
+
* `1fr` track is only as narrow as its widest unbreakable content) and lets
|
|
9
|
+
* each column wrap its own number of caption lines, so the text under the
|
|
10
|
+
* rings drifts out of alignment. Rows share three fixed tracks — ring,
|
|
11
|
+
* flexible name, right-aligned amount — so every figure is in the same
|
|
12
|
+
* place and tabular numerals line up, and a long name ellipsizes inside
|
|
13
|
+
* `minmax(0, 1fr)` instead of stretching anything.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Each row shows the limit nearest its cap at that level: the ring carries
|
|
16
|
+
* the percentage, the middle track the level tag, limit name and a short
|
|
17
|
+
* note (over cap, a `+N more` link, or the key id / email), and the right
|
|
18
|
+
* track the spend-vs-cap dollars over the reset window — one caption per
|
|
19
|
+
* fact, so the reset window is never printed twice in a row. Where the full `LiteLLMBudgetWidget` lists every limit as a
|
|
20
|
+
* meter card, this trades detail for density. Gauges are always rendered in
|
|
21
|
+
* the same order, with an empty ring when the user has no cap at that
|
|
22
|
+
* level, so the card keeps a stable shape as data loads and across users.
|
|
23
|
+
*
|
|
24
|
+
* Above the rows sit two inline KPIs — **today spent** (with a
|
|
25
|
+
* day-over-day hint) and month-to-date spend — both derived from the same
|
|
26
|
+
* month-to-date usage call, so the indicator costs no extra request. The
|
|
27
|
+
* usage period is frozen to month-to-date (no period selector): the chart
|
|
28
|
+
* always covers the 1st of the current month through today.
|
|
17
29
|
*
|
|
18
30
|
* The bottom action bar is composable: pass any subset of `ctas` — generate
|
|
19
31
|
* a new key, open the LiteLLM module, or expand the full per-limit list in
|
|
@@ -34,7 +46,7 @@ export interface LiteLLMBudgetGaugesProps {
|
|
|
34
46
|
* home page grid) that already provide a titled card. Defaults to false.
|
|
35
47
|
*/
|
|
36
48
|
bare?: boolean;
|
|
37
|
-
/** Ring diameter in px. Defaults to
|
|
49
|
+
/** Ring diameter in px. Defaults to 56. */
|
|
38
50
|
size?: number;
|
|
39
51
|
/** Where the "+N more" key link points. Defaults to the Keys tab. */
|
|
40
52
|
keysHref?: string;
|
|
@@ -19,6 +19,19 @@ export declare function sparklineAriaLabel(points: Array<{
|
|
|
19
19
|
date: string;
|
|
20
20
|
spend: number;
|
|
21
21
|
}>): string;
|
|
22
|
+
/**
|
|
23
|
+
* Spend recorded on the local calendar day `now` (defaults to today) in a
|
|
24
|
+
* daily-spend series. Days the API omits count as zero — no spend recorded
|
|
25
|
+
* yet — so a chart that simply hasn't seen a request today still answers
|
|
26
|
+
* `$0.00` instead of `undefined`.
|
|
27
|
+
*
|
|
28
|
+
* `now` is overridable so the same helper yields yesterday's figure
|
|
29
|
+
* (`spendOnDay(points, yesterday)`) for a day-over-day hint.
|
|
30
|
+
*/
|
|
31
|
+
export declare function spendOnDay(points: Array<{
|
|
32
|
+
date: string;
|
|
33
|
+
spend: number;
|
|
34
|
+
}>, now?: Date): number;
|
|
22
35
|
/**
|
|
23
36
|
* Format usage metrics as a single summary line: '$X spent · YM in · ZM out'
|
|
24
37
|
* Handles zero usage and undefined values gracefully.
|