@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.
- package/README.md +428 -0
- package/dist/claude/client.d.ts +8 -0
- package/dist/claude/client.js +16 -0
- package/dist/claude/index.d.ts +2 -0
- package/dist/claude/index.js +1 -0
- package/dist/client.d.ts +19 -0
- package/dist/client.js +96 -0
- package/dist/cliproxy/client.d.ts +41 -0
- package/dist/cliproxy/client.js +43 -0
- package/dist/cliproxy/index.d.ts +2 -0
- package/dist/cliproxy/index.js +1 -0
- package/dist/codec.d.ts +8 -0
- package/dist/codec.js +79 -0
- package/dist/errors/index.d.ts +13 -0
- package/dist/errors/index.js +26 -0
- package/dist/gemini/client.d.ts +9 -0
- package/dist/gemini/client.js +19 -0
- package/dist/gemini/index.d.ts +2 -0
- package/dist/gemini/index.js +1 -0
- package/dist/http/client.d.ts +260 -0
- package/dist/http/client.js +591 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +2 -0
- package/dist/http/types.d.ts +783 -0
- package/dist/http/types.js +1 -0
- package/dist/http-client.d.ts +259 -0
- package/dist/http-client.js +557 -0
- package/dist/http-types.d.ts +677 -0
- package/dist/http-types.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/management/client.d.ts +187 -0
- package/dist/management/client.js +399 -0
- package/dist/management/index.d.ts +2 -0
- package/dist/management/index.js +1 -0
- package/dist/openai/client.d.ts +10 -0
- package/dist/openai/client.js +23 -0
- package/dist/openai/index.d.ts +2 -0
- package/dist/openai/index.js +1 -0
- package/dist/shared/errors.d.ts +13 -0
- package/dist/shared/errors.js +26 -0
- package/dist/shared/http.d.ts +29 -0
- package/dist/shared/http.js +125 -0
- package/dist/shared/index.d.ts +2 -0
- package/dist/shared/index.js +2 -0
- package/dist/shared/types.d.ts +789 -0
- package/dist/shared/types.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types.d.ts +101 -0
- package/dist/types.js +1 -0
- package/dist/utils/index.d.ts +0 -0
- package/dist/utils/index.js +2 -0
- package/dist/ws/client.d.ts +20 -0
- package/dist/ws/client.js +114 -0
- package/dist/ws/codec.d.ts +8 -0
- package/dist/ws/codec.js +100 -0
- package/dist/ws/index.d.ts +3 -0
- package/dist/ws/index.js +3 -0
- package/dist/ws/types.d.ts +101 -0
- package/dist/ws/types.js +1 -0
- package/package.json +29 -0
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
export type JsonValue = unknown;
|
|
2
|
+
export type JsonObject = Record<string, unknown>;
|
|
3
|
+
export type JsonArray = unknown[];
|
|
4
|
+
export type PrimaryOpenAIChatRequest = OpenAIChatCompletionRequest;
|
|
5
|
+
export type PrimaryOpenAICompletionRequest = OpenAICompletionRequest;
|
|
6
|
+
export type PrimaryOpenAIResponsesRequest = OpenAIResponsesRequest;
|
|
7
|
+
export type PrimaryClaudeRequest = ClaudeMessagesRequest;
|
|
8
|
+
export type PrimaryGeminiRequest = GeminiGenerateContentRequest;
|
|
9
|
+
export type PrimaryCliproxyRequest = CliproxyChatRequest;
|
|
10
|
+
export interface OpenAIErrorDetail {
|
|
11
|
+
message: string;
|
|
12
|
+
type: string;
|
|
13
|
+
code?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OpenAIErrorResponse {
|
|
16
|
+
error: OpenAIErrorDetail;
|
|
17
|
+
}
|
|
18
|
+
export interface RootResponse {
|
|
19
|
+
message: string;
|
|
20
|
+
endpoints: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface KeepAliveResponse {
|
|
23
|
+
status: 'ok';
|
|
24
|
+
}
|
|
25
|
+
export interface ModelThinkingSupport {
|
|
26
|
+
min?: number;
|
|
27
|
+
max?: number;
|
|
28
|
+
zero_allowed?: boolean;
|
|
29
|
+
dynamic_allowed?: boolean;
|
|
30
|
+
levels?: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface ModelInfo {
|
|
33
|
+
id: string;
|
|
34
|
+
object: string;
|
|
35
|
+
created: number;
|
|
36
|
+
owned_by: string;
|
|
37
|
+
type: string;
|
|
38
|
+
display_name?: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
version?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
inputTokenLimit?: number;
|
|
43
|
+
outputTokenLimit?: number;
|
|
44
|
+
supportedGenerationMethods?: string[];
|
|
45
|
+
context_length?: number;
|
|
46
|
+
max_completion_tokens?: number;
|
|
47
|
+
supported_parameters?: string[];
|
|
48
|
+
thinking?: ModelThinkingSupport;
|
|
49
|
+
}
|
|
50
|
+
export interface ModelListResponse {
|
|
51
|
+
object: 'list';
|
|
52
|
+
data: ModelInfo[];
|
|
53
|
+
}
|
|
54
|
+
export interface CliproxyModelsResponse {
|
|
55
|
+
object: 'list';
|
|
56
|
+
format: 'openai' | 'claude' | 'gemini' | 'generic';
|
|
57
|
+
data: ModelInfo[];
|
|
58
|
+
}
|
|
59
|
+
export interface CliproxyAuthModelEntry {
|
|
60
|
+
id: string;
|
|
61
|
+
type?: string;
|
|
62
|
+
display_name?: string;
|
|
63
|
+
owned_by?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface CliproxyAuthEntry {
|
|
66
|
+
auth_id: string;
|
|
67
|
+
provider: string;
|
|
68
|
+
label?: string;
|
|
69
|
+
status?: string;
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
unavailable?: boolean;
|
|
72
|
+
models: CliproxyAuthModelEntry[];
|
|
73
|
+
}
|
|
74
|
+
export interface CliproxyAuthsResponse {
|
|
75
|
+
object: 'list';
|
|
76
|
+
data: CliproxyAuthEntry[];
|
|
77
|
+
}
|
|
78
|
+
export interface SDKConfig {
|
|
79
|
+
'proxy-url'?: string;
|
|
80
|
+
'force-model-prefix'?: boolean;
|
|
81
|
+
'request-log'?: boolean;
|
|
82
|
+
'api-keys'?: string[];
|
|
83
|
+
auth?: AccessConfig;
|
|
84
|
+
streaming?: StreamingConfig;
|
|
85
|
+
'nonstream-keepalive-interval'?: number;
|
|
86
|
+
}
|
|
87
|
+
export interface StreamingConfig {
|
|
88
|
+
'keepalive-seconds'?: number;
|
|
89
|
+
'bootstrap-retries'?: number;
|
|
90
|
+
}
|
|
91
|
+
export interface AccessConfig {
|
|
92
|
+
providers?: AccessProvider[];
|
|
93
|
+
}
|
|
94
|
+
export interface AccessProvider {
|
|
95
|
+
name: string;
|
|
96
|
+
type: string;
|
|
97
|
+
sdk?: string;
|
|
98
|
+
'api-keys'?: string[];
|
|
99
|
+
config?: Record<string, unknown>;
|
|
100
|
+
}
|
|
101
|
+
export interface TLSConfig {
|
|
102
|
+
enable: boolean;
|
|
103
|
+
cert: string;
|
|
104
|
+
key: string;
|
|
105
|
+
}
|
|
106
|
+
export interface PprofConfig {
|
|
107
|
+
enable: boolean;
|
|
108
|
+
addr: string;
|
|
109
|
+
}
|
|
110
|
+
export interface RemoteManagementConfig {
|
|
111
|
+
'allow-remote'?: boolean;
|
|
112
|
+
'secret-key'?: string;
|
|
113
|
+
'disable-control-panel'?: boolean;
|
|
114
|
+
'panel-github-repository'?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface QuotaExceededConfig {
|
|
117
|
+
'switch-project': boolean;
|
|
118
|
+
'switch-preview-model': boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface RoutingConfig {
|
|
121
|
+
strategy?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface OAuthModelAlias {
|
|
124
|
+
name: string;
|
|
125
|
+
alias: string;
|
|
126
|
+
fork?: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface AmpModelMapping {
|
|
129
|
+
from: string;
|
|
130
|
+
to: string;
|
|
131
|
+
regex?: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface AmpUpstreamAPIKeyEntry {
|
|
134
|
+
'upstream-api-key': string;
|
|
135
|
+
'api-keys': string[];
|
|
136
|
+
}
|
|
137
|
+
export interface AmpCodeConfig {
|
|
138
|
+
'upstream-url': string;
|
|
139
|
+
'upstream-api-key': string;
|
|
140
|
+
'upstream-api-keys'?: AmpUpstreamAPIKeyEntry[];
|
|
141
|
+
'restrict-management-to-localhost': boolean;
|
|
142
|
+
'model-mappings': AmpModelMapping[];
|
|
143
|
+
'force-model-mappings': boolean;
|
|
144
|
+
}
|
|
145
|
+
export interface PayloadConfig {
|
|
146
|
+
default: PayloadRule[];
|
|
147
|
+
'default-raw': PayloadRule[];
|
|
148
|
+
override: PayloadRule[];
|
|
149
|
+
'override-raw': PayloadRule[];
|
|
150
|
+
filter: PayloadFilterRule[];
|
|
151
|
+
}
|
|
152
|
+
export interface PayloadFilterRule {
|
|
153
|
+
models: PayloadModelRule[];
|
|
154
|
+
params: string[];
|
|
155
|
+
}
|
|
156
|
+
export interface PayloadRule {
|
|
157
|
+
models: PayloadModelRule[];
|
|
158
|
+
params: Record<string, unknown>;
|
|
159
|
+
}
|
|
160
|
+
export interface PayloadModelRule {
|
|
161
|
+
name: string;
|
|
162
|
+
protocol: string;
|
|
163
|
+
}
|
|
164
|
+
export interface CloakConfig {
|
|
165
|
+
mode?: string;
|
|
166
|
+
'strict-mode'?: boolean;
|
|
167
|
+
'sensitive-words'?: string[];
|
|
168
|
+
}
|
|
169
|
+
export interface ClaudeModel {
|
|
170
|
+
name: string;
|
|
171
|
+
alias: string;
|
|
172
|
+
}
|
|
173
|
+
export interface ClaudeKey {
|
|
174
|
+
'api-key': string;
|
|
175
|
+
priority?: number;
|
|
176
|
+
prefix?: string;
|
|
177
|
+
'base-url': string;
|
|
178
|
+
'proxy-url': string;
|
|
179
|
+
models: ClaudeModel[];
|
|
180
|
+
headers?: Record<string, string>;
|
|
181
|
+
'excluded-models'?: string[];
|
|
182
|
+
cloak?: CloakConfig;
|
|
183
|
+
}
|
|
184
|
+
export interface CodexModel {
|
|
185
|
+
name: string;
|
|
186
|
+
alias: string;
|
|
187
|
+
}
|
|
188
|
+
export interface CodexKey {
|
|
189
|
+
'api-key': string;
|
|
190
|
+
priority?: number;
|
|
191
|
+
prefix?: string;
|
|
192
|
+
'base-url': string;
|
|
193
|
+
'proxy-url': string;
|
|
194
|
+
models: CodexModel[];
|
|
195
|
+
headers?: Record<string, string>;
|
|
196
|
+
'excluded-models'?: string[];
|
|
197
|
+
}
|
|
198
|
+
export interface GeminiModel {
|
|
199
|
+
name: string;
|
|
200
|
+
alias: string;
|
|
201
|
+
}
|
|
202
|
+
export interface GeminiKey {
|
|
203
|
+
'api-key': string;
|
|
204
|
+
priority?: number;
|
|
205
|
+
prefix?: string;
|
|
206
|
+
'base-url'?: string;
|
|
207
|
+
'proxy-url'?: string;
|
|
208
|
+
models?: GeminiModel[];
|
|
209
|
+
headers?: Record<string, string>;
|
|
210
|
+
'excluded-models'?: string[];
|
|
211
|
+
}
|
|
212
|
+
export interface OpenAICompatibilityAPIKey {
|
|
213
|
+
'api-key': string;
|
|
214
|
+
'proxy-url'?: string;
|
|
215
|
+
}
|
|
216
|
+
export interface OpenAICompatibilityModel {
|
|
217
|
+
name: string;
|
|
218
|
+
alias: string;
|
|
219
|
+
}
|
|
220
|
+
export interface OpenAICompatibility {
|
|
221
|
+
name: string;
|
|
222
|
+
priority?: number;
|
|
223
|
+
prefix?: string;
|
|
224
|
+
'base-url': string;
|
|
225
|
+
'api-key-entries'?: OpenAICompatibilityAPIKey[];
|
|
226
|
+
models: OpenAICompatibilityModel[];
|
|
227
|
+
headers?: Record<string, string>;
|
|
228
|
+
}
|
|
229
|
+
export interface VertexCompatModel {
|
|
230
|
+
name: string;
|
|
231
|
+
alias: string;
|
|
232
|
+
}
|
|
233
|
+
export interface VertexCompatKey {
|
|
234
|
+
'api-key': string;
|
|
235
|
+
priority?: number;
|
|
236
|
+
prefix?: string;
|
|
237
|
+
'base-url'?: string;
|
|
238
|
+
'proxy-url'?: string;
|
|
239
|
+
headers?: Record<string, string>;
|
|
240
|
+
models?: VertexCompatModel[];
|
|
241
|
+
}
|
|
242
|
+
export interface Config extends SDKConfig {
|
|
243
|
+
tls: TLSConfig;
|
|
244
|
+
debug: boolean;
|
|
245
|
+
pprof: PprofConfig;
|
|
246
|
+
'commercial-mode': boolean;
|
|
247
|
+
'logging-to-file': boolean;
|
|
248
|
+
'logs-max-total-size-mb': number;
|
|
249
|
+
'error-logs-max-files': number;
|
|
250
|
+
'usage-statistics-enabled': boolean;
|
|
251
|
+
'disable-cooling': boolean;
|
|
252
|
+
'request-retry': number;
|
|
253
|
+
'max-retry-interval': number;
|
|
254
|
+
'quota-exceeded': QuotaExceededConfig;
|
|
255
|
+
routing: RoutingConfig;
|
|
256
|
+
'ws-auth': boolean;
|
|
257
|
+
'gemini-api-key': GeminiKey[];
|
|
258
|
+
'codex-api-key': CodexKey[];
|
|
259
|
+
'claude-api-key': ClaudeKey[];
|
|
260
|
+
'openai-compatibility': OpenAICompatibility[];
|
|
261
|
+
'vertex-api-key': VertexCompatKey[];
|
|
262
|
+
ampcode: AmpCodeConfig;
|
|
263
|
+
'oauth-excluded-models'?: Record<string, string[]>;
|
|
264
|
+
'oauth-model-alias'?: Record<string, OAuthModelAlias[]>;
|
|
265
|
+
payload: PayloadConfig;
|
|
266
|
+
}
|
|
267
|
+
export interface UsageTokenStats {
|
|
268
|
+
input_tokens: number;
|
|
269
|
+
output_tokens: number;
|
|
270
|
+
reasoning_tokens: number;
|
|
271
|
+
cached_tokens: number;
|
|
272
|
+
total_tokens: number;
|
|
273
|
+
}
|
|
274
|
+
export interface UsageRequestDetail {
|
|
275
|
+
timestamp: string;
|
|
276
|
+
source: string;
|
|
277
|
+
auth_index: string;
|
|
278
|
+
tokens: UsageTokenStats;
|
|
279
|
+
failed: boolean;
|
|
280
|
+
}
|
|
281
|
+
export interface UsageModelSnapshot {
|
|
282
|
+
total_requests: number;
|
|
283
|
+
total_tokens: number;
|
|
284
|
+
details: UsageRequestDetail[];
|
|
285
|
+
}
|
|
286
|
+
export interface UsageApiSnapshot {
|
|
287
|
+
total_requests: number;
|
|
288
|
+
total_tokens: number;
|
|
289
|
+
models: Record<string, UsageModelSnapshot>;
|
|
290
|
+
}
|
|
291
|
+
export interface UsageStatisticsSnapshot {
|
|
292
|
+
total_requests: number;
|
|
293
|
+
success_count: number;
|
|
294
|
+
failure_count: number;
|
|
295
|
+
total_tokens: number;
|
|
296
|
+
apis: Record<string, UsageApiSnapshot>;
|
|
297
|
+
requests_by_day: Record<string, number>;
|
|
298
|
+
requests_by_hour: Record<string, number>;
|
|
299
|
+
tokens_by_day: Record<string, number>;
|
|
300
|
+
tokens_by_hour: Record<string, number>;
|
|
301
|
+
}
|
|
302
|
+
export interface UsageGetResponse {
|
|
303
|
+
usage: UsageStatisticsSnapshot;
|
|
304
|
+
failed_requests: number;
|
|
305
|
+
}
|
|
306
|
+
export interface UsageExportResponse {
|
|
307
|
+
version: number;
|
|
308
|
+
exported_at: string;
|
|
309
|
+
usage: UsageStatisticsSnapshot;
|
|
310
|
+
}
|
|
311
|
+
export interface UsageImportRequest {
|
|
312
|
+
version: number;
|
|
313
|
+
usage: UsageStatisticsSnapshot;
|
|
314
|
+
}
|
|
315
|
+
export interface UsageImportResponse {
|
|
316
|
+
added: number;
|
|
317
|
+
skipped: number;
|
|
318
|
+
total_requests: number;
|
|
319
|
+
failed_requests: number;
|
|
320
|
+
}
|
|
321
|
+
export interface ApiCallRequest {
|
|
322
|
+
auth_index?: string;
|
|
323
|
+
authIndex?: string;
|
|
324
|
+
AuthIndex?: string;
|
|
325
|
+
method: string;
|
|
326
|
+
url: string;
|
|
327
|
+
header: Record<string, string>;
|
|
328
|
+
data: string;
|
|
329
|
+
}
|
|
330
|
+
export interface ApiCallResponse {
|
|
331
|
+
status_code: number;
|
|
332
|
+
header: Record<string, string[]>;
|
|
333
|
+
body: string;
|
|
334
|
+
}
|
|
335
|
+
export interface ErrorResponse {
|
|
336
|
+
error: string;
|
|
337
|
+
message?: string;
|
|
338
|
+
}
|
|
339
|
+
export interface StatusResponse {
|
|
340
|
+
status: 'ok' | 'error' | 'wait';
|
|
341
|
+
error?: string;
|
|
342
|
+
url?: string;
|
|
343
|
+
state?: string;
|
|
344
|
+
deleted?: number;
|
|
345
|
+
disabled?: boolean;
|
|
346
|
+
}
|
|
347
|
+
export type KeyedValueResponse<K extends string, T> = {
|
|
348
|
+
[P in K]: T;
|
|
349
|
+
};
|
|
350
|
+
export interface LogLinesResponse {
|
|
351
|
+
lines: string[];
|
|
352
|
+
'line-count': number;
|
|
353
|
+
'latest-timestamp': number;
|
|
354
|
+
}
|
|
355
|
+
export interface DeleteLogsResponse {
|
|
356
|
+
success: boolean;
|
|
357
|
+
message: string;
|
|
358
|
+
removed: number;
|
|
359
|
+
}
|
|
360
|
+
export interface ErrorLogFileInfo {
|
|
361
|
+
name: string;
|
|
362
|
+
size: number;
|
|
363
|
+
modified: number;
|
|
364
|
+
}
|
|
365
|
+
export interface ErrorLogFilesResponse {
|
|
366
|
+
files: ErrorLogFileInfo[];
|
|
367
|
+
}
|
|
368
|
+
export interface AuthFileEntry {
|
|
369
|
+
id?: string;
|
|
370
|
+
auth_index?: number;
|
|
371
|
+
name?: string;
|
|
372
|
+
type?: string;
|
|
373
|
+
provider?: string;
|
|
374
|
+
label?: string;
|
|
375
|
+
status?: string;
|
|
376
|
+
status_message?: string;
|
|
377
|
+
disabled?: boolean;
|
|
378
|
+
unavailable?: boolean;
|
|
379
|
+
runtime_only?: boolean;
|
|
380
|
+
source?: 'memory' | 'file';
|
|
381
|
+
size?: number;
|
|
382
|
+
email?: string;
|
|
383
|
+
account_type?: string;
|
|
384
|
+
account?: string;
|
|
385
|
+
created_at?: string;
|
|
386
|
+
modtime?: string;
|
|
387
|
+
updated_at?: string;
|
|
388
|
+
last_refresh?: string;
|
|
389
|
+
path?: string;
|
|
390
|
+
id_token?: Record<string, unknown>;
|
|
391
|
+
}
|
|
392
|
+
export interface AuthFileListResponse {
|
|
393
|
+
files: AuthFileEntry[];
|
|
394
|
+
}
|
|
395
|
+
export interface AuthFileModelsResponse {
|
|
396
|
+
models: CliproxyAuthModelEntry[];
|
|
397
|
+
}
|
|
398
|
+
export interface AuthFileUploadResponse {
|
|
399
|
+
status: 'ok';
|
|
400
|
+
}
|
|
401
|
+
export interface AuthFileDeleteResponse {
|
|
402
|
+
status: 'ok';
|
|
403
|
+
deleted: number;
|
|
404
|
+
}
|
|
405
|
+
export interface AuthFileStatusRequest {
|
|
406
|
+
name: string;
|
|
407
|
+
disabled: boolean;
|
|
408
|
+
}
|
|
409
|
+
export interface AuthFileStatusResponse {
|
|
410
|
+
status: 'ok';
|
|
411
|
+
disabled: boolean;
|
|
412
|
+
}
|
|
413
|
+
export interface OAuthCallbackRequest {
|
|
414
|
+
provider: string;
|
|
415
|
+
redirect_url: string;
|
|
416
|
+
code: string;
|
|
417
|
+
state: string;
|
|
418
|
+
error?: string;
|
|
419
|
+
}
|
|
420
|
+
export interface OAuthCallbackResponse {
|
|
421
|
+
status: 'ok';
|
|
422
|
+
}
|
|
423
|
+
export interface OAuthStartResponse {
|
|
424
|
+
status: 'ok';
|
|
425
|
+
url: string;
|
|
426
|
+
state: string;
|
|
427
|
+
}
|
|
428
|
+
export interface AuthStatusResponse {
|
|
429
|
+
status: 'ok' | 'error' | 'wait';
|
|
430
|
+
error?: string;
|
|
431
|
+
}
|
|
432
|
+
export interface AuthFileDownloadRequest {
|
|
433
|
+
name: string;
|
|
434
|
+
}
|
|
435
|
+
export interface AuthFileListQuery {
|
|
436
|
+
provider?: string;
|
|
437
|
+
}
|
|
438
|
+
export interface AuthFileModelsQuery {
|
|
439
|
+
name: string;
|
|
440
|
+
}
|
|
441
|
+
export interface CliproxyAuthsQuery {
|
|
442
|
+
provider?: string;
|
|
443
|
+
}
|
|
444
|
+
export interface CliproxyModelsQuery {
|
|
445
|
+
format?: 'openai' | 'claude' | 'gemini' | 'generic';
|
|
446
|
+
}
|
|
447
|
+
export interface PatchStringListRequest {
|
|
448
|
+
old?: string;
|
|
449
|
+
new?: string;
|
|
450
|
+
index?: number;
|
|
451
|
+
value?: string;
|
|
452
|
+
}
|
|
453
|
+
export interface PatchByIndexOrMatch<TPatch> {
|
|
454
|
+
index?: number;
|
|
455
|
+
match?: string;
|
|
456
|
+
value?: TPatch;
|
|
457
|
+
}
|
|
458
|
+
export interface GeminiKeyPatch {
|
|
459
|
+
'api-key'?: string;
|
|
460
|
+
prefix?: string;
|
|
461
|
+
'base-url'?: string;
|
|
462
|
+
'proxy-url'?: string;
|
|
463
|
+
headers?: Record<string, string>;
|
|
464
|
+
'excluded-models'?: string[];
|
|
465
|
+
}
|
|
466
|
+
export interface ClaudeKeyPatch {
|
|
467
|
+
'api-key'?: string;
|
|
468
|
+
prefix?: string;
|
|
469
|
+
'base-url'?: string;
|
|
470
|
+
'proxy-url'?: string;
|
|
471
|
+
models?: ClaudeModel[];
|
|
472
|
+
headers?: Record<string, string>;
|
|
473
|
+
'excluded-models'?: string[];
|
|
474
|
+
}
|
|
475
|
+
export interface CodexKeyPatch {
|
|
476
|
+
'api-key'?: string;
|
|
477
|
+
prefix?: string;
|
|
478
|
+
'base-url'?: string;
|
|
479
|
+
'proxy-url'?: string;
|
|
480
|
+
models?: CodexModel[];
|
|
481
|
+
headers?: Record<string, string>;
|
|
482
|
+
'excluded-models'?: string[];
|
|
483
|
+
}
|
|
484
|
+
export interface OpenAICompatPatch {
|
|
485
|
+
name?: string;
|
|
486
|
+
prefix?: string;
|
|
487
|
+
'base-url'?: string;
|
|
488
|
+
'api-key-entries'?: OpenAICompatibilityAPIKey[];
|
|
489
|
+
models?: OpenAICompatibilityModel[];
|
|
490
|
+
headers?: Record<string, string>;
|
|
491
|
+
}
|
|
492
|
+
export interface VertexCompatPatch {
|
|
493
|
+
'api-key'?: string;
|
|
494
|
+
prefix?: string;
|
|
495
|
+
'base-url'?: string;
|
|
496
|
+
'proxy-url'?: string;
|
|
497
|
+
headers?: Record<string, string>;
|
|
498
|
+
models?: VertexCompatModel[];
|
|
499
|
+
}
|
|
500
|
+
export interface OAuthExcludedModelsPatch {
|
|
501
|
+
provider?: string;
|
|
502
|
+
models: string[];
|
|
503
|
+
}
|
|
504
|
+
export interface OAuthModelAliasPatch {
|
|
505
|
+
provider?: string;
|
|
506
|
+
channel?: string;
|
|
507
|
+
aliases: OAuthModelAlias[];
|
|
508
|
+
}
|
|
509
|
+
export interface AmpModelMappingsPatch {
|
|
510
|
+
value: AmpModelMapping[];
|
|
511
|
+
}
|
|
512
|
+
export interface AmpUpstreamAPIKeysPatch {
|
|
513
|
+
value: AmpUpstreamAPIKeyEntry[];
|
|
514
|
+
}
|
|
515
|
+
export interface AmpStringListPatch {
|
|
516
|
+
value: string[];
|
|
517
|
+
}
|
|
518
|
+
export interface AuthFileUploadRequest {
|
|
519
|
+
file: Blob;
|
|
520
|
+
name?: string;
|
|
521
|
+
}
|
|
522
|
+
export interface VertexImportRequest {
|
|
523
|
+
file: Blob;
|
|
524
|
+
}
|
|
525
|
+
export type OpenAIChatRole = 'system' | 'user' | 'assistant' | 'tool' | 'developer';
|
|
526
|
+
export interface OpenAIChatMessageContentText {
|
|
527
|
+
type: 'text';
|
|
528
|
+
text: string;
|
|
529
|
+
}
|
|
530
|
+
export interface OpenAIChatMessageContentImageUrl {
|
|
531
|
+
type: 'image_url';
|
|
532
|
+
image_url: {
|
|
533
|
+
url: string;
|
|
534
|
+
detail?: 'low' | 'high' | 'auto';
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
export type OpenAIChatMessageContentPart = OpenAIChatMessageContentText | OpenAIChatMessageContentImageUrl;
|
|
538
|
+
export interface OpenAIChatMessage {
|
|
539
|
+
role: OpenAIChatRole;
|
|
540
|
+
content: string | OpenAIChatMessageContentPart[];
|
|
541
|
+
name?: string;
|
|
542
|
+
tool_call_id?: string;
|
|
543
|
+
tool_calls?: JsonArray;
|
|
544
|
+
}
|
|
545
|
+
export interface OpenAIChatCompletionRequest extends JsonObject {
|
|
546
|
+
model: string;
|
|
547
|
+
messages: OpenAIChatMessage[];
|
|
548
|
+
stream?: boolean;
|
|
549
|
+
max_tokens?: number;
|
|
550
|
+
temperature?: number;
|
|
551
|
+
top_p?: number;
|
|
552
|
+
stop?: string | string[];
|
|
553
|
+
tools?: JsonArray;
|
|
554
|
+
tool_choice?: JsonValue;
|
|
555
|
+
response_format?: JsonObject;
|
|
556
|
+
}
|
|
557
|
+
export interface OpenAICompletionRequest extends JsonObject {
|
|
558
|
+
model: string;
|
|
559
|
+
prompt: string | string[];
|
|
560
|
+
stream?: boolean;
|
|
561
|
+
max_tokens?: number;
|
|
562
|
+
temperature?: number;
|
|
563
|
+
top_p?: number;
|
|
564
|
+
stop?: string | string[];
|
|
565
|
+
}
|
|
566
|
+
export interface OpenAIResponsesInputText {
|
|
567
|
+
type: 'input_text';
|
|
568
|
+
text: string;
|
|
569
|
+
}
|
|
570
|
+
export interface OpenAIResponsesInputImage {
|
|
571
|
+
type: 'input_image';
|
|
572
|
+
image_url: string;
|
|
573
|
+
}
|
|
574
|
+
export type OpenAIResponsesInputContent = OpenAIResponsesInputText | OpenAIResponsesInputImage;
|
|
575
|
+
export interface OpenAIResponsesInputMessage {
|
|
576
|
+
role: 'system' | 'user' | 'assistant' | 'developer';
|
|
577
|
+
content: string | OpenAIResponsesInputContent[];
|
|
578
|
+
}
|
|
579
|
+
export interface OpenAIResponsesRequest extends JsonObject {
|
|
580
|
+
model: string;
|
|
581
|
+
input: string | OpenAIResponsesInputMessage[] | OpenAIResponsesInputContent[];
|
|
582
|
+
stream?: boolean;
|
|
583
|
+
max_output_tokens?: number;
|
|
584
|
+
temperature?: number;
|
|
585
|
+
top_p?: number;
|
|
586
|
+
tools?: JsonArray;
|
|
587
|
+
tool_choice?: JsonValue;
|
|
588
|
+
}
|
|
589
|
+
export type OpenAICompatibleRequest = OpenAIChatCompletionRequest | OpenAICompletionRequest | OpenAIResponsesRequest | JsonObject;
|
|
590
|
+
export interface OpenAIChatCompletionChoice {
|
|
591
|
+
index: number;
|
|
592
|
+
message: OpenAIChatMessage;
|
|
593
|
+
finish_reason?: string | null;
|
|
594
|
+
}
|
|
595
|
+
export interface OpenAIChatCompletionResponse {
|
|
596
|
+
id: string;
|
|
597
|
+
object: 'chat.completion';
|
|
598
|
+
created: number;
|
|
599
|
+
model: string;
|
|
600
|
+
choices: OpenAIChatCompletionChoice[];
|
|
601
|
+
usage?: JsonObject;
|
|
602
|
+
}
|
|
603
|
+
export interface OpenAIChatCompletionChunkChoice {
|
|
604
|
+
index: number;
|
|
605
|
+
delta: Partial<OpenAIChatMessage>;
|
|
606
|
+
finish_reason?: string | null;
|
|
607
|
+
}
|
|
608
|
+
export interface OpenAIChatCompletionChunk {
|
|
609
|
+
id: string;
|
|
610
|
+
object: 'chat.completion.chunk';
|
|
611
|
+
created: number;
|
|
612
|
+
model: string;
|
|
613
|
+
choices: OpenAIChatCompletionChunkChoice[];
|
|
614
|
+
}
|
|
615
|
+
export interface OpenAICompletionChoice {
|
|
616
|
+
index: number;
|
|
617
|
+
text: string;
|
|
618
|
+
finish_reason?: string | null;
|
|
619
|
+
logprobs?: JsonValue;
|
|
620
|
+
}
|
|
621
|
+
export interface OpenAICompletionResponse {
|
|
622
|
+
id: string;
|
|
623
|
+
object: 'text_completion';
|
|
624
|
+
created: number;
|
|
625
|
+
model: string;
|
|
626
|
+
choices: OpenAICompletionChoice[];
|
|
627
|
+
usage?: JsonObject;
|
|
628
|
+
}
|
|
629
|
+
export interface OpenAICompletionChunk {
|
|
630
|
+
id: string;
|
|
631
|
+
object: 'text_completion';
|
|
632
|
+
created: number;
|
|
633
|
+
model: string;
|
|
634
|
+
choices: OpenAICompletionChoice[];
|
|
635
|
+
}
|
|
636
|
+
export interface OpenAIResponsesOutput {
|
|
637
|
+
type: string;
|
|
638
|
+
id?: string;
|
|
639
|
+
role?: string;
|
|
640
|
+
content?: JsonArray;
|
|
641
|
+
annotations?: JsonArray;
|
|
642
|
+
}
|
|
643
|
+
export interface OpenAIResponsesResponse {
|
|
644
|
+
id: string;
|
|
645
|
+
object: 'response';
|
|
646
|
+
created: number;
|
|
647
|
+
model: string;
|
|
648
|
+
output: OpenAIResponsesOutput[];
|
|
649
|
+
usage?: JsonObject;
|
|
650
|
+
}
|
|
651
|
+
export interface OpenAIResponsesChunk {
|
|
652
|
+
id: string;
|
|
653
|
+
object: 'response.chunk';
|
|
654
|
+
created: number;
|
|
655
|
+
model: string;
|
|
656
|
+
output?: OpenAIResponsesOutput[];
|
|
657
|
+
}
|
|
658
|
+
export type OpenAICompatibleResponse = OpenAIChatCompletionResponse | OpenAIChatCompletionChunk | OpenAICompletionResponse | OpenAICompletionChunk | OpenAIResponsesResponse | OpenAIResponsesChunk | JsonObject;
|
|
659
|
+
export interface CliproxyChatRequest extends JsonObject {
|
|
660
|
+
model: string;
|
|
661
|
+
auth_id?: string;
|
|
662
|
+
authId?: string;
|
|
663
|
+
messages?: OpenAIChatMessage[] | JsonArray;
|
|
664
|
+
input?: string;
|
|
665
|
+
prompt?: string;
|
|
666
|
+
system?: string;
|
|
667
|
+
stream?: boolean;
|
|
668
|
+
}
|
|
669
|
+
export type ClaudeMessageRole = 'user' | 'assistant';
|
|
670
|
+
export interface ClaudeContentText {
|
|
671
|
+
type: 'text';
|
|
672
|
+
text: string;
|
|
673
|
+
}
|
|
674
|
+
export interface ClaudeContentImage {
|
|
675
|
+
type: 'image';
|
|
676
|
+
source: {
|
|
677
|
+
type: 'base64' | 'url';
|
|
678
|
+
media_type?: string;
|
|
679
|
+
data?: string;
|
|
680
|
+
url?: string;
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
export type ClaudeContentBlock = ClaudeContentText | ClaudeContentImage;
|
|
684
|
+
export interface ClaudeMessage {
|
|
685
|
+
role: ClaudeMessageRole;
|
|
686
|
+
content: string | ClaudeContentBlock[];
|
|
687
|
+
}
|
|
688
|
+
export interface ClaudeMessagesRequest extends JsonObject {
|
|
689
|
+
model: string;
|
|
690
|
+
messages: ClaudeMessage[];
|
|
691
|
+
system?: string | ClaudeContentBlock[];
|
|
692
|
+
max_tokens?: number;
|
|
693
|
+
temperature?: number;
|
|
694
|
+
top_p?: number;
|
|
695
|
+
top_k?: number;
|
|
696
|
+
stream?: boolean;
|
|
697
|
+
stop_sequences?: string[];
|
|
698
|
+
tools?: JsonArray;
|
|
699
|
+
}
|
|
700
|
+
export interface ClaudeCompatibleRequest extends ClaudeMessagesRequest {
|
|
701
|
+
}
|
|
702
|
+
export interface ClaudeUsage {
|
|
703
|
+
input_tokens?: number;
|
|
704
|
+
output_tokens?: number;
|
|
705
|
+
cache_read_input_tokens?: number;
|
|
706
|
+
cache_creation_input_tokens?: number;
|
|
707
|
+
}
|
|
708
|
+
export interface ClaudeMessagesResponse {
|
|
709
|
+
id: string;
|
|
710
|
+
type: 'message';
|
|
711
|
+
role: 'assistant';
|
|
712
|
+
content: ClaudeContentBlock[];
|
|
713
|
+
model: string;
|
|
714
|
+
stop_reason?: string | null;
|
|
715
|
+
stop_sequence?: string | null;
|
|
716
|
+
usage?: ClaudeUsage;
|
|
717
|
+
}
|
|
718
|
+
export type ClaudeStreamEventType = 'message_start' | 'content_block_start' | 'content_block_delta' | 'content_block_stop' | 'message_delta' | 'message_stop';
|
|
719
|
+
export interface ClaudeStreamEvent {
|
|
720
|
+
type: ClaudeStreamEventType;
|
|
721
|
+
message?: ClaudeMessagesResponse;
|
|
722
|
+
index?: number;
|
|
723
|
+
delta?: JsonObject;
|
|
724
|
+
usage?: ClaudeUsage;
|
|
725
|
+
}
|
|
726
|
+
export type ClaudeCompatibleResponse = ClaudeMessagesResponse | ClaudeStreamEvent | JsonObject;
|
|
727
|
+
export interface GeminiInlineData {
|
|
728
|
+
mime_type?: string;
|
|
729
|
+
data?: string;
|
|
730
|
+
}
|
|
731
|
+
export interface GeminiFunctionCall {
|
|
732
|
+
id?: string;
|
|
733
|
+
name: string;
|
|
734
|
+
args: Record<string, unknown>;
|
|
735
|
+
}
|
|
736
|
+
export interface GeminiFunctionResponse {
|
|
737
|
+
id?: string;
|
|
738
|
+
name: string;
|
|
739
|
+
response: Record<string, unknown>;
|
|
740
|
+
}
|
|
741
|
+
export interface GeminiPart {
|
|
742
|
+
thought?: boolean;
|
|
743
|
+
text?: string;
|
|
744
|
+
inlineData?: GeminiInlineData;
|
|
745
|
+
thoughtSignature?: string;
|
|
746
|
+
functionCall?: GeminiFunctionCall;
|
|
747
|
+
functionResponse?: GeminiFunctionResponse;
|
|
748
|
+
}
|
|
749
|
+
export interface GeminiContent {
|
|
750
|
+
role: 'user' | 'model' | 'tool';
|
|
751
|
+
parts: GeminiPart[];
|
|
752
|
+
}
|
|
753
|
+
export interface GeminiGenerationConfig {
|
|
754
|
+
thinkingConfig?: {
|
|
755
|
+
include_thoughts?: boolean;
|
|
756
|
+
};
|
|
757
|
+
temperature?: number;
|
|
758
|
+
topP?: number;
|
|
759
|
+
topK?: number;
|
|
760
|
+
}
|
|
761
|
+
export interface GeminiToolDeclaration {
|
|
762
|
+
functionDeclarations: JsonArray;
|
|
763
|
+
}
|
|
764
|
+
export interface GeminiGenerateContentRequest extends JsonObject {
|
|
765
|
+
systemInstruction?: GeminiContent;
|
|
766
|
+
contents: GeminiContent[];
|
|
767
|
+
tools?: GeminiToolDeclaration[];
|
|
768
|
+
generationConfig?: GeminiGenerationConfig;
|
|
769
|
+
}
|
|
770
|
+
export interface GeminiCompatibleRequest extends GeminiGenerateContentRequest {
|
|
771
|
+
}
|
|
772
|
+
export interface GeminiCandidate {
|
|
773
|
+
content?: GeminiContent;
|
|
774
|
+
finishReason?: string;
|
|
775
|
+
index?: number;
|
|
776
|
+
safetyRatings?: JsonArray;
|
|
777
|
+
}
|
|
778
|
+
export interface GeminiPromptFeedback {
|
|
779
|
+
safetyRatings?: JsonArray;
|
|
780
|
+
}
|
|
781
|
+
export interface GeminiGenerateContentResponse {
|
|
782
|
+
candidates?: GeminiCandidate[];
|
|
783
|
+
promptFeedback?: GeminiPromptFeedback;
|
|
784
|
+
}
|
|
785
|
+
export interface GeminiStreamChunk {
|
|
786
|
+
candidates?: GeminiCandidate[];
|
|
787
|
+
promptFeedback?: GeminiPromptFeedback;
|
|
788
|
+
}
|
|
789
|
+
export type GeminiCompatibleResponse = GeminiGenerateContentResponse | GeminiStreamChunk | JsonObject;
|