@acarmisc/backstage-plugin-litellm 0.28.0 → 0.29.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/api.d.ts +25 -3
- package/dist/budget.d.ts +24 -0
- package/dist/components/AuditLog.d.ts +2 -2
- package/dist/components/BudgetLimitList.d.ts +7 -7
- package/dist/components/DashboardHeader.d.ts +5 -3
- package/dist/components/GenerateKeyButton.d.ts +2 -2
- package/dist/components/GenerateKeyDialog.d.ts +2 -2
- package/dist/components/KeyFormDialog.d.ts +4 -16
- package/dist/components/KeySnippets.d.ts +20 -0
- package/dist/components/KeysTable.d.ts +5 -2
- package/dist/components/LiteLLMBudgetGauges.d.ts +20 -18
- package/dist/components/LiteLLMBudgetWidget.d.ts +14 -3
- package/dist/components/LiteLLMHomeWidget.d.ts +7 -2
- package/dist/components/LiteLLMPage.d.ts +2 -2
- package/dist/components/ModelsTable.d.ts +2 -2
- package/dist/components/TeamUsage.d.ts +4 -2
- package/dist/components/UsageStats.d.ts +4 -2
- package/dist/components/keyFormHelpers.d.ts +14 -0
- package/dist/components/ui/Gauge.d.ts +24 -0
- package/dist/components/ui/Meter.d.ts +13 -0
- package/dist/components/ui/charts.d.ts +34 -0
- package/dist/components/ui/index.d.ts +6 -0
- package/dist/components/ui/pills.d.ts +23 -0
- package/dist/components/ui/surfaces.d.ts +65 -0
- package/dist/components/ui/tokens.d.ts +52 -0
- package/dist/ctas.d.ts +28 -0
- package/dist/dates.d.ts +25 -0
- package/dist/feedback.d.ts +17 -0
- package/dist/format.d.ts +37 -1
- package/dist/homeWidgetHelpers.d.ts +40 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/useCopyToClipboard.d.ts +30 -0
- package/dist/hooks/useLiteLLMProfile.d.ts +32 -0
- package/dist/index.cjs.js +4927 -2811
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.esm.js +4963 -2832
- package/dist/index.esm.js.map +4 -4
- package/dist/keyFilter.d.ts +12 -0
- package/dist/keyFormValidation.d.ts +38 -0
- package/dist/keyLabels.d.ts +16 -0
- package/dist/permissions.d.ts +1 -5
- package/dist/plugin.d.ts +6 -5
- package/dist/profileCache.d.ts +46 -0
- package/dist/routeHelpers.d.ts +6 -0
- package/dist/routes.d.ts +1 -0
- package/dist/types.d.ts +15 -189
- package/dist/unprovisionedCopy.d.ts +7 -0
- package/dist/widgetState.d.ts +54 -0
- package/package.json +5 -2
- package/dist/api.test.d.ts +0 -1
- package/dist/budget.test.d.ts +0 -1
- package/dist/components/ui.d.ts +0 -206
- package/dist/format.test.d.ts +0 -1
- package/dist/permissions.test.d.ts +0 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { FetchApi } from '@backstage/
|
|
1
|
+
import { type FetchApi, type DiscoveryApi } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { UserInfo, VirtualKey, ModelInfo, UsageMetrics, TeamInfo, GenerateKeyRequest, GenerateKeyResponse, UpdateKeyRequest, AuditLogsParams, PaginatedAuditLogs, LiteLlmConfig, VectorStoreInfo, McpServerInfo, CreateTeamRequest, CreateTeamResponse, UpdateTeamRequest } from './types';
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
body: unknown;
|
|
5
|
+
status: number;
|
|
6
|
+
constructor(message: string, status: number, body: unknown);
|
|
7
|
+
}
|
|
3
8
|
export interface LiteLlmApiInterface {
|
|
4
9
|
getUserInfo(): Promise<UserInfo>;
|
|
5
10
|
listKeys(): Promise<VirtualKey[]>;
|
|
@@ -13,6 +18,11 @@ export interface LiteLlmApiInterface {
|
|
|
13
18
|
resetKeySpend(keyId: string): Promise<void>;
|
|
14
19
|
pruneExpiredKeys(): Promise<{
|
|
15
20
|
pruned: number;
|
|
21
|
+
failed: number;
|
|
22
|
+
failures?: {
|
|
23
|
+
keyId: string;
|
|
24
|
+
error: string;
|
|
25
|
+
}[];
|
|
16
26
|
}>;
|
|
17
27
|
listModels(): Promise<ModelInfo[]>;
|
|
18
28
|
getTeams(): Promise<TeamInfo[]>;
|
|
@@ -33,13 +43,20 @@ export interface LiteLlmApiInterface {
|
|
|
33
43
|
createTeam(request: CreateTeamRequest): Promise<CreateTeamResponse>;
|
|
34
44
|
updateTeam(teamId: string, request: UpdateTeamRequest): Promise<TeamInfo>;
|
|
35
45
|
}
|
|
36
|
-
export declare const liteLlmApiRef: import("@backstage/
|
|
46
|
+
export declare const liteLlmApiRef: import("@backstage/frontend-plugin-api").ApiRef<LiteLlmApiInterface> & {
|
|
47
|
+
readonly $$type: "@backstage/ApiRef";
|
|
48
|
+
};
|
|
37
49
|
export type ExpiryStatus = 'expired' | 'soon' | 'ok';
|
|
38
50
|
export declare function expiryStatus(expiresAt?: string): ExpiryStatus | null;
|
|
39
51
|
export declare class LiteLlmApi implements LiteLlmApiInterface {
|
|
40
52
|
private fetchApi;
|
|
53
|
+
private base;
|
|
54
|
+
/**
|
|
55
|
+
* @param base A DiscoveryApi (the plugin base URL is resolved per request via
|
|
56
|
+
* `discoveryApi.getBaseUrl('litellm')`) or a fixed base URL/path string.
|
|
57
|
+
*/
|
|
58
|
+
constructor(fetchApi: FetchApi, base?: string | DiscoveryApi);
|
|
41
59
|
private basePath;
|
|
42
|
-
constructor(fetchApi: FetchApi, basePath?: string);
|
|
43
60
|
private throwIfNotOk;
|
|
44
61
|
private get;
|
|
45
62
|
private post;
|
|
@@ -58,6 +75,11 @@ export declare class LiteLlmApi implements LiteLlmApiInterface {
|
|
|
58
75
|
resetKeySpend(keyId: string): Promise<void>;
|
|
59
76
|
pruneExpiredKeys(): Promise<{
|
|
60
77
|
pruned: number;
|
|
78
|
+
failed: number;
|
|
79
|
+
failures?: {
|
|
80
|
+
keyId: string;
|
|
81
|
+
error: string;
|
|
82
|
+
}[];
|
|
61
83
|
}>;
|
|
62
84
|
getAuditLogs(params: AuditLogsParams): Promise<PaginatedAuditLogs>;
|
|
63
85
|
listModels(): Promise<ModelInfo[]>;
|
package/dist/budget.d.ts
CHANGED
|
@@ -89,3 +89,27 @@ export declare function budgetHeadline(summary: BudgetSummary): {
|
|
|
89
89
|
export declare function fmtBudgetDuration(duration?: string): string | null;
|
|
90
90
|
/** status pill tone + meter tone for a budget at `pct`. */
|
|
91
91
|
export declare function budgetTone(pct: number): Tone;
|
|
92
|
+
/** Budget status for the signed-in user's overall spend vs their cap. */
|
|
93
|
+
export interface UserBudgetKpi {
|
|
94
|
+
/** Total spend in the active budget window (lifetime or reset period). */
|
|
95
|
+
spend: number;
|
|
96
|
+
/** The budget cap, or null if unlimited. */
|
|
97
|
+
max: number | null;
|
|
98
|
+
/** max - spend, clamped at >= 0 for display. Null if unlimited. */
|
|
99
|
+
remaining: number | null;
|
|
100
|
+
/** spend / max * 100, or null if unlimited. Unclamped (can be > 100). */
|
|
101
|
+
pct: number | null;
|
|
102
|
+
/** 'capped' when a budget exists, 'unlimited' otherwise. */
|
|
103
|
+
kind: 'capped' | 'unlimited';
|
|
104
|
+
/**
|
|
105
|
+
* Caption for the KPI. When capped: "resets {formatted reset_at}" if reset_at
|
|
106
|
+
* exists and budget_duration is set, else "lifetime cap". Null if unlimited.
|
|
107
|
+
*/
|
|
108
|
+
resetLabel: string | null;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Compute the user's budget status: spend vs their personal cap.
|
|
112
|
+
* Returns { spend, max, remaining, pct, kind, resetLabel } where remaining
|
|
113
|
+
* is clamped at >= 0 for display purposes but pct and kind reflect the real status.
|
|
114
|
+
*/
|
|
115
|
+
export declare function userBudgetKpi(userInfo: UserInfo | null): UserBudgetKpi;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { LiteLlmApiInterface } from '../api';
|
|
3
3
|
interface AuditLogProps {
|
|
4
4
|
api: LiteLlmApiInterface;
|
|
5
5
|
}
|
|
6
|
-
export declare const AuditLog:
|
|
6
|
+
export declare const AuditLog: FC<AuditLogProps>;
|
|
7
7
|
export {};
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
* `LiteLLMBudgetGauges` (expanded "all limits" view). Keeping the card in one
|
|
5
5
|
* place means a limit reads identically wherever it is shown.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { FC, ReactNode } from 'react';
|
|
8
8
|
import type { Theme } from '@mui/material/styles';
|
|
9
9
|
import { BudgetLimit } from '../budget';
|
|
10
10
|
import { Tone } from './ui';
|
|
11
11
|
/** Semantic colour for a tone, from the host theme. */
|
|
12
12
|
export declare function levelToneColor(tone: Tone | undefined, theme: Theme): string;
|
|
13
13
|
/** Spend-vs-cap meter card for a single limit. */
|
|
14
|
-
export declare const LimitCard:
|
|
14
|
+
export declare const LimitCard: FC<{
|
|
15
15
|
limit: BudgetLimit;
|
|
16
16
|
}>;
|
|
17
17
|
/** A LimitCard prefixed with a small KEY / USER / TEAM tag. */
|
|
18
|
-
export declare const TaggedLimit:
|
|
18
|
+
export declare const TaggedLimit: FC<{
|
|
19
19
|
limit: BudgetLimit;
|
|
20
20
|
}>;
|
|
21
21
|
/** A key-budget note under a limit list — plain text when no href is given. */
|
|
22
|
-
export declare const MoreKeysNote:
|
|
22
|
+
export declare const MoreKeysNote: FC<{
|
|
23
23
|
count: number;
|
|
24
24
|
href?: string;
|
|
25
25
|
label?: string;
|
|
@@ -29,13 +29,13 @@ export declare const MoreKeysNote: React.FC<{
|
|
|
29
29
|
* Used by the condensed gauges card's expanded view; the full widget renders
|
|
30
30
|
* its own grouped-by-level rail instead.
|
|
31
31
|
*/
|
|
32
|
-
export declare const BudgetLimitList:
|
|
32
|
+
export declare const BudgetLimitList: FC<{
|
|
33
33
|
limits: BudgetLimit[];
|
|
34
34
|
/** Keys beyond the supplied limits — rendered as a trailing note. */
|
|
35
35
|
hiddenKeyCount?: number;
|
|
36
36
|
keysHref?: string;
|
|
37
37
|
}>;
|
|
38
38
|
/** Inset panel used to hold a nested list of limits inside a card. */
|
|
39
|
-
export declare const LimitListPanel:
|
|
40
|
-
children:
|
|
39
|
+
export declare const LimitListPanel: FC<{
|
|
40
|
+
children: ReactNode;
|
|
41
41
|
}>;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { UserInfo, TeamInfo, VirtualKey } from '../types';
|
|
3
3
|
interface DashboardHeaderProps {
|
|
4
4
|
userInfo: UserInfo;
|
|
5
5
|
teams: TeamInfo[];
|
|
6
6
|
keys: VirtualKey[];
|
|
7
7
|
loading: boolean;
|
|
8
|
+
keysError?: Error;
|
|
8
9
|
onGenerateKeyClick: () => void;
|
|
10
|
+
onNavigateToFilter?: (filter: 'expired' | 'expiring') => void;
|
|
9
11
|
/** Page tab bar, rendered flush with the bottom edge of the header card. */
|
|
10
|
-
tabs?:
|
|
12
|
+
tabs?: ReactNode;
|
|
11
13
|
}
|
|
12
|
-
export declare const DashboardHeader:
|
|
14
|
+
export declare const DashboardHeader: FC<DashboardHeaderProps>;
|
|
13
15
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* The single "create a key" call-to-action used everywhere in the plugin —
|
|
4
4
|
* the plugin page (header, keys table) and the homepage budget card all
|
|
@@ -19,4 +19,4 @@ export interface GenerateKeyButtonProps {
|
|
|
19
19
|
/** Disabled state (e.g. until the account data loads). A disabled `to` renders inert. */
|
|
20
20
|
disabled?: boolean;
|
|
21
21
|
}
|
|
22
|
-
export declare const GenerateKeyButton:
|
|
22
|
+
export declare const GenerateKeyButton: FC<GenerateKeyButtonProps>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { GenerateKeyRequest, GenerateKeyResponse, LiteLlmConfig, ModelInfo, TeamInfo, VirtualKey } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use {@link KeyFormDialog} with `mode="create"` instead — this
|
|
5
5
|
* wrapper only forwards props for backwards compatibility with the public
|
|
6
6
|
* entrypoint and will be removed in a future release.
|
|
7
7
|
*/
|
|
8
|
-
export declare const GenerateKeyDialog:
|
|
8
|
+
export declare const GenerateKeyDialog: FC<{
|
|
9
9
|
open: boolean;
|
|
10
10
|
onClose: () => void;
|
|
11
11
|
keys: VirtualKey[];
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { VirtualKey, ModelInfo, TeamInfo, GenerateKeyRequest, GenerateKeyResponse, UpdateKeyRequest, LiteLlmConfig } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Single form dialog for both key creation (`mode="create"`) and key editing
|
|
5
|
-
* (`mode="edit"`).
|
|
6
|
-
*
|
|
7
|
-
* Create mode: alias (pre-filled), team, models, duration, budget (+unlimited
|
|
8
|
-
* when gated on), TPM/RPM in the Advanced accordion, and the post-generation
|
|
9
|
-
* screen with copyable key + starter snippets.
|
|
10
|
-
*
|
|
11
|
-
* Edit mode: the same shared fields but no duration (expiry is immutable after
|
|
12
|
-
* creation) and no team switch (LiteLLM /key/update semantics); adds a masked
|
|
13
|
-
* key header and the Danger Zone (reset spend). Budget validation, the
|
|
14
|
-
* unlimited toggle and the team-scoped model filtering behave exactly as they
|
|
15
|
-
* do at creation time.
|
|
16
|
-
*/
|
|
17
3
|
export type KeyFormDialogMode = 'create' | 'edit';
|
|
18
4
|
export interface KeyFormDialogProps {
|
|
19
5
|
open: boolean;
|
|
@@ -24,6 +10,8 @@ export interface KeyFormDialogProps {
|
|
|
24
10
|
keyToEdit?: VirtualKey | null;
|
|
25
11
|
keys: VirtualKey[];
|
|
26
12
|
models: ModelInfo[];
|
|
13
|
+
modelsError?: Error;
|
|
14
|
+
onRetryModels?: () => void;
|
|
27
15
|
teams: TeamInfo[];
|
|
28
16
|
/** Current user's LiteLLM user id, used to pre-fill a default key alias. */
|
|
29
17
|
username?: string;
|
|
@@ -37,6 +25,6 @@ export interface KeyFormDialogProps {
|
|
|
37
25
|
onResetKeySpend?: (keyId: string) => Promise<void>;
|
|
38
26
|
onGetConfig: () => Promise<LiteLlmConfig>;
|
|
39
27
|
}
|
|
40
|
-
export declare const KeyFormDialog:
|
|
28
|
+
export declare const KeyFormDialog: FC<KeyFormDialogProps>;
|
|
41
29
|
export declare function fmtCost(perToken?: number): string | null;
|
|
42
30
|
export declare function formatContextWindow(maxInput?: number, maxOutput?: number): string | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface Snippets {
|
|
3
|
+
curl: string;
|
|
4
|
+
openai: string;
|
|
5
|
+
opencode: string;
|
|
6
|
+
pi: string;
|
|
7
|
+
claudeCode: string;
|
|
8
|
+
publicEndpoint: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildSnippets(baseUrl: string | null, key: string, model: string): Snippets;
|
|
11
|
+
interface SnippetTabsProps {
|
|
12
|
+
snippets: Snippets;
|
|
13
|
+
model: string;
|
|
14
|
+
copyState: {
|
|
15
|
+
copy: (text: string) => Promise<boolean>;
|
|
16
|
+
copied: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare const SnippetTabs: FC<SnippetTabsProps>;
|
|
20
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { type KeyFilterType } from '../keyFilter';
|
|
2
3
|
import { VirtualKey } from '../types';
|
|
3
4
|
interface KeysTableProps {
|
|
4
5
|
keys: VirtualKey[];
|
|
@@ -13,6 +14,8 @@ interface KeysTableProps {
|
|
|
13
14
|
onPruneExpiredKeys: () => Promise<{
|
|
14
15
|
pruned: number;
|
|
15
16
|
}>;
|
|
17
|
+
filter?: KeyFilterType;
|
|
18
|
+
onClearFilter?: () => void;
|
|
16
19
|
}
|
|
17
|
-
export declare const KeysTable:
|
|
20
|
+
export declare const KeysTable: FC<KeysTableProps>;
|
|
18
21
|
export {};
|
|
@@ -22,19 +22,18 @@
|
|
|
22
22
|
* `new-key` CTA renders the shared `GenerateKeyButton`, identical to the
|
|
23
23
|
* one on the plugin page.
|
|
24
24
|
*/
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
kind: BudgetCtaKind;
|
|
30
|
-
/** Override the default label. */
|
|
31
|
-
label?: string;
|
|
32
|
-
}
|
|
33
|
-
/** Either a bare kind (`'module'`) or a spec object (`{ kind: 'module' }`). */
|
|
34
|
-
export type BudgetCta = BudgetCtaKind | BudgetCtaSpec;
|
|
25
|
+
import { FC, ReactNode } from 'react';
|
|
26
|
+
import { UserInfo, TeamInfo, VirtualKey } from '../types';
|
|
27
|
+
import { type BudgetCta } from '../ctas';
|
|
28
|
+
export type { BudgetCtaKind, BudgetCtaSpec, BudgetCta } from '../ctas';
|
|
35
29
|
export interface LiteLLMBudgetGaugesProps {
|
|
36
30
|
/** Optional title override. Defaults to 'Budget'. */
|
|
37
31
|
title?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Render without the card's own chrome and title, for hosts (such as the
|
|
34
|
+
* home page grid) that already provide a titled card. Defaults to false.
|
|
35
|
+
*/
|
|
36
|
+
bare?: boolean;
|
|
38
37
|
/** Ring diameter in px. Defaults to 72. */
|
|
39
38
|
size?: number;
|
|
40
39
|
/** Where the "+N more" key link points. Defaults to the Keys tab. */
|
|
@@ -49,7 +48,7 @@ export interface LiteLLMBudgetGaugesProps {
|
|
|
49
48
|
onCreateKey?: () => void;
|
|
50
49
|
/**
|
|
51
50
|
* Action-bar buttons to render, in order. Defaults to
|
|
52
|
-
* `['
|
|
51
|
+
* `['module', 'all-limits']`; 'new-key' is added automatically for users with no keys. Pass `[]` to hide the bar; the
|
|
53
52
|
* `all-limits` entry is dropped automatically when the user has no limits.
|
|
54
53
|
*/
|
|
55
54
|
ctas?: BudgetCta[];
|
|
@@ -62,11 +61,14 @@ export interface LiteLLMBudgetGaugesProps {
|
|
|
62
61
|
/** Notified whenever the expanded state changes. */
|
|
63
62
|
onExpandedChange?: (expanded: boolean) => void;
|
|
64
63
|
/** Fully custom node pinned below the CTAs, below a divider. */
|
|
65
|
-
action?:
|
|
64
|
+
action?: ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Optional preloaded data to use instead of fetching via the hook.
|
|
67
|
+
* When provided, the component uses these values directly without refetching.
|
|
68
|
+
*/
|
|
69
|
+
userInfo?: UserInfo | null;
|
|
70
|
+
teams?: TeamInfo[];
|
|
71
|
+
keys?: VirtualKey[];
|
|
66
72
|
}
|
|
67
|
-
|
|
68
|
-
export declare
|
|
69
|
-
startDate: string;
|
|
70
|
-
endDate: string;
|
|
71
|
-
};
|
|
72
|
-
export declare const LiteLLMBudgetGauges: React.FC<LiteLLMBudgetGaugesProps>;
|
|
73
|
+
export { monthToDateRange } from '../dates';
|
|
74
|
+
export declare const LiteLLMBudgetGauges: FC<LiteLLMBudgetGaugesProps>;
|
|
@@ -18,8 +18,12 @@
|
|
|
18
18
|
* - `collapsible` folds the body under a one-line summary header.
|
|
19
19
|
* `action` renders a host-supplied node (e.g. a button) pinned to the card
|
|
20
20
|
* bottom, always visible.
|
|
21
|
+
*
|
|
22
|
+
* When user data is passed via props (userInfo, teams, keys), they are used
|
|
23
|
+
* directly without refetching. Otherwise, the hook fetches them.
|
|
21
24
|
*/
|
|
22
|
-
import
|
|
25
|
+
import { FC, ReactNode } from 'react';
|
|
26
|
+
import { UserInfo, TeamInfo, VirtualKey } from '../types';
|
|
23
27
|
export interface LiteLLMBudgetWidgetProps {
|
|
24
28
|
/** Optional title override. Defaults to 'Budget Policy'. */
|
|
25
29
|
title?: string;
|
|
@@ -39,6 +43,13 @@ export interface LiteLLMBudgetWidgetProps {
|
|
|
39
43
|
* collapsible region so it stays visible when collapsed — e.g. a
|
|
40
44
|
* "create key" button.
|
|
41
45
|
*/
|
|
42
|
-
action?:
|
|
46
|
+
action?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Optional preloaded data to use instead of fetching via the hook.
|
|
49
|
+
* When provided, the component uses these values directly without refetching.
|
|
50
|
+
*/
|
|
51
|
+
userInfo?: UserInfo | null;
|
|
52
|
+
teams?: TeamInfo[];
|
|
53
|
+
keys?: VirtualKey[];
|
|
43
54
|
}
|
|
44
|
-
export declare const LiteLLMBudgetWidget:
|
|
55
|
+
export declare const LiteLLMBudgetWidget: FC<LiteLLMBudgetWidgetProps>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export interface LiteLLMHomeWidgetProps {
|
|
3
3
|
/** Default period when the widget mounts. Defaults to '7d'. */
|
|
4
4
|
defaultPeriod?: 'today' | '7d' | '30d';
|
|
5
5
|
/** Optional title override. Defaults to 'LiteLLM Usage'. */
|
|
6
6
|
title?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Render without the widget's own card chrome and title, for hosts (such as
|
|
9
|
+
* the home page grid) that already provide a titled card. Defaults to false.
|
|
10
|
+
*/
|
|
11
|
+
bare?: boolean;
|
|
7
12
|
}
|
|
8
|
-
export declare const LiteLLMHomeWidget:
|
|
13
|
+
export declare const LiteLLMHomeWidget: FC<LiteLLMHomeWidgetProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const LiteLLMPage:
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export declare const LiteLLMPage: FC;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { ModelInfo, TeamInfo } from '../types';
|
|
3
3
|
interface ModelsTableProps {
|
|
4
4
|
allModels: ModelInfo[];
|
|
5
5
|
teams: TeamInfo[];
|
|
6
6
|
loading: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare const ModelsTable:
|
|
8
|
+
export declare const ModelsTable: FC<ModelsTableProps>;
|
|
9
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { TeamInfo, UsageMetrics } from '../types';
|
|
3
3
|
interface TeamUsageProps {
|
|
4
4
|
teams: TeamInfo[];
|
|
@@ -10,6 +10,8 @@ interface TeamUsageProps {
|
|
|
10
10
|
/** When true (with `onCreateTeam`), a "Create Team" action renders in the section header. */
|
|
11
11
|
canCreate?: boolean;
|
|
12
12
|
onCreateTeam?: () => void;
|
|
13
|
+
/** Called when a team card is expanded to trigger data loading. */
|
|
14
|
+
onTeamExpand?: (team: TeamInfo) => void;
|
|
13
15
|
}
|
|
14
|
-
export declare const TeamUsage:
|
|
16
|
+
export declare const TeamUsage: FC<TeamUsageProps>;
|
|
15
17
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DateRange, UsageMetrics, ModelInfo, UserInfo } from '../types';
|
|
3
3
|
interface UsageStatsProps {
|
|
4
4
|
usage: UsageMetrics | null;
|
|
5
|
+
usageError?: Error;
|
|
6
|
+
onRetryUsage?: () => void;
|
|
5
7
|
models: ModelInfo[];
|
|
6
8
|
dateRange: DateRange;
|
|
7
9
|
currentPreset: DatePreset;
|
|
@@ -10,5 +12,5 @@ interface UsageStatsProps {
|
|
|
10
12
|
userInfo?: UserInfo;
|
|
11
13
|
}
|
|
12
14
|
type DatePreset = 'today' | '24h' | '7d' | '30d';
|
|
13
|
-
export declare const UsageStats:
|
|
15
|
+
export declare const UsageStats: FC<UsageStatsProps>;
|
|
14
16
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VirtualKey, ModelInfo, GenerateKeyRequest, UpdateKeyRequest } from '../types';
|
|
2
|
+
export declare const generateDefaultAlias: (username?: string) => string;
|
|
3
|
+
export declare const createForm: (username?: string) => GenerateKeyRequest;
|
|
4
|
+
export declare const editForm: (k: VirtualKey) => UpdateKeyRequest;
|
|
5
|
+
export declare function isModelAllowedByTeam(model: ModelInfo, teamModels?: string[]): boolean;
|
|
6
|
+
export declare function aliasHelperText(aliasError: boolean, aliasDuplicate: boolean): string | undefined;
|
|
7
|
+
export declare function teamHelperText(teamError: boolean, teamRequired: boolean): string;
|
|
8
|
+
export declare function budgetHelperText(budgetInvalid: boolean, budgetEstimate: number | null, unlimited: boolean): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The fields of an edit that actually changed. Sending only these means an
|
|
11
|
+
* untouched field (say a legacy budget above the current ceiling) can't make an
|
|
12
|
+
* unrelated edit fail server-side validation. Returns `{}` when nothing changed.
|
|
13
|
+
*/
|
|
14
|
+
export declare function changedEditFields(original: UpdateKeyRequest, current: UpdateKeyRequest, unlimitedBudget: boolean): UpdateKeyRequest;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { type Tone } from './tokens';
|
|
3
|
+
/**
|
|
4
|
+
* Ring gauge for at-a-glance ratios. Hand-drawn SVG rather than MUI's
|
|
5
|
+
* `CircularProgress`: the track has to stay a neutral hairline (MUI tints it
|
|
6
|
+
* from the bar colour, so an empty ring reads as full), and the value may
|
|
7
|
+
* legitimately exceed 100% — the arc clamps at a full turn while the centre
|
|
8
|
+
* label keeps the real number.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Gauge: FC<{
|
|
11
|
+
/** Share consumed, 0..100+ (unclamped for the label). */
|
|
12
|
+
value: number;
|
|
13
|
+
tone?: Tone;
|
|
14
|
+
/** Outer diameter in px. */
|
|
15
|
+
size?: number;
|
|
16
|
+
/** Ring thickness in px. */
|
|
17
|
+
thickness?: number;
|
|
18
|
+
/** Centre content; defaults to the rounded percentage. */
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
/** Small caption under the value, inside the ring. */
|
|
21
|
+
caption?: ReactNode;
|
|
22
|
+
/** Optional aria-label for accessibility. */
|
|
23
|
+
ariaLabel?: string;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { type Tone } from './tokens';
|
|
3
|
+
/**
|
|
4
|
+
* Progress meter with an explicitly drawn track. MUI's `LinearProgress` tints
|
|
5
|
+
* its track from the bar colour, which makes an empty bar look full.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Meter: FC<{
|
|
8
|
+
value: number;
|
|
9
|
+
tone?: Tone;
|
|
10
|
+
height?: number;
|
|
11
|
+
/** Optional aria-label for accessibility. */
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface ChartTooltipProps {
|
|
3
|
+
active?: boolean;
|
|
4
|
+
label?: string | number;
|
|
5
|
+
payload?: Array<{
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
dataKey?: string | number;
|
|
10
|
+
}>;
|
|
11
|
+
/** Formats each series value; defaults to a localised integer. */
|
|
12
|
+
valueFormatter?: (value: number) => string;
|
|
13
|
+
/** Formats the header; defaults to the short date form. */
|
|
14
|
+
labelFormatter?: (label: string) => string;
|
|
15
|
+
/** Drop zero-valued series — useful for stacked charts with many series. */
|
|
16
|
+
hideZero?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Recharts' default tooltip is an opaque white card with a hard border — it
|
|
20
|
+
* disappears on dark themes. This one uses the theme's own surface tokens.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ChartTooltip: FC<ChartTooltipProps>;
|
|
23
|
+
/**
|
|
24
|
+
* Colour key rendered outside the SVG. Recharts' own `<Legend>` cannot ellipsize,
|
|
25
|
+
* so a handful of fully-qualified model names ("bedrock/eu.anthropic.…") wrap
|
|
26
|
+
* into a ragged block that eats the plot area.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SeriesLegend: FC<{
|
|
29
|
+
series: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
color: string;
|
|
32
|
+
}>;
|
|
33
|
+
}>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { type Tone } from './tokens';
|
|
4
|
+
/**
|
|
5
|
+
* A soft status badge. Deliberately *not* MUI's filled `Chip` — host themes
|
|
6
|
+
* tend to render those as saturated pills, and a table with one screaming
|
|
7
|
+
* orange pill per row is unreadable. Tinted background, hairline border,
|
|
8
|
+
* squared-off corners.
|
|
9
|
+
*/
|
|
10
|
+
export declare const StatusPill: FC<{
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
tone?: Tone;
|
|
13
|
+
/** Show the leading tone dot. */
|
|
14
|
+
dot?: boolean;
|
|
15
|
+
title?: string;
|
|
16
|
+
sx?: SxProps<Theme>;
|
|
17
|
+
}>;
|
|
18
|
+
/** Quiet monospace tag for identifiers: model names, team slugs, roles. */
|
|
19
|
+
export declare const TagChip: FC<{
|
|
20
|
+
label: ReactNode;
|
|
21
|
+
title?: string;
|
|
22
|
+
mono?: boolean;
|
|
23
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
import { type Tone } from './tokens';
|
|
4
|
+
/** Page-level surface with a consistent title row. */
|
|
5
|
+
export declare const SectionCard: FC<{
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
subtitle?: ReactNode;
|
|
8
|
+
actions?: ReactNode;
|
|
9
|
+
/** Set when the body renders its own edge-to-edge content (e.g. a table). */
|
|
10
|
+
flush?: boolean;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
/** Bordered frame around a single chart, with its own caption row. */
|
|
14
|
+
export declare const ChartCard: FC<{
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
meta?: ReactNode;
|
|
17
|
+
height?: number;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}>;
|
|
20
|
+
export interface MetricDef {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
hint?: string;
|
|
24
|
+
tone?: Tone;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* KPI row rendered as one framed strip divided into cells, rather than four
|
|
28
|
+
* loose cards. Cells share a baseline grid so the numbers line up even when
|
|
29
|
+
* only some of them carry a hint.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MetricStrip: FC<{
|
|
32
|
+
metrics: MetricDef[];
|
|
33
|
+
}>;
|
|
34
|
+
/** Label + value pair used inside cards. */
|
|
35
|
+
export declare const Stat: FC<{
|
|
36
|
+
label: string;
|
|
37
|
+
value: ReactNode;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Secondary navigation inside a card. Hand-rolled rather than a second set of
|
|
41
|
+
* `Tabs` so it reads as subordinate to the page tabs instead of competing
|
|
42
|
+
* with them, and so host theme overrides on `MuiTab` don't leak in.
|
|
43
|
+
*/
|
|
44
|
+
export declare function SegmentedControl<T extends string>({ value, onChange, options, }: {
|
|
45
|
+
value: T;
|
|
46
|
+
onChange: (value: T) => void;
|
|
47
|
+
options: Array<{
|
|
48
|
+
value: T;
|
|
49
|
+
label: string;
|
|
50
|
+
}>;
|
|
51
|
+
}): import("react").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Shared table chrome: quiet uppercase headers, hairline row rules, a hover
|
|
54
|
+
* highlight, and tabular figures so numeric columns align.
|
|
55
|
+
*/
|
|
56
|
+
export declare const dataTableSx: SxProps<Theme>;
|
|
57
|
+
/** Muted icon button that only picks up its semantic colour on hover. */
|
|
58
|
+
export declare const quietIconButtonSx: (tone?: Tone) => SxProps<Theme>;
|
|
59
|
+
/** Centered empty / loading state for a card body. */
|
|
60
|
+
export declare const EmptyState: FC<{
|
|
61
|
+
message: string;
|
|
62
|
+
hint?: string;
|
|
63
|
+
height?: number;
|
|
64
|
+
action?: ReactNode;
|
|
65
|
+
}>;
|