@camunda/ccma-api 0.0.1

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.
Files changed (199) hide show
  1. package/dist/index.d.ts +97 -0
  2. package/dist/index.js +153 -0
  3. package/dist/index.js.map +7 -0
  4. package/dist/services/accounts/accounts.data-export.service.d.ts +13 -0
  5. package/dist/services/accounts/accounts.data-export.service.js +41 -0
  6. package/dist/services/accounts/accounts.data-export.service.js.map +7 -0
  7. package/dist/services/accounts/accounts.valuemetrics.service.d.ts +8 -0
  8. package/dist/services/accounts/accounts.valuemetrics.service.js +1 -0
  9. package/dist/services/accounts/accounts.valuemetrics.service.js.map +7 -0
  10. package/dist/services/accounts/bot.service.d.ts +21 -0
  11. package/dist/services/accounts/bot.service.js +74 -0
  12. package/dist/services/accounts/bot.service.js.map +7 -0
  13. package/dist/services/accounts/challenge.service.d.ts +296 -0
  14. package/dist/services/accounts/challenge.service.js +475 -0
  15. package/dist/services/accounts/challenge.service.js.map +7 -0
  16. package/dist/services/accounts/connections.service.d.ts +27 -0
  17. package/dist/services/accounts/connections.service.js +41 -0
  18. package/dist/services/accounts/connections.service.js.map +7 -0
  19. package/dist/services/accounts/dashboards.service.d.ts +8 -0
  20. package/dist/services/accounts/dashboards.service.js +42 -0
  21. package/dist/services/accounts/dashboards.service.js.map +7 -0
  22. package/dist/services/accounts/early-access-features.service.d.ts +34 -0
  23. package/dist/services/accounts/early-access-features.service.js +67 -0
  24. package/dist/services/accounts/early-access-features.service.js.map +7 -0
  25. package/dist/services/accounts/genericCache.service.d.ts +13 -0
  26. package/dist/services/accounts/genericCache.service.js +80 -0
  27. package/dist/services/accounts/genericCache.service.js.map +7 -0
  28. package/dist/services/accounts/hdp.service.d.ts +52 -0
  29. package/dist/services/accounts/hdp.service.js +180 -0
  30. package/dist/services/accounts/hdp.service.js.map +7 -0
  31. package/dist/services/accounts/offboarding.service.d.ts +18 -0
  32. package/dist/services/accounts/offboarding.service.js +48 -0
  33. package/dist/services/accounts/offboarding.service.js.map +7 -0
  34. package/dist/services/accounts/organization-members.service.d.ts +68 -0
  35. package/dist/services/accounts/organization-members.service.js +216 -0
  36. package/dist/services/accounts/organization-members.service.js.map +7 -0
  37. package/dist/services/accounts/orgs.service.d.ts +273 -0
  38. package/dist/services/accounts/orgs.service.js +978 -0
  39. package/dist/services/accounts/orgs.service.js.map +7 -0
  40. package/dist/services/accounts/salesplan.service.d.ts +7 -0
  41. package/dist/services/accounts/salesplan.service.js +40 -0
  42. package/dist/services/accounts/salesplan.service.js.map +7 -0
  43. package/dist/services/accounts/spam-detection.service.d.ts +8 -0
  44. package/dist/services/accounts/spam-detection.service.js +72 -0
  45. package/dist/services/accounts/spam-detection.service.js.map +7 -0
  46. package/dist/services/accounts/stats.service.d.ts +7 -0
  47. package/dist/services/accounts/stats.service.js +40 -0
  48. package/dist/services/accounts/stats.service.js.map +7 -0
  49. package/dist/services/accounts/teams.service.d.ts +85 -0
  50. package/dist/services/accounts/teams.service.js +516 -0
  51. package/dist/services/accounts/teams.service.js.map +7 -0
  52. package/dist/services/accounts/usage-alerts.service.d.ts +34 -0
  53. package/dist/services/accounts/usage-alerts.service.js +112 -0
  54. package/dist/services/accounts/usage-alerts.service.js.map +7 -0
  55. package/dist/services/accounts/users.service.d.ts +101 -0
  56. package/dist/services/accounts/users.service.js +444 -0
  57. package/dist/services/accounts/users.service.js.map +7 -0
  58. package/dist/services/alerts/alerts.service.d.ts +59 -0
  59. package/dist/services/alerts/alerts.service.js +234 -0
  60. package/dist/services/alerts/alerts.service.js.map +7 -0
  61. package/dist/services/analytic-bridge/analytic-bridge.service.d.ts +23 -0
  62. package/dist/services/analytic-bridge/analytic-bridge.service.js +86 -0
  63. package/dist/services/analytic-bridge/analytic-bridge.service.js.map +7 -0
  64. package/dist/services/audit-logger/audit-logger.service.d.ts +27 -0
  65. package/dist/services/audit-logger/audit-logger.service.js +108 -0
  66. package/dist/services/audit-logger/audit-logger.service.js.map +7 -0
  67. package/dist/services/auth0/auth0.service.d.ts +15 -0
  68. package/dist/services/auth0/auth0.service.js +40 -0
  69. package/dist/services/auth0/auth0.service.js.map +7 -0
  70. package/dist/services/comm-bridge/comm-bridge.service.d.ts +33 -0
  71. package/dist/services/comm-bridge/comm-bridge.service.js +40 -0
  72. package/dist/services/comm-bridge/comm-bridge.service.js.map +7 -0
  73. package/dist/services/console/console.admin.service.d.ts +328 -0
  74. package/dist/services/console/console.admin.service.js +1526 -0
  75. package/dist/services/console/console.admin.service.js.map +7 -0
  76. package/dist/services/console/console.alerts.service.d.ts +69 -0
  77. package/dist/services/console/console.alerts.service.js +160 -0
  78. package/dist/services/console/console.alerts.service.js.map +7 -0
  79. package/dist/services/console/console.api-clients.service.d.ts +48 -0
  80. package/dist/services/console/console.api-clients.service.js +123 -0
  81. package/dist/services/console/console.api-clients.service.js.map +7 -0
  82. package/dist/services/console/console.backup-schedule.service.d.ts +21 -0
  83. package/dist/services/console/console.backup-schedule.service.js +67 -0
  84. package/dist/services/console/console.backup-schedule.service.js.map +7 -0
  85. package/dist/services/console/console.byok-scripts.service.d.ts +12 -0
  86. package/dist/services/console/console.byok-scripts.service.js +92 -0
  87. package/dist/services/console/console.byok-scripts.service.js.map +7 -0
  88. package/dist/services/console/console.byom-monitoring.service.d.ts +58 -0
  89. package/dist/services/console/console.byom-monitoring.service.js +177 -0
  90. package/dist/services/console/console.byom-monitoring.service.js.map +7 -0
  91. package/dist/services/console/console.cluster-clients.service.d.ts +55 -0
  92. package/dist/services/console/console.cluster-clients.service.js +123 -0
  93. package/dist/services/console/console.cluster-clients.service.js.map +7 -0
  94. package/dist/services/console/console.cluster-parameters.service.d.ts +64 -0
  95. package/dist/services/console/console.cluster-parameters.service.js +39 -0
  96. package/dist/services/console/console.cluster-parameters.service.js.map +7 -0
  97. package/dist/services/console/console.cluster.service.d.ts +114 -0
  98. package/dist/services/console/console.cluster.service.js +271 -0
  99. package/dist/services/console/console.cluster.service.js.map +7 -0
  100. package/dist/services/console/console.clusterBulkOperation.service.d.ts +20 -0
  101. package/dist/services/console/console.clusterBulkOperation.service.js +199 -0
  102. package/dist/services/console/console.clusterBulkOperation.service.js.map +7 -0
  103. package/dist/services/console/console.clusterplan.modification.service.d.ts +33 -0
  104. package/dist/services/console/console.clusterplan.modification.service.js +231 -0
  105. package/dist/services/console/console.clusterplan.modification.service.js.map +7 -0
  106. package/dist/services/console/console.clusterplan.service.d.ts +21 -0
  107. package/dist/services/console/console.clusterplan.service.js +64 -0
  108. package/dist/services/console/console.clusterplan.service.js.map +7 -0
  109. package/dist/services/console/console.connector-secrets.service.d.ts +30 -0
  110. package/dist/services/console/console.connector-secrets.service.js +125 -0
  111. package/dist/services/console/console.connector-secrets.service.js.map +7 -0
  112. package/dist/services/console/console.custommetrics.service.d.ts +10 -0
  113. package/dist/services/console/console.custommetrics.service.js +43 -0
  114. package/dist/services/console/console.custommetrics.service.js.map +7 -0
  115. package/dist/services/console/console.hotbackups.service.d.ts +34 -0
  116. package/dist/services/console/console.hotbackups.service.js +120 -0
  117. package/dist/services/console/console.hotbackups.service.js.map +7 -0
  118. package/dist/services/console/console.ip-whitelist.service.d.ts +15 -0
  119. package/dist/services/console/console.ip-whitelist.service.js +36 -0
  120. package/dist/services/console/console.ip-whitelist.service.js.map +7 -0
  121. package/dist/services/console/console.jobs.saas.service.d.ts +70 -0
  122. package/dist/services/console/console.jobs.saas.service.js +139 -0
  123. package/dist/services/console/console.jobs.saas.service.js.map +7 -0
  124. package/dist/services/console/console.jobs.sm.service.d.ts +57 -0
  125. package/dist/services/console/console.jobs.sm.service.js +208 -0
  126. package/dist/services/console/console.jobs.sm.service.js.map +7 -0
  127. package/dist/services/console/console.m2m.service.d.ts +23 -0
  128. package/dist/services/console/console.m2m.service.js +94 -0
  129. package/dist/services/console/console.m2m.service.js.map +7 -0
  130. package/dist/services/console/console.secure-connectivity.service.d.ts +41 -0
  131. package/dist/services/console/console.secure-connectivity.service.js +129 -0
  132. package/dist/services/console/console.secure-connectivity.service.js.map +7 -0
  133. package/dist/services/console/console.valuemetrics.service.d.ts +17 -0
  134. package/dist/services/console/console.valuemetrics.service.js +110 -0
  135. package/dist/services/console/console.valuemetrics.service.js.map +7 -0
  136. package/dist/services/console/generation.service.d.ts +21 -0
  137. package/dist/services/console/generation.service.js +106 -0
  138. package/dist/services/console/generation.service.js.map +7 -0
  139. package/dist/services/github/github.service.d.ts +73 -0
  140. package/dist/services/github/github.service.js +272 -0
  141. package/dist/services/github/github.service.js.map +7 -0
  142. package/dist/services/hibob/hibob.service.d.ts +74 -0
  143. package/dist/services/hibob/hibob.service.js +125 -0
  144. package/dist/services/hibob/hibob.service.js.map +7 -0
  145. package/dist/services/hubspot/hubspot.service.d.ts +50 -0
  146. package/dist/services/hubspot/hubspot.service.js +119 -0
  147. package/dist/services/hubspot/hubspot.service.js.map +7 -0
  148. package/dist/services/litellm/litellm.service.d.ts +290 -0
  149. package/dist/services/litellm/litellm.service.js +392 -0
  150. package/dist/services/litellm/litellm.service.js.map +7 -0
  151. package/dist/services/login/login.service.d.ts +15 -0
  152. package/dist/services/login/login.service.js +66 -0
  153. package/dist/services/login/login.service.js.map +7 -0
  154. package/dist/services/mixpanel/mixpanel.service.d.ts +16 -0
  155. package/dist/services/mixpanel/mixpanel.service.js +86 -0
  156. package/dist/services/mixpanel/mixpanel.service.js.map +7 -0
  157. package/dist/services/notifications/notifications.service.d.ts +7 -0
  158. package/dist/services/notifications/notifications.service.js +38 -0
  159. package/dist/services/notifications/notifications.service.js.map +7 -0
  160. package/dist/services/slack/slack-blockkit.service.d.ts +28 -0
  161. package/dist/services/slack/slack-blockkit.service.js +45 -0
  162. package/dist/services/slack/slack-blockkit.service.js.map +7 -0
  163. package/dist/services/slack/slack.service.d.ts +31 -0
  164. package/dist/services/slack/slack.service.js +118 -0
  165. package/dist/services/slack/slack.service.js.map +7 -0
  166. package/dist/services/telemetry/telemetry.service.d.ts +16 -0
  167. package/dist/services/telemetry/telemetry.service.js +85 -0
  168. package/dist/services/telemetry/telemetry.service.js.map +7 -0
  169. package/dist/services/token-issuer/token-issuer.jwks.service.d.ts +13 -0
  170. package/dist/services/token-issuer/token-issuer.jwks.service.js +76 -0
  171. package/dist/services/token-issuer/token-issuer.jwks.service.js.map +7 -0
  172. package/dist/services/wordpress/wordpress.service.d.ts +15 -0
  173. package/dist/services/wordpress/wordpress.service.js +111 -0
  174. package/dist/services/wordpress/wordpress.service.js.map +7 -0
  175. package/dist/types/general.types.d.ts +61 -0
  176. package/dist/types/general.types.js +1 -0
  177. package/dist/types/general.types.js.map +7 -0
  178. package/dist/utils/api.d.ts +31 -0
  179. package/dist/utils/api.js +400 -0
  180. package/dist/utils/api.js.map +7 -0
  181. package/dist/utils/cache.d.ts +7 -0
  182. package/dist/utils/cache.js +25 -0
  183. package/dist/utils/cache.js.map +7 -0
  184. package/dist/utils/ccma-metrics.d.ts +18 -0
  185. package/dist/utils/ccma-metrics.js +37 -0
  186. package/dist/utils/ccma-metrics.js.map +7 -0
  187. package/dist/utils/environments.d.ts +11 -0
  188. package/dist/utils/environments.js +148 -0
  189. package/dist/utils/environments.js.map +7 -0
  190. package/dist/utils/errors.d.ts +5 -0
  191. package/dist/utils/errors.js +11 -0
  192. package/dist/utils/errors.js.map +7 -0
  193. package/dist/utils/frontendCache.d.ts +26 -0
  194. package/dist/utils/frontendCache.js +121 -0
  195. package/dist/utils/frontendCache.js.map +7 -0
  196. package/dist/utils/token-issuer.utils.d.ts +8 -0
  197. package/dist/utils/token-issuer.utils.js +19 -0
  198. package/dist/utils/token-issuer.utils.js.map +7 -0
  199. package/package.json +57 -0
@@ -0,0 +1,290 @@
1
+ import type { RequestBaseParams } from '../../types/general.types.js';
2
+ /**
3
+ * Request to create a new team in LiteLLM
4
+ * POST /team/new
5
+ */
6
+ export interface CreateTeamRequest extends RequestBaseParams {
7
+ options: {
8
+ /** Base URL for LiteLLM API */
9
+ litellmApiBaseUrl: string;
10
+ /** API token for authentication */
11
+ apiToken: string;
12
+ /** Team alias/name */
13
+ team_alias: string;
14
+ /** Maximum budget for the team */
15
+ max_budget?: number;
16
+ /** Budget duration (e.g., '30d', '1mo') */
17
+ budget_duration?: string;
18
+ };
19
+ }
20
+ /**
21
+ * Response from creating a new team
22
+ */
23
+ export interface CreateTeamResponse {
24
+ team_id: string;
25
+ team_alias: string;
26
+ max_budget?: number;
27
+ budget_duration?: string;
28
+ created_at?: string;
29
+ [key: string]: any;
30
+ }
31
+ /**
32
+ * Request to update a team's budget in LiteLLM
33
+ * POST /team/update
34
+ */
35
+ export interface UpdateTeamBudgetRequest extends RequestBaseParams {
36
+ options: {
37
+ /** Base URL for LiteLLM API */
38
+ litellmApiBaseUrl: string;
39
+ /** API token for authentication */
40
+ apiToken: string;
41
+ /** Team ID to update */
42
+ team_id: string;
43
+ /** New maximum budget for the team */
44
+ max_budget: number;
45
+ };
46
+ }
47
+ /**
48
+ * Response from updating a team's budget
49
+ */
50
+ export interface UpdateTeamBudgetResponse {
51
+ team_id: string;
52
+ team_alias?: string;
53
+ max_budget: number;
54
+ budget_duration?: string;
55
+ [key: string]: any;
56
+ }
57
+ /**
58
+ * Request to update a key's budget in LiteLLM
59
+ * POST /key/update
60
+ */
61
+ export interface UpdateKeyBudgetRequest extends RequestBaseParams {
62
+ options: {
63
+ /** Base URL for LiteLLM API */
64
+ litellmApiBaseUrl: string;
65
+ /** API token for authentication */
66
+ apiToken: string;
67
+ /** Key to update */
68
+ key: string;
69
+ /** New maximum budget for the key */
70
+ max_budget: number;
71
+ };
72
+ }
73
+ /**
74
+ * Response from updating a key's budget
75
+ */
76
+ export interface UpdateKeyBudgetResponse {
77
+ key: string;
78
+ max_budget: number;
79
+ [key: string]: any;
80
+ }
81
+ /**
82
+ * Request to delete a team
83
+ * POST /team/delete
84
+ */
85
+ export interface DeleteTeamRequest extends RequestBaseParams {
86
+ options: {
87
+ /** Base URL for LiteLLM API */
88
+ litellmApiBaseUrl: string;
89
+ /** API token for authentication */
90
+ apiToken: string;
91
+ /** Team ID to delete */
92
+ team_id: string;
93
+ };
94
+ }
95
+ /**
96
+ * Response from deleting a team
97
+ */
98
+ export interface DeleteTeamResponse {
99
+ deleted_teams: string[];
100
+ [key: string]: any;
101
+ }
102
+ /**
103
+ * Request to generate a key for a team
104
+ * POST /key/generate
105
+ */
106
+ export interface GenerateKeyRequest extends RequestBaseParams {
107
+ options: {
108
+ /** Base URL for LiteLLM API */
109
+ litellmApiBaseUrl: string;
110
+ /** API token for authentication */
111
+ apiToken: string;
112
+ /** Team ID to generate key for */
113
+ team_id: string;
114
+ /** Models the key can access */
115
+ models?: string[];
116
+ /** Optional key alias */
117
+ key_alias?: string;
118
+ /** Duration for the key */
119
+ duration?: string;
120
+ /** Additional metadata */
121
+ metadata?: Record<string, any>;
122
+ /** Maximum budget for this key */
123
+ max_budget?: number;
124
+ /** Budget duration */
125
+ budget_duration?: string;
126
+ };
127
+ }
128
+ /**
129
+ * Response from generating a key
130
+ */
131
+ export interface GenerateKeyResponse {
132
+ key: string;
133
+ key_name?: string;
134
+ expires?: string;
135
+ team_id: string;
136
+ metadata?: Record<string, any>;
137
+ [key: string]: any;
138
+ }
139
+ /**
140
+ * Request to block a key
141
+ * POST /key/block
142
+ */
143
+ export interface BlockKeyRequest extends RequestBaseParams {
144
+ options: {
145
+ /** Base URL for LiteLLM API */
146
+ litellmApiBaseUrl: string;
147
+ /** API token for authentication */
148
+ apiToken: string;
149
+ /** Key to block */
150
+ key: string;
151
+ };
152
+ }
153
+ /**
154
+ * Response from blocking a key
155
+ */
156
+ export interface BlockKeyResponse {
157
+ status: string;
158
+ message?: string;
159
+ [key: string]: any;
160
+ }
161
+ /**
162
+ * Request to unblock a key
163
+ * POST /key/unblock
164
+ */
165
+ export interface UnblockKeyRequest extends RequestBaseParams {
166
+ options: {
167
+ /** Base URL for LiteLLM API */
168
+ litellmApiBaseUrl: string;
169
+ /** API token for authentication */
170
+ apiToken: string;
171
+ /** Key to unblock */
172
+ key: string;
173
+ };
174
+ }
175
+ /**
176
+ * Response from unblocking a key
177
+ */
178
+ export interface UnblockKeyResponse {
179
+ status: string;
180
+ message?: string;
181
+ [key: string]: any;
182
+ }
183
+ /**
184
+ * Request to get key info
185
+ * GET /key/info
186
+ */
187
+ export interface GetKeyInfoRequest extends RequestBaseParams {
188
+ options: {
189
+ /** Base URL for LiteLLM API */
190
+ litellmApiBaseUrl: string;
191
+ /** API token for authentication */
192
+ apiToken: string;
193
+ /** Key to get info for */
194
+ key: string;
195
+ };
196
+ }
197
+ /**
198
+ * Request to delete a key
199
+ * POST /key/delete
200
+ */
201
+ export interface DeleteKeyRequest extends RequestBaseParams {
202
+ options: {
203
+ /** Base URL for LiteLLM API */
204
+ litellmApiBaseUrl: string;
205
+ /** API token for authentication */
206
+ apiToken: string;
207
+ /** Key to delete */
208
+ key: string;
209
+ };
210
+ }
211
+ /**
212
+ * Response from deleting a key
213
+ */
214
+ export interface DeleteKeyResponse {
215
+ deleted_keys: string[];
216
+ [key: string]: any;
217
+ }
218
+ /**
219
+ * Response from getting key info including usage and spend
220
+ */
221
+ export interface GetKeyInfoResponse {
222
+ info: {
223
+ key: string;
224
+ team_id: string;
225
+ spend?: number;
226
+ usage?: {
227
+ total_tokens?: number;
228
+ prompt_tokens?: number;
229
+ completion_tokens?: number;
230
+ };
231
+ max_budget?: number;
232
+ budget_duration?: string;
233
+ blocked?: boolean;
234
+ created_at?: string;
235
+ expires_at?: string;
236
+ metadata?: Record<string, any>;
237
+ [key: string]: any;
238
+ };
239
+ }
240
+ /**
241
+ * Service for interacting with LiteLLM API
242
+ * API Documentation: https://camunda.litellm-sandbox.ai
243
+ */
244
+ export declare class LiteLLMService {
245
+ /**
246
+ * Create a new team in LiteLLM
247
+ * POST /team/new
248
+ */
249
+ static createTeam(params: CreateTeamRequest): Promise<CreateTeamResponse>;
250
+ /**
251
+ * Update a team's budget in LiteLLM
252
+ * POST /team/update
253
+ */
254
+ static updateTeamBudget(params: UpdateTeamBudgetRequest): Promise<UpdateTeamBudgetResponse>;
255
+ /**
256
+ * Update a key's budget in LiteLLM
257
+ * POST /key/update
258
+ */
259
+ static updateKeyBudget(params: UpdateKeyBudgetRequest): Promise<UpdateKeyBudgetResponse>;
260
+ /**
261
+ * Generate a key for a team
262
+ * POST /key/generate
263
+ */
264
+ static generateKey(params: GenerateKeyRequest): Promise<GenerateKeyResponse>;
265
+ /**
266
+ * Block a key to quickly disable it
267
+ * POST /key/block
268
+ */
269
+ static blockKey(params: BlockKeyRequest): Promise<BlockKeyResponse>;
270
+ /**
271
+ * Unblock a key to re-enable it
272
+ * POST /key/unblock
273
+ */
274
+ static unblockKey(params: UnblockKeyRequest): Promise<UnblockKeyResponse>;
275
+ /**
276
+ * Get information about a key including usage and spend
277
+ * GET /key/info
278
+ */
279
+ static getKeyInfo(params: GetKeyInfoRequest): Promise<GetKeyInfoResponse>;
280
+ /**
281
+ * Delete a key
282
+ * POST /key/delete
283
+ */
284
+ static deleteKey(params: DeleteKeyRequest): Promise<DeleteKeyResponse>;
285
+ /**
286
+ * Delete a team
287
+ * POST /team/delete
288
+ */
289
+ static deleteTeam(params: DeleteTeamRequest): Promise<DeleteTeamResponse>;
290
+ }
@@ -0,0 +1,392 @@
1
+ import { request } from "../../utils/api.js";
2
+ import { HttpError } from "../../utils/errors.js";
3
+ class LiteLLMService {
4
+ /**
5
+ * Create a new team in LiteLLM
6
+ * POST /team/new
7
+ */
8
+ static async createTeam(params) {
9
+ const serviceContext = {
10
+ method: {
11
+ name: "LiteLLMService.createTeam",
12
+ url: `${params.options.litellmApiBaseUrl}/team/new`,
13
+ normalizedUrl: "/team/new",
14
+ type: "post"
15
+ },
16
+ source: params.config.metrics?.source || "unset",
17
+ target: {
18
+ name: "litellm",
19
+ type: "external"
20
+ }
21
+ };
22
+ const body = {
23
+ team_alias: params.options.team_alias,
24
+ ...params.options.max_budget !== void 0 && {
25
+ max_budget: params.options.max_budget
26
+ },
27
+ ...params.options.budget_duration && {
28
+ budget_duration: params.options.budget_duration
29
+ }
30
+ };
31
+ const response = await request({
32
+ config: params.config,
33
+ url: serviceContext.method.url,
34
+ method: serviceContext.method.type,
35
+ metricsDetails: serviceContext,
36
+ type: "json",
37
+ headers: {
38
+ Authorization: `Bearer ${params.options.apiToken}`
39
+ },
40
+ body
41
+ });
42
+ if (!response.ok) {
43
+ throw new HttpError(
44
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
45
+ response.status,
46
+ response.statusText
47
+ );
48
+ }
49
+ return response.body;
50
+ }
51
+ /**
52
+ * Update a team's budget in LiteLLM
53
+ * POST /team/update
54
+ */
55
+ static async updateTeamBudget(params) {
56
+ const serviceContext = {
57
+ method: {
58
+ name: "LiteLLMService.updateTeamBudget",
59
+ url: `${params.options.litellmApiBaseUrl}/team/update`,
60
+ normalizedUrl: "/team/update",
61
+ type: "post"
62
+ },
63
+ source: params.config.metrics?.source || "unset",
64
+ target: {
65
+ name: "litellm",
66
+ type: "external"
67
+ }
68
+ };
69
+ const body = {
70
+ team_id: params.options.team_id,
71
+ max_budget: params.options.max_budget
72
+ };
73
+ const response = await request({
74
+ config: params.config,
75
+ url: serviceContext.method.url,
76
+ method: serviceContext.method.type,
77
+ metricsDetails: serviceContext,
78
+ type: "json",
79
+ headers: {
80
+ Authorization: `Bearer ${params.options.apiToken}`
81
+ },
82
+ body
83
+ });
84
+ if (!response.ok) {
85
+ throw new HttpError(
86
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
87
+ response.status,
88
+ response.statusText
89
+ );
90
+ }
91
+ return response.body;
92
+ }
93
+ /**
94
+ * Update a key's budget in LiteLLM
95
+ * POST /key/update
96
+ */
97
+ static async updateKeyBudget(params) {
98
+ const serviceContext = {
99
+ method: {
100
+ name: "LiteLLMService.updateKeyBudget",
101
+ url: `${params.options.litellmApiBaseUrl}/key/update`,
102
+ normalizedUrl: "/key/update",
103
+ type: "post"
104
+ },
105
+ source: params.config.metrics?.source || "unset",
106
+ target: {
107
+ name: "litellm",
108
+ type: "external"
109
+ }
110
+ };
111
+ const body = {
112
+ key: params.options.key,
113
+ max_budget: params.options.max_budget
114
+ };
115
+ const response = await request({
116
+ config: params.config,
117
+ url: serviceContext.method.url,
118
+ method: serviceContext.method.type,
119
+ metricsDetails: serviceContext,
120
+ type: "json",
121
+ headers: {
122
+ Authorization: `Bearer ${params.options.apiToken}`
123
+ },
124
+ body
125
+ });
126
+ if (!response.ok) {
127
+ throw new HttpError(
128
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
129
+ response.status,
130
+ response.statusText
131
+ );
132
+ }
133
+ return response.body;
134
+ }
135
+ /**
136
+ * Generate a key for a team
137
+ * POST /key/generate
138
+ */
139
+ static async generateKey(params) {
140
+ const serviceContext = {
141
+ method: {
142
+ name: "LiteLLMService.generateKey",
143
+ url: `${params.options.litellmApiBaseUrl}/key/generate`,
144
+ normalizedUrl: "/key/generate",
145
+ type: "post"
146
+ },
147
+ source: params.config.metrics?.source || "unset",
148
+ target: {
149
+ name: "litellm",
150
+ type: "external"
151
+ }
152
+ };
153
+ const body = {
154
+ team_id: params.options.team_id,
155
+ key_type: "llm_api",
156
+ allowed_routes: ["/chat/completions"],
157
+ ...params.options.models && { models: params.options.models },
158
+ ...params.options.key_alias && { key_alias: params.options.key_alias },
159
+ ...params.options.duration && { duration: params.options.duration },
160
+ ...params.options.metadata && { metadata: params.options.metadata },
161
+ ...params.options.max_budget !== void 0 && {
162
+ max_budget: params.options.max_budget
163
+ },
164
+ ...params.options.budget_duration && {
165
+ budget_duration: params.options.budget_duration
166
+ }
167
+ };
168
+ const response = await request({
169
+ config: params.config,
170
+ url: serviceContext.method.url,
171
+ method: serviceContext.method.type,
172
+ metricsDetails: serviceContext,
173
+ type: "json",
174
+ headers: {
175
+ Authorization: `Bearer ${params.options.apiToken}`
176
+ },
177
+ body
178
+ });
179
+ if (!response.ok) {
180
+ throw new HttpError(
181
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
182
+ response.status,
183
+ response.statusText
184
+ );
185
+ }
186
+ return response.body;
187
+ }
188
+ /**
189
+ * Block a key to quickly disable it
190
+ * POST /key/block
191
+ */
192
+ static async blockKey(params) {
193
+ const serviceContext = {
194
+ method: {
195
+ name: "LiteLLMService.blockKey",
196
+ url: `${params.options.litellmApiBaseUrl}/key/block`,
197
+ normalizedUrl: "/key/block",
198
+ type: "post"
199
+ },
200
+ source: params.config.metrics?.source || "unset",
201
+ target: {
202
+ name: "litellm",
203
+ type: "external"
204
+ }
205
+ };
206
+ const body = {
207
+ key: params.options.key
208
+ };
209
+ const response = await request({
210
+ config: params.config,
211
+ url: serviceContext.method.url,
212
+ method: serviceContext.method.type,
213
+ metricsDetails: serviceContext,
214
+ type: "json",
215
+ headers: {
216
+ Authorization: `Bearer ${params.options.apiToken}`
217
+ },
218
+ body
219
+ });
220
+ if (!response.ok) {
221
+ throw new HttpError(
222
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
223
+ response.status,
224
+ response.statusText
225
+ );
226
+ }
227
+ return response.body;
228
+ }
229
+ /**
230
+ * Unblock a key to re-enable it
231
+ * POST /key/unblock
232
+ */
233
+ static async unblockKey(params) {
234
+ const serviceContext = {
235
+ method: {
236
+ name: "LiteLLMService.unblockKey",
237
+ url: `${params.options.litellmApiBaseUrl}/key/unblock`,
238
+ normalizedUrl: "/key/unblock",
239
+ type: "post"
240
+ },
241
+ source: params.config.metrics?.source || "unset",
242
+ target: {
243
+ name: "litellm",
244
+ type: "external"
245
+ }
246
+ };
247
+ const body = {
248
+ key: params.options.key
249
+ };
250
+ const response = await request({
251
+ config: params.config,
252
+ url: serviceContext.method.url,
253
+ method: serviceContext.method.type,
254
+ metricsDetails: serviceContext,
255
+ type: "json",
256
+ headers: {
257
+ Authorization: `Bearer ${params.options.apiToken}`
258
+ },
259
+ body
260
+ });
261
+ if (!response.ok) {
262
+ throw new HttpError(
263
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
264
+ response.status,
265
+ response.statusText
266
+ );
267
+ }
268
+ return response.body;
269
+ }
270
+ /**
271
+ * Get information about a key including usage and spend
272
+ * GET /key/info
273
+ */
274
+ static async getKeyInfo(params) {
275
+ const serviceContext = {
276
+ method: {
277
+ name: "LiteLLMService.getKeyInfo",
278
+ url: `${params.options.litellmApiBaseUrl}/key/info?key=${encodeURIComponent(params.options.key)}`,
279
+ normalizedUrl: "/key/info",
280
+ type: "get"
281
+ },
282
+ source: params.config.metrics?.source || "unset",
283
+ target: {
284
+ name: "litellm",
285
+ type: "external"
286
+ }
287
+ };
288
+ const response = await request({
289
+ config: params.config,
290
+ url: serviceContext.method.url,
291
+ method: serviceContext.method.type,
292
+ metricsDetails: serviceContext,
293
+ headers: {
294
+ Authorization: `Bearer ${params.options.apiToken}`
295
+ }
296
+ });
297
+ if (!response.ok) {
298
+ throw new HttpError(
299
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
300
+ response.status,
301
+ response.statusText
302
+ );
303
+ }
304
+ return response.body;
305
+ }
306
+ /**
307
+ * Delete a key
308
+ * POST /key/delete
309
+ */
310
+ static async deleteKey(params) {
311
+ const serviceContext = {
312
+ method: {
313
+ name: "LiteLLMService.deleteKey",
314
+ url: `${params.options.litellmApiBaseUrl}/key/delete`,
315
+ normalizedUrl: "/key/delete",
316
+ type: "post"
317
+ },
318
+ source: params.config.metrics?.source || "unset",
319
+ target: {
320
+ name: "litellm",
321
+ type: "external"
322
+ }
323
+ };
324
+ const body = {
325
+ keys: [params.options.key]
326
+ };
327
+ const response = await request({
328
+ config: params.config,
329
+ url: serviceContext.method.url,
330
+ method: serviceContext.method.type,
331
+ metricsDetails: serviceContext,
332
+ type: "json",
333
+ headers: {
334
+ Authorization: `Bearer ${params.options.apiToken}`
335
+ },
336
+ body
337
+ });
338
+ if (!response.ok) {
339
+ throw new HttpError(
340
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
341
+ response.status,
342
+ response.statusText
343
+ );
344
+ }
345
+ return response.body;
346
+ }
347
+ /**
348
+ * Delete a team
349
+ * POST /team/delete
350
+ */
351
+ static async deleteTeam(params) {
352
+ const serviceContext = {
353
+ method: {
354
+ name: "LiteLLMService.deleteTeam",
355
+ url: `${params.options.litellmApiBaseUrl}/team/delete`,
356
+ normalizedUrl: "/team/delete",
357
+ type: "post"
358
+ },
359
+ source: params.config.metrics?.source || "unset",
360
+ target: {
361
+ name: "litellm",
362
+ type: "external"
363
+ }
364
+ };
365
+ const body = {
366
+ team_ids: [params.options.team_id]
367
+ };
368
+ const response = await request({
369
+ config: params.config,
370
+ url: serviceContext.method.url,
371
+ method: serviceContext.method.type,
372
+ metricsDetails: serviceContext,
373
+ type: "json",
374
+ headers: {
375
+ Authorization: `Bearer ${params.options.apiToken}`
376
+ },
377
+ body
378
+ });
379
+ if (!response.ok) {
380
+ throw new HttpError(
381
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
382
+ response.status,
383
+ response.statusText
384
+ );
385
+ }
386
+ return response.body;
387
+ }
388
+ }
389
+ export {
390
+ LiteLLMService
391
+ };
392
+ //# sourceMappingURL=litellm.service.js.map