@acarmisc/backstage-plugin-litellm 0.10.2 → 0.12.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/README.md +57 -0
- package/dist/components/DashboardHeader.d.ts +3 -1
- package/dist/components/GenerateKeyDialog.d.ts +20 -0
- package/dist/components/KeysTable.d.ts +3 -5
- package/dist/index.cjs.js +560 -397
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.esm.js +564 -388
- package/dist/index.esm.js.map +4 -4
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @acarmisc/backstage-plugin-litellm
|
|
2
|
+
|
|
3
|
+
Frontend for the **Backstage LiteLLM Governance Plugin** — lets developers manage LiteLLM virtual API keys and monitor AI model usage directly from Backstage.
|
|
4
|
+
|
|
5
|
+
Built with the [New Frontend System](https://backstage.io/docs/frontend-system/) (`@backstage/frontend-plugin-api`) and Material-UI.
|
|
6
|
+
|
|
7
|
+
Pair this package with the backend, [`@acarmisc/backstage-plugin-litellm-backend`](https://www.npmjs.com/package/@acarmisc/backstage-plugin-litellm-backend), which proxies requests to your LiteLLM instance and resolves Backstage identity.
|
|
8
|
+
|
|
9
|
+
Full setup docs, configuration reference, and architecture notes live in the [project README](https://github.com/acarmisc/backstage-plugin-litellm-govai#readme).
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
This plugin is designed to be used **within a Backstage monorepo**.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn add --cwd packages/app @acarmisc/backstage-plugin-litellm
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
You'll also need the backend package installed and configured — see its [README](https://www.npmjs.com/package/@acarmisc/backstage-plugin-litellm-backend) for `app-config.yaml` setup.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Full page
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { litellmPlugin, LiteLLMPage } from '@acarmisc/backstage-plugin-litellm';
|
|
27
|
+
|
|
28
|
+
// packages/app/src/App.tsx
|
|
29
|
+
<Route path="/litellm" element={<LiteLLMPage />} />
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Home page widget
|
|
33
|
+
|
|
34
|
+
`LiteLLMHomeWidget` is a compact card for the Backstage homepage. It shows the signed-in user's own usage — identity is resolved server-side from the Backstage token, so no `userId` prop is required.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { LiteLLMHomeWidget } from '@acarmisc/backstage-plugin-litellm';
|
|
38
|
+
|
|
39
|
+
<LiteLLMHomeWidget defaultPeriod="7d" />
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|------|------|---------|-------------|
|
|
44
|
+
| `defaultPeriod` | `'today' \| '7d' \| '30d'` | `'7d'` | Period shown on first render |
|
|
45
|
+
| `title` | `string` | `'LiteLLM Usage'` | Card title override |
|
|
46
|
+
|
|
47
|
+
## Exports
|
|
48
|
+
|
|
49
|
+
- `litellmPlugin` — the frontend plugin instance
|
|
50
|
+
- `LiteLLMPage` — main plugin page (keys, usage, team context)
|
|
51
|
+
- `LiteLLMHomeWidget` — homepage usage summary card
|
|
52
|
+
- `DashboardHeader`, `KeysTable`, `UsageStats`, `TeamUsage` — individual page sections, exported for composition
|
|
53
|
+
- `LiteLlmApi`, `liteLlmApiRef` — API client and its Backstage API ref
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
Apache-2.0
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { UserInfo, TeamInfo } from '../types';
|
|
2
|
+
import { UserInfo, TeamInfo, VirtualKey } from '../types';
|
|
3
3
|
interface DashboardHeaderProps {
|
|
4
4
|
userInfo: UserInfo;
|
|
5
5
|
teams: TeamInfo[];
|
|
6
|
+
keys: VirtualKey[];
|
|
6
7
|
loading: boolean;
|
|
8
|
+
onGenerateKeyClick: () => void;
|
|
7
9
|
}
|
|
8
10
|
export declare const DashboardHeader: React.FC<DashboardHeaderProps>;
|
|
9
11
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { VirtualKey, ModelInfo, TeamInfo, GenerateKeyRequest, GenerateKeyResponse, LiteLlmConfig } from '../types';
|
|
3
|
+
interface GenerateKeyDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
keys: VirtualKey[];
|
|
7
|
+
models: ModelInfo[];
|
|
8
|
+
teams: TeamInfo[];
|
|
9
|
+
/** Current user's LiteLLM user id, used to pre-fill a default key alias. */
|
|
10
|
+
username?: string;
|
|
11
|
+
/** Controls for the "Generate New Key" form; see litellm.keyGeneration in app-config.yaml. */
|
|
12
|
+
keyGenerationSettings?: {
|
|
13
|
+
allowUnlimitedBudget: boolean;
|
|
14
|
+
teamRequired: boolean;
|
|
15
|
+
};
|
|
16
|
+
onGenerateKey: (request: GenerateKeyRequest) => Promise<GenerateKeyResponse>;
|
|
17
|
+
onGetConfig: () => Promise<LiteLlmConfig>;
|
|
18
|
+
}
|
|
19
|
+
export declare const GenerateKeyDialog: React.FC<GenerateKeyDialogProps>;
|
|
20
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { VirtualKey, ModelInfo,
|
|
2
|
+
import { VirtualKey, ModelInfo, UpdateKeyRequest } from '../types';
|
|
3
3
|
interface KeysTableProps {
|
|
4
4
|
keys: VirtualKey[];
|
|
5
5
|
models: ModelInfo[];
|
|
6
|
-
|
|
6
|
+
/** Opens the shared "Generate New Key" dialog (rendered at page level). */
|
|
7
|
+
onGenerateKeyClick: () => void;
|
|
7
8
|
loading: boolean;
|
|
8
|
-
onGenerateKey: (request: GenerateKeyRequest) => Promise<GenerateKeyResponse>;
|
|
9
9
|
onUpdateKey: (keyId: string, request: UpdateKeyRequest) => Promise<void>;
|
|
10
10
|
onBlockKey: (keyId: string) => Promise<void>;
|
|
11
11
|
onUnblockKey: (keyId: string) => Promise<void>;
|
|
@@ -14,8 +14,6 @@ interface KeysTableProps {
|
|
|
14
14
|
onPruneExpiredKeys: () => Promise<{
|
|
15
15
|
pruned: number;
|
|
16
16
|
}>;
|
|
17
|
-
/** Resolve the public LiteLLM proxy URL, used for ready-to-paste snippets. */
|
|
18
|
-
onGetConfig: () => Promise<LiteLlmConfig>;
|
|
19
17
|
}
|
|
20
18
|
export declare const KeysTable: React.FC<KeysTableProps>;
|
|
21
19
|
export {};
|