@redonvn/event-ws-cliproxyapi-sdk 0.1.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.
Files changed (62) hide show
  1. package/README.md +428 -0
  2. package/dist/claude/client.d.ts +8 -0
  3. package/dist/claude/client.js +16 -0
  4. package/dist/claude/index.d.ts +2 -0
  5. package/dist/claude/index.js +1 -0
  6. package/dist/client.d.ts +19 -0
  7. package/dist/client.js +96 -0
  8. package/dist/cliproxy/client.d.ts +41 -0
  9. package/dist/cliproxy/client.js +43 -0
  10. package/dist/cliproxy/index.d.ts +2 -0
  11. package/dist/cliproxy/index.js +1 -0
  12. package/dist/codec.d.ts +8 -0
  13. package/dist/codec.js +79 -0
  14. package/dist/errors/index.d.ts +13 -0
  15. package/dist/errors/index.js +26 -0
  16. package/dist/gemini/client.d.ts +9 -0
  17. package/dist/gemini/client.js +19 -0
  18. package/dist/gemini/index.d.ts +2 -0
  19. package/dist/gemini/index.js +1 -0
  20. package/dist/http/client.d.ts +260 -0
  21. package/dist/http/client.js +591 -0
  22. package/dist/http/index.d.ts +2 -0
  23. package/dist/http/index.js +2 -0
  24. package/dist/http/types.d.ts +783 -0
  25. package/dist/http/types.js +1 -0
  26. package/dist/http-client.d.ts +259 -0
  27. package/dist/http-client.js +557 -0
  28. package/dist/http-types.d.ts +677 -0
  29. package/dist/http-types.js +1 -0
  30. package/dist/index.d.ts +7 -0
  31. package/dist/index.js +7 -0
  32. package/dist/management/client.d.ts +187 -0
  33. package/dist/management/client.js +399 -0
  34. package/dist/management/index.d.ts +2 -0
  35. package/dist/management/index.js +1 -0
  36. package/dist/openai/client.d.ts +10 -0
  37. package/dist/openai/client.js +23 -0
  38. package/dist/openai/index.d.ts +2 -0
  39. package/dist/openai/index.js +1 -0
  40. package/dist/shared/errors.d.ts +13 -0
  41. package/dist/shared/errors.js +26 -0
  42. package/dist/shared/http.d.ts +29 -0
  43. package/dist/shared/http.js +125 -0
  44. package/dist/shared/index.d.ts +2 -0
  45. package/dist/shared/index.js +2 -0
  46. package/dist/shared/types.d.ts +789 -0
  47. package/dist/shared/types.js +1 -0
  48. package/dist/types/index.d.ts +2 -0
  49. package/dist/types/index.js +2 -0
  50. package/dist/types.d.ts +101 -0
  51. package/dist/types.js +1 -0
  52. package/dist/utils/index.d.ts +0 -0
  53. package/dist/utils/index.js +2 -0
  54. package/dist/ws/client.d.ts +20 -0
  55. package/dist/ws/client.js +114 -0
  56. package/dist/ws/codec.d.ts +8 -0
  57. package/dist/ws/codec.js +100 -0
  58. package/dist/ws/index.d.ts +3 -0
  59. package/dist/ws/index.js +3 -0
  60. package/dist/ws/types.d.ts +101 -0
  61. package/dist/ws/types.js +1 -0
  62. package/package.json +29 -0
@@ -0,0 +1,591 @@
1
+ import { APIError } from '../errors/index.js';
2
+ export class CliproxyApiClient {
3
+ constructor(options) {
4
+ this.baseUrl = options.baseUrl.replace(/\/+$/, '');
5
+ this.accessKey = options.accessKey;
6
+ this.managementKey = options.managementKey;
7
+ this.localPassword = options.localPassword;
8
+ this.fetchImpl = options.fetch ?? globalThis.fetch;
9
+ if (!this.fetchImpl) {
10
+ throw new Error('fetch is not available; pass options.fetch');
11
+ }
12
+ }
13
+ setAccessKey(key) {
14
+ this.accessKey = key;
15
+ }
16
+ setManagementKey(key) {
17
+ this.managementKey = key;
18
+ }
19
+ setLocalPassword(value) {
20
+ this.localPassword = value;
21
+ }
22
+ buildUrl(path, query) {
23
+ const url = new URL(path, this.baseUrl);
24
+ if (query) {
25
+ for (const [key, value] of Object.entries(query)) {
26
+ if (value === undefined)
27
+ continue;
28
+ url.searchParams.set(key, String(value));
29
+ }
30
+ }
31
+ return url.toString();
32
+ }
33
+ async requestJson(method, path, body, options, auth) {
34
+ const headers = {
35
+ 'Content-Type': 'application/json',
36
+ ...(options?.headers ?? {})
37
+ };
38
+ this.applyAuth(headers, auth);
39
+ const res = await this.fetchImpl(this.buildUrl(path, options?.query), {
40
+ method,
41
+ headers,
42
+ body: body === undefined ? undefined : JSON.stringify(body)
43
+ });
44
+ if (!res.ok) {
45
+ await this.throwApiError(res);
46
+ }
47
+ const text = await res.text();
48
+ if (!text)
49
+ return undefined;
50
+ return JSON.parse(text);
51
+ }
52
+ async requestText(method, path, body, options, auth) {
53
+ const headers = {
54
+ ...(options?.headers ?? {})
55
+ };
56
+ this.applyAuth(headers, auth);
57
+ const res = await this.fetchImpl(this.buildUrl(path, options?.query), {
58
+ method,
59
+ headers,
60
+ body
61
+ });
62
+ if (!res.ok) {
63
+ await this.throwApiError(res);
64
+ }
65
+ return res.text();
66
+ }
67
+ async requestRaw(method, path, body, options, auth) {
68
+ const headers = {
69
+ ...(options?.headers ?? {})
70
+ };
71
+ this.applyAuth(headers, auth);
72
+ const res = await this.fetchImpl(this.buildUrl(path, options?.query), {
73
+ method,
74
+ headers,
75
+ body
76
+ });
77
+ if (!res.ok) {
78
+ await this.throwApiError(res);
79
+ }
80
+ return res;
81
+ }
82
+ applyAuth(headers, auth) {
83
+ if (auth === 'access' && this.accessKey) {
84
+ headers.Authorization = `Bearer ${this.accessKey}`;
85
+ }
86
+ if (auth === 'management' && this.managementKey) {
87
+ headers.Authorization = `Bearer ${this.managementKey}`;
88
+ }
89
+ if (auth === 'local' && this.localPassword) {
90
+ headers.Authorization = `Bearer ${this.localPassword}`;
91
+ headers['X-Local-Password'] = this.localPassword;
92
+ }
93
+ }
94
+ async throwApiError(res) {
95
+ let payload;
96
+ let message = `Request failed (${res.status})`;
97
+ const text = await res.text();
98
+ if (text) {
99
+ try {
100
+ payload = JSON.parse(text);
101
+ }
102
+ catch {
103
+ payload = { error: text };
104
+ }
105
+ if (payload && typeof payload === 'object') {
106
+ const obj = payload;
107
+ if (typeof obj.error === 'string')
108
+ message = obj.error;
109
+ else if (obj.error && typeof obj.error === 'object' && typeof obj.error.message === 'string')
110
+ message = obj.error.message;
111
+ else if (typeof obj.message === 'string')
112
+ message = obj.message;
113
+ }
114
+ }
115
+ throw new APIError(message, res.status, (payload ?? { error: message }));
116
+ }
117
+ getWebsocketUrl(path = '/v1/ws') {
118
+ const base = this.baseUrl.replace(/\/+$/, '');
119
+ const wsBase = base.replace(/^http/, 'ws');
120
+ const normalized = path.startsWith('/') ? path : `/${path}`;
121
+ return `${wsBase}${normalized}`;
122
+ }
123
+ // Public
124
+ getRoot() {
125
+ return this.requestJson('GET', '/');
126
+ }
127
+ getManagementHtml() {
128
+ return this.requestRaw('GET', '/management.html');
129
+ }
130
+ keepAlive() {
131
+ return this.requestJson('GET', '/keep-alive', undefined, undefined, 'local');
132
+ }
133
+ anthropicCallback(query) {
134
+ return this.requestRaw('GET', '/anthropic/callback', undefined, { query });
135
+ }
136
+ codexCallback(query) {
137
+ return this.requestRaw('GET', '/codex/callback', undefined, { query });
138
+ }
139
+ googleCallback(query) {
140
+ return this.requestRaw('GET', '/google/callback', undefined, { query });
141
+ }
142
+ iflowCallback(query) {
143
+ return this.requestRaw('GET', '/iflow/callback', undefined, { query });
144
+ }
145
+ antigravityCallback(query) {
146
+ return this.requestRaw('GET', '/antigravity/callback', undefined, { query });
147
+ }
148
+ // v1internal Gemini CLI handler (localhost only)
149
+ postV1Internal(method, body, options) {
150
+ return this.requestRaw('POST', `/v1internal:${method}`, JSON.stringify(body), options);
151
+ }
152
+ // OpenAI-compatible (/v1)
153
+ getModels() {
154
+ return this.requestJson('GET', '/v1/models', undefined, undefined, 'access');
155
+ }
156
+ postChatCompletions(body, options) {
157
+ return this.requestRaw('POST', '/v1/chat/completions', JSON.stringify(body), options, 'access');
158
+ }
159
+ postCompletions(body, options) {
160
+ return this.requestRaw('POST', '/v1/completions', JSON.stringify(body), options, 'access');
161
+ }
162
+ postMessages(body, options) {
163
+ return this.requestRaw('POST', '/v1/messages', JSON.stringify(body), options, 'access');
164
+ }
165
+ postMessagesCountTokens(body, options) {
166
+ return this.requestRaw('POST', '/v1/messages/count_tokens', JSON.stringify(body), options, 'access');
167
+ }
168
+ postResponses(body, options) {
169
+ return this.requestRaw('POST', '/v1/responses', JSON.stringify(body), options, 'access');
170
+ }
171
+ postResponsesCompact(body, options) {
172
+ return this.requestRaw('POST', '/v1/responses/compact', JSON.stringify(body), options, 'access');
173
+ }
174
+ // CLIProxy simplified (/v1/cliproxy)
175
+ getCliproxyAuths(query) {
176
+ return this.requestJson('GET', '/v1/cliproxy/auths', undefined, { query: query }, 'access');
177
+ }
178
+ getCliproxyModels(query) {
179
+ return this.requestJson('GET', '/v1/cliproxy/models', undefined, { query: query }, 'access');
180
+ }
181
+ postCliproxyChat(body, options) {
182
+ return this.requestRaw('POST', '/v1/cliproxy/chat', JSON.stringify(body), options, 'access');
183
+ }
184
+ // Gemini-compatible (/v1beta)
185
+ getGeminiModels(options) {
186
+ return this.requestRaw('GET', '/v1beta/models', undefined, options, 'access');
187
+ }
188
+ postGeminiModelsAction(action, body, options) {
189
+ return this.requestRaw('POST', `/v1beta/models/${action}`, JSON.stringify(body), options, 'access');
190
+ }
191
+ getGeminiModelsAction(action, query, options) {
192
+ return this.requestRaw('GET', `/v1beta/models/${action}`, undefined, { ...options, query }, 'access');
193
+ }
194
+ // Management
195
+ getUsage() {
196
+ return this.requestJson('GET', '/v0/management/usage', undefined, undefined, 'management');
197
+ }
198
+ exportUsage() {
199
+ return this.requestJson('GET', '/v0/management/usage/export', undefined, undefined, 'management');
200
+ }
201
+ importUsage(body) {
202
+ return this.requestJson('POST', '/v0/management/usage/import', body, undefined, 'management');
203
+ }
204
+ getConfig() {
205
+ return this.requestJson('GET', '/v0/management/config', undefined, undefined, 'management');
206
+ }
207
+ getConfigYaml() {
208
+ return this.requestText('GET', '/v0/management/config.yaml', undefined, undefined, 'management');
209
+ }
210
+ putConfigYaml(body) {
211
+ return this.requestRaw('PUT', '/v0/management/config.yaml', body, { headers: { 'Content-Type': 'text/yaml' } }, 'management').then(async (res) => {
212
+ const text = await res.text();
213
+ return text ? JSON.parse(text) : { status: 'ok' };
214
+ });
215
+ }
216
+ getLatestVersion() {
217
+ return this.requestJson('GET', '/v0/management/latest-version', undefined, undefined, 'management');
218
+ }
219
+ getDebug() {
220
+ return this.requestJson('GET', '/v0/management/debug', undefined, undefined, 'management');
221
+ }
222
+ putDebug(body) {
223
+ return this.requestJson('PUT', '/v0/management/debug', body, undefined, 'management');
224
+ }
225
+ patchDebug(body) {
226
+ return this.requestJson('PATCH', '/v0/management/debug', body, undefined, 'management');
227
+ }
228
+ getLoggingToFile() {
229
+ return this.requestJson('GET', '/v0/management/logging-to-file', undefined, undefined, 'management');
230
+ }
231
+ putLoggingToFile(body) {
232
+ return this.requestJson('PUT', '/v0/management/logging-to-file', body, undefined, 'management');
233
+ }
234
+ patchLoggingToFile(body) {
235
+ return this.requestJson('PATCH', '/v0/management/logging-to-file', body, undefined, 'management');
236
+ }
237
+ getLogsMaxTotalSizeMB() {
238
+ return this.requestJson('GET', '/v0/management/logs-max-total-size-mb', undefined, undefined, 'management');
239
+ }
240
+ putLogsMaxTotalSizeMB(body) {
241
+ return this.requestJson('PUT', '/v0/management/logs-max-total-size-mb', body, undefined, 'management');
242
+ }
243
+ patchLogsMaxTotalSizeMB(body) {
244
+ return this.requestJson('PATCH', '/v0/management/logs-max-total-size-mb', body, undefined, 'management');
245
+ }
246
+ getErrorLogsMaxFiles() {
247
+ return this.requestJson('GET', '/v0/management/error-logs-max-files', undefined, undefined, 'management');
248
+ }
249
+ putErrorLogsMaxFiles(body) {
250
+ return this.requestJson('PUT', '/v0/management/error-logs-max-files', body, undefined, 'management');
251
+ }
252
+ patchErrorLogsMaxFiles(body) {
253
+ return this.requestJson('PATCH', '/v0/management/error-logs-max-files', body, undefined, 'management');
254
+ }
255
+ getUsageStatisticsEnabled() {
256
+ return this.requestJson('GET', '/v0/management/usage-statistics-enabled', undefined, undefined, 'management');
257
+ }
258
+ putUsageStatisticsEnabled(body) {
259
+ return this.requestJson('PUT', '/v0/management/usage-statistics-enabled', body, undefined, 'management');
260
+ }
261
+ patchUsageStatisticsEnabled(body) {
262
+ return this.requestJson('PATCH', '/v0/management/usage-statistics-enabled', body, undefined, 'management');
263
+ }
264
+ getProxyUrl() {
265
+ return this.requestJson('GET', '/v0/management/proxy-url', undefined, undefined, 'management');
266
+ }
267
+ putProxyUrl(body) {
268
+ return this.requestJson('PUT', '/v0/management/proxy-url', body, undefined, 'management');
269
+ }
270
+ patchProxyUrl(body) {
271
+ return this.requestJson('PATCH', '/v0/management/proxy-url', body, undefined, 'management');
272
+ }
273
+ deleteProxyUrl() {
274
+ return this.requestJson('DELETE', '/v0/management/proxy-url', undefined, undefined, 'management');
275
+ }
276
+ apiCall(body) {
277
+ return this.requestJson('POST', '/v0/management/api-call', body, undefined, 'management');
278
+ }
279
+ getSwitchProject() {
280
+ return this.requestJson('GET', '/v0/management/quota-exceeded/switch-project', undefined, undefined, 'management');
281
+ }
282
+ putSwitchProject(body) {
283
+ return this.requestJson('PUT', '/v0/management/quota-exceeded/switch-project', body, undefined, 'management');
284
+ }
285
+ patchSwitchProject(body) {
286
+ return this.requestJson('PATCH', '/v0/management/quota-exceeded/switch-project', body, undefined, 'management');
287
+ }
288
+ getSwitchPreviewModel() {
289
+ return this.requestJson('GET', '/v0/management/quota-exceeded/switch-preview-model', undefined, undefined, 'management');
290
+ }
291
+ putSwitchPreviewModel(body) {
292
+ return this.requestJson('PUT', '/v0/management/quota-exceeded/switch-preview-model', body, undefined, 'management');
293
+ }
294
+ patchSwitchPreviewModel(body) {
295
+ return this.requestJson('PATCH', '/v0/management/quota-exceeded/switch-preview-model', body, undefined, 'management');
296
+ }
297
+ getApiKeys() {
298
+ return this.requestJson('GET', '/v0/management/api-keys', undefined, undefined, 'management');
299
+ }
300
+ putApiKeys(body) {
301
+ return this.requestJson('PUT', '/v0/management/api-keys', body, undefined, 'management');
302
+ }
303
+ patchApiKeys(body) {
304
+ return this.requestJson('PATCH', '/v0/management/api-keys', body, undefined, 'management');
305
+ }
306
+ deleteApiKeys(query) {
307
+ return this.requestJson('DELETE', '/v0/management/api-keys', undefined, { query }, 'management');
308
+ }
309
+ getGeminiKeys() {
310
+ return this.requestJson('GET', '/v0/management/gemini-api-key', undefined, undefined, 'management');
311
+ }
312
+ putGeminiKeys(body) {
313
+ return this.requestJson('PUT', '/v0/management/gemini-api-key', body, undefined, 'management');
314
+ }
315
+ patchGeminiKey(body) {
316
+ return this.requestJson('PATCH', '/v0/management/gemini-api-key', body, undefined, 'management');
317
+ }
318
+ deleteGeminiKey(query) {
319
+ return this.requestJson('DELETE', '/v0/management/gemini-api-key', undefined, { query }, 'management');
320
+ }
321
+ getLogs(query) {
322
+ return this.requestJson('GET', '/v0/management/logs', undefined, { query }, 'management');
323
+ }
324
+ deleteLogs() {
325
+ return this.requestJson('DELETE', '/v0/management/logs', undefined, undefined, 'management');
326
+ }
327
+ getRequestErrorLogs() {
328
+ return this.requestJson('GET', '/v0/management/request-error-logs', undefined, undefined, 'management');
329
+ }
330
+ downloadRequestErrorLog(name) {
331
+ return this.requestRaw('GET', `/v0/management/request-error-logs/${encodeURIComponent(name)}`, undefined, undefined, 'management');
332
+ }
333
+ getRequestLogById(id) {
334
+ return this.requestRaw('GET', `/v0/management/request-log-by-id/${encodeURIComponent(id)}`, undefined, undefined, 'management');
335
+ }
336
+ getRequestLog() {
337
+ return this.requestJson('GET', '/v0/management/request-log', undefined, undefined, 'management');
338
+ }
339
+ putRequestLog(body) {
340
+ return this.requestJson('PUT', '/v0/management/request-log', body, undefined, 'management');
341
+ }
342
+ patchRequestLog(body) {
343
+ return this.requestJson('PATCH', '/v0/management/request-log', body, undefined, 'management');
344
+ }
345
+ getWebsocketAuth() {
346
+ return this.requestJson('GET', '/v0/management/ws-auth', undefined, undefined, 'management');
347
+ }
348
+ putWebsocketAuth(body) {
349
+ return this.requestJson('PUT', '/v0/management/ws-auth', body, undefined, 'management');
350
+ }
351
+ patchWebsocketAuth(body) {
352
+ return this.requestJson('PATCH', '/v0/management/ws-auth', body, undefined, 'management');
353
+ }
354
+ getAmpCode() {
355
+ return this.requestJson('GET', '/v0/management/ampcode', undefined, undefined, 'management');
356
+ }
357
+ getAmpUpstreamUrl() {
358
+ return this.requestJson('GET', '/v0/management/ampcode/upstream-url', undefined, undefined, 'management');
359
+ }
360
+ putAmpUpstreamUrl(body) {
361
+ return this.requestJson('PUT', '/v0/management/ampcode/upstream-url', body, undefined, 'management');
362
+ }
363
+ patchAmpUpstreamUrl(body) {
364
+ return this.requestJson('PATCH', '/v0/management/ampcode/upstream-url', body, undefined, 'management');
365
+ }
366
+ deleteAmpUpstreamUrl() {
367
+ return this.requestJson('DELETE', '/v0/management/ampcode/upstream-url', undefined, undefined, 'management');
368
+ }
369
+ getAmpUpstreamApiKey() {
370
+ return this.requestJson('GET', '/v0/management/ampcode/upstream-api-key', undefined, undefined, 'management');
371
+ }
372
+ putAmpUpstreamApiKey(body) {
373
+ return this.requestJson('PUT', '/v0/management/ampcode/upstream-api-key', body, undefined, 'management');
374
+ }
375
+ patchAmpUpstreamApiKey(body) {
376
+ return this.requestJson('PATCH', '/v0/management/ampcode/upstream-api-key', body, undefined, 'management');
377
+ }
378
+ deleteAmpUpstreamApiKey() {
379
+ return this.requestJson('DELETE', '/v0/management/ampcode/upstream-api-key', undefined, undefined, 'management');
380
+ }
381
+ getAmpRestrictManagementToLocalhost() {
382
+ return this.requestJson('GET', '/v0/management/ampcode/restrict-management-to-localhost', undefined, undefined, 'management');
383
+ }
384
+ putAmpRestrictManagementToLocalhost(body) {
385
+ return this.requestJson('PUT', '/v0/management/ampcode/restrict-management-to-localhost', body, undefined, 'management');
386
+ }
387
+ patchAmpRestrictManagementToLocalhost(body) {
388
+ return this.requestJson('PATCH', '/v0/management/ampcode/restrict-management-to-localhost', body, undefined, 'management');
389
+ }
390
+ getAmpModelMappings() {
391
+ return this.requestJson('GET', '/v0/management/ampcode/model-mappings', undefined, undefined, 'management');
392
+ }
393
+ putAmpModelMappings(body) {
394
+ return this.requestJson('PUT', '/v0/management/ampcode/model-mappings', body, undefined, 'management');
395
+ }
396
+ patchAmpModelMappings(body) {
397
+ return this.requestJson('PATCH', '/v0/management/ampcode/model-mappings', body, undefined, 'management');
398
+ }
399
+ deleteAmpModelMappings(query) {
400
+ return this.requestJson('DELETE', '/v0/management/ampcode/model-mappings', undefined, { query }, 'management');
401
+ }
402
+ getAmpForceModelMappings() {
403
+ return this.requestJson('GET', '/v0/management/ampcode/force-model-mappings', undefined, undefined, 'management');
404
+ }
405
+ putAmpForceModelMappings(body) {
406
+ return this.requestJson('PUT', '/v0/management/ampcode/force-model-mappings', body, undefined, 'management');
407
+ }
408
+ patchAmpForceModelMappings(body) {
409
+ return this.requestJson('PATCH', '/v0/management/ampcode/force-model-mappings', body, undefined, 'management');
410
+ }
411
+ getAmpUpstreamApiKeys() {
412
+ return this.requestJson('GET', '/v0/management/ampcode/upstream-api-keys', undefined, undefined, 'management');
413
+ }
414
+ putAmpUpstreamApiKeys(body) {
415
+ return this.requestJson('PUT', '/v0/management/ampcode/upstream-api-keys', body, undefined, 'management');
416
+ }
417
+ patchAmpUpstreamApiKeys(body) {
418
+ return this.requestJson('PATCH', '/v0/management/ampcode/upstream-api-keys', body, undefined, 'management');
419
+ }
420
+ deleteAmpUpstreamApiKeys(query) {
421
+ return this.requestJson('DELETE', '/v0/management/ampcode/upstream-api-keys', undefined, { query }, 'management');
422
+ }
423
+ getRequestRetry() {
424
+ return this.requestJson('GET', '/v0/management/request-retry', undefined, undefined, 'management');
425
+ }
426
+ putRequestRetry(body) {
427
+ return this.requestJson('PUT', '/v0/management/request-retry', body, undefined, 'management');
428
+ }
429
+ patchRequestRetry(body) {
430
+ return this.requestJson('PATCH', '/v0/management/request-retry', body, undefined, 'management');
431
+ }
432
+ getMaxRetryInterval() {
433
+ return this.requestJson('GET', '/v0/management/max-retry-interval', undefined, undefined, 'management');
434
+ }
435
+ putMaxRetryInterval(body) {
436
+ return this.requestJson('PUT', '/v0/management/max-retry-interval', body, undefined, 'management');
437
+ }
438
+ patchMaxRetryInterval(body) {
439
+ return this.requestJson('PATCH', '/v0/management/max-retry-interval', body, undefined, 'management');
440
+ }
441
+ getForceModelPrefix() {
442
+ return this.requestJson('GET', '/v0/management/force-model-prefix', undefined, undefined, 'management');
443
+ }
444
+ putForceModelPrefix(body) {
445
+ return this.requestJson('PUT', '/v0/management/force-model-prefix', body, undefined, 'management');
446
+ }
447
+ patchForceModelPrefix(body) {
448
+ return this.requestJson('PATCH', '/v0/management/force-model-prefix', body, undefined, 'management');
449
+ }
450
+ getRoutingStrategy() {
451
+ return this.requestJson('GET', '/v0/management/routing/strategy', undefined, undefined, 'management');
452
+ }
453
+ putRoutingStrategy(body) {
454
+ return this.requestJson('PUT', '/v0/management/routing/strategy', body, undefined, 'management');
455
+ }
456
+ patchRoutingStrategy(body) {
457
+ return this.requestJson('PATCH', '/v0/management/routing/strategy', body, undefined, 'management');
458
+ }
459
+ getClaudeKeys() {
460
+ return this.requestJson('GET', '/v0/management/claude-api-key', undefined, undefined, 'management');
461
+ }
462
+ putClaudeKeys(body) {
463
+ return this.requestJson('PUT', '/v0/management/claude-api-key', body, undefined, 'management');
464
+ }
465
+ patchClaudeKey(body) {
466
+ return this.requestJson('PATCH', '/v0/management/claude-api-key', body, undefined, 'management');
467
+ }
468
+ deleteClaudeKey(query) {
469
+ return this.requestJson('DELETE', '/v0/management/claude-api-key', undefined, { query }, 'management');
470
+ }
471
+ getCodexKeys() {
472
+ return this.requestJson('GET', '/v0/management/codex-api-key', undefined, undefined, 'management');
473
+ }
474
+ putCodexKeys(body) {
475
+ return this.requestJson('PUT', '/v0/management/codex-api-key', body, undefined, 'management');
476
+ }
477
+ patchCodexKey(body) {
478
+ return this.requestJson('PATCH', '/v0/management/codex-api-key', body, undefined, 'management');
479
+ }
480
+ deleteCodexKey(query) {
481
+ return this.requestJson('DELETE', '/v0/management/codex-api-key', undefined, { query }, 'management');
482
+ }
483
+ getOpenAICompatibility() {
484
+ return this.requestJson('GET', '/v0/management/openai-compatibility', undefined, undefined, 'management');
485
+ }
486
+ putOpenAICompatibility(body) {
487
+ return this.requestJson('PUT', '/v0/management/openai-compatibility', body, undefined, 'management');
488
+ }
489
+ patchOpenAICompatibility(body) {
490
+ return this.requestJson('PATCH', '/v0/management/openai-compatibility', body, undefined, 'management');
491
+ }
492
+ deleteOpenAICompatibility(query) {
493
+ return this.requestJson('DELETE', '/v0/management/openai-compatibility', undefined, { query }, 'management');
494
+ }
495
+ getVertexCompatKeys() {
496
+ return this.requestJson('GET', '/v0/management/vertex-api-key', undefined, undefined, 'management');
497
+ }
498
+ putVertexCompatKeys(body) {
499
+ return this.requestJson('PUT', '/v0/management/vertex-api-key', body, undefined, 'management');
500
+ }
501
+ patchVertexCompatKey(body) {
502
+ return this.requestJson('PATCH', '/v0/management/vertex-api-key', body, undefined, 'management');
503
+ }
504
+ deleteVertexCompatKey(query) {
505
+ return this.requestJson('DELETE', '/v0/management/vertex-api-key', undefined, { query }, 'management');
506
+ }
507
+ getOAuthExcludedModels() {
508
+ return this.requestJson('GET', '/v0/management/oauth-excluded-models', undefined, undefined, 'management');
509
+ }
510
+ putOAuthExcludedModels(body) {
511
+ return this.requestJson('PUT', '/v0/management/oauth-excluded-models', body, undefined, 'management');
512
+ }
513
+ patchOAuthExcludedModels(body) {
514
+ return this.requestJson('PATCH', '/v0/management/oauth-excluded-models', body, undefined, 'management');
515
+ }
516
+ deleteOAuthExcludedModels(query) {
517
+ return this.requestJson('DELETE', '/v0/management/oauth-excluded-models', undefined, { query }, 'management');
518
+ }
519
+ getOAuthModelAlias() {
520
+ return this.requestJson('GET', '/v0/management/oauth-model-alias', undefined, undefined, 'management');
521
+ }
522
+ putOAuthModelAlias(body) {
523
+ return this.requestJson('PUT', '/v0/management/oauth-model-alias', body, undefined, 'management');
524
+ }
525
+ patchOAuthModelAlias(body) {
526
+ return this.requestJson('PATCH', '/v0/management/oauth-model-alias', body, undefined, 'management');
527
+ }
528
+ deleteOAuthModelAlias(query) {
529
+ return this.requestJson('DELETE', '/v0/management/oauth-model-alias', undefined, { query }, 'management');
530
+ }
531
+ listAuthFiles(query) {
532
+ return this.requestJson('GET', '/v0/management/auth-files', undefined, { query: query }, 'management');
533
+ }
534
+ getAuthFileModels(query) {
535
+ return this.requestJson('GET', '/v0/management/auth-files/models', undefined, { query: query }, 'management');
536
+ }
537
+ getStaticModelDefinitions(channel) {
538
+ return this.requestRaw('GET', `/v0/management/model-definitions/${encodeURIComponent(channel)}`, undefined, undefined, 'management');
539
+ }
540
+ downloadAuthFile(query) {
541
+ return this.requestRaw('GET', '/v0/management/auth-files/download', undefined, { query }, 'management');
542
+ }
543
+ uploadAuthFile(file, name) {
544
+ const form = new FormData();
545
+ form.append('file', file);
546
+ if (name)
547
+ form.append('name', name);
548
+ return this.requestRaw('POST', '/v0/management/auth-files', form, undefined, 'management');
549
+ }
550
+ deleteAuthFile(query) {
551
+ return this.requestJson('DELETE', '/v0/management/auth-files', undefined, { query }, 'management');
552
+ }
553
+ patchAuthFileStatus(body) {
554
+ return this.requestJson('PATCH', '/v0/management/auth-files/status', body, undefined, 'management');
555
+ }
556
+ importVertexCredential(file) {
557
+ const form = new FormData();
558
+ form.append('file', file);
559
+ return this.requestRaw('POST', '/v0/management/vertex/import', form, undefined, 'management');
560
+ }
561
+ requestAnthropicAuthUrl() {
562
+ return this.requestJson('GET', '/v0/management/anthropic-auth-url', undefined, undefined, 'management');
563
+ }
564
+ requestCodexAuthUrl() {
565
+ return this.requestJson('GET', '/v0/management/codex-auth-url', undefined, undefined, 'management');
566
+ }
567
+ requestGeminiCliAuthUrl() {
568
+ return this.requestJson('GET', '/v0/management/gemini-cli-auth-url', undefined, undefined, 'management');
569
+ }
570
+ requestAntigravityAuthUrl() {
571
+ return this.requestJson('GET', '/v0/management/antigravity-auth-url', undefined, undefined, 'management');
572
+ }
573
+ requestQwenAuthUrl() {
574
+ return this.requestJson('GET', '/v0/management/qwen-auth-url', undefined, undefined, 'management');
575
+ }
576
+ requestKimiAuthUrl() {
577
+ return this.requestJson('GET', '/v0/management/kimi-auth-url', undefined, undefined, 'management');
578
+ }
579
+ requestIFlowAuthUrl() {
580
+ return this.requestJson('GET', '/v0/management/iflow-auth-url', undefined, undefined, 'management');
581
+ }
582
+ requestIFlowCookieToken(body) {
583
+ return this.requestJson('POST', '/v0/management/iflow-auth-url', body, undefined, 'management');
584
+ }
585
+ postOAuthCallback(body) {
586
+ return this.requestJson('POST', '/v0/management/oauth-callback', body, undefined, 'management');
587
+ }
588
+ getAuthStatus(query) {
589
+ return this.requestJson('GET', '/v0/management/get-auth-status', undefined, { query }, 'management');
590
+ }
591
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './client.js';
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './client.js';