@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,8 @@
1
+ import type { HTTPRequest, HTTPResponse, WSErrorPayload, WSHttpRequestPayload, WSHttpResponsePayload, WSStreamChunkPayload } from './types.js';
2
+ export declare function decodeRequest(payload?: WSHttpRequestPayload): HTTPRequest;
3
+ export declare function encodeResponse(resp: HTTPResponse): WSHttpResponsePayload;
4
+ export declare function decodeResponse(payload?: WSHttpResponsePayload): HTTPResponse;
5
+ export declare function encodeChunk(chunk: string): WSStreamChunkPayload;
6
+ export declare function decodeChunk(payload?: WSStreamChunkPayload): string;
7
+ export declare function encodeError(message: string, status?: number): WSErrorPayload;
8
+ export declare function decodeError(payload?: WSErrorPayload): string;
package/dist/codec.js ADDED
@@ -0,0 +1,79 @@
1
+ export function decodeRequest(payload) {
2
+ const method = typeof payload?.method === 'string' ? payload.method : 'GET';
3
+ const url = typeof payload?.url === 'string' ? payload.url : '';
4
+ const rawHeaders = payload?.headers;
5
+ const headers = {};
6
+ if (rawHeaders) {
7
+ for (const [key, raw] of Object.entries(rawHeaders)) {
8
+ if (Array.isArray(raw)) {
9
+ headers[key] = raw.map(String);
10
+ }
11
+ else if (typeof raw === 'string') {
12
+ headers[key] = [raw];
13
+ }
14
+ }
15
+ }
16
+ const body = typeof payload?.body === 'string' ? payload.body : '';
17
+ const sent_at = typeof payload?.sent_at === 'string' ? payload.sent_at : undefined;
18
+ return { method, url, headers, body, sent_at };
19
+ }
20
+ export function encodeResponse(resp) {
21
+ const headers = {};
22
+ if (resp.headers) {
23
+ for (const [key, value] of Object.entries(resp.headers)) {
24
+ if (Array.isArray(value))
25
+ headers[key] = value.map(String);
26
+ else
27
+ headers[key] = [String(value)];
28
+ }
29
+ }
30
+ return {
31
+ status: resp.status ?? 200,
32
+ headers,
33
+ body: resp.body ?? ''
34
+ };
35
+ }
36
+ export function decodeResponse(payload) {
37
+ const status = typeof payload?.status === 'number'
38
+ ? payload.status
39
+ : typeof payload?.status === 'string'
40
+ ? Number(payload.status)
41
+ : 200;
42
+ const headers = {};
43
+ const rawHeaders = payload?.headers;
44
+ if (rawHeaders) {
45
+ for (const [key, raw] of Object.entries(rawHeaders)) {
46
+ if (Array.isArray(raw)) {
47
+ headers[key] = raw.map(String);
48
+ }
49
+ else if (typeof raw === 'string') {
50
+ headers[key] = raw;
51
+ }
52
+ }
53
+ }
54
+ const body = typeof payload?.body === 'string' ? payload.body : '';
55
+ return { status, headers, body };
56
+ }
57
+ export function encodeChunk(chunk) {
58
+ return { data: chunk ?? '' };
59
+ }
60
+ export function decodeChunk(payload) {
61
+ const data = payload?.data;
62
+ return typeof data === 'string' ? data : '';
63
+ }
64
+ export function encodeError(message, status) {
65
+ const payload = { error: message || 'wsrelay: upstream error' };
66
+ if (typeof status === 'number' && !Number.isNaN(status)) {
67
+ payload.status = status;
68
+ }
69
+ return payload;
70
+ }
71
+ export function decodeError(payload) {
72
+ const message = typeof payload?.error === 'string' ? payload.error : 'wsrelay: upstream error';
73
+ const status = typeof payload?.status === 'number'
74
+ ? payload.status
75
+ : typeof payload?.status === 'string'
76
+ ? Number(payload.status)
77
+ : 0;
78
+ return status ? `${message} (status=${status})` : message;
79
+ }
@@ -0,0 +1,13 @@
1
+ import type { OpenAIErrorResponse, ErrorResponse, StatusResponse, JsonObject } from '../http/types.js';
2
+ export type ManagementErrorResponse = ErrorResponse;
3
+ export type ApiErrorPayload = OpenAIErrorResponse | ManagementErrorResponse | StatusResponse | JsonObject | {
4
+ error: string;
5
+ };
6
+ export declare class APIError extends Error {
7
+ readonly status: number;
8
+ readonly payload?: ApiErrorPayload;
9
+ constructor(message: string, status: number, payload?: ApiErrorPayload);
10
+ }
11
+ export declare function isOpenAIError(payload: unknown): payload is OpenAIErrorResponse;
12
+ export declare function isStatusError(payload: unknown): payload is StatusResponse;
13
+ export declare function isManagementError(payload: unknown): payload is ManagementErrorResponse;
@@ -0,0 +1,26 @@
1
+ export class APIError extends Error {
2
+ constructor(message, status, payload) {
3
+ super(message);
4
+ this.name = 'APIError';
5
+ this.status = status;
6
+ this.payload = payload;
7
+ }
8
+ }
9
+ export function isOpenAIError(payload) {
10
+ if (!payload || typeof payload !== 'object')
11
+ return false;
12
+ const obj = payload;
13
+ return !!obj.error && typeof obj.error.message === 'string' && typeof obj.error.type === 'string';
14
+ }
15
+ export function isStatusError(payload) {
16
+ if (!payload || typeof payload !== 'object')
17
+ return false;
18
+ const obj = payload;
19
+ return typeof obj.status === 'string' && (obj.status === 'error' || obj.status === 'wait' || obj.status === 'ok');
20
+ }
21
+ export function isManagementError(payload) {
22
+ if (!payload || typeof payload !== 'object')
23
+ return false;
24
+ const obj = payload;
25
+ return typeof obj.error === 'string';
26
+ }
@@ -0,0 +1,9 @@
1
+ import type { GeminiCompatibleRequest } from '../shared/types.js';
2
+ import type { RequestOptions } from '../shared/http.js';
3
+ import { BaseHttpClient } from '../shared/http.js';
4
+ export declare class GeminiClient extends BaseHttpClient {
5
+ getModels(options?: RequestOptions): Promise<Response>;
6
+ postModelsAction(action: string, body: GeminiCompatibleRequest, options?: RequestOptions): Promise<Response>;
7
+ getModelsAction(action: string, query?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<Response>;
8
+ postV1Internal(method: string, body: GeminiCompatibleRequest, options?: RequestOptions): Promise<Response>;
9
+ }
@@ -0,0 +1,19 @@
1
+ import { BaseHttpClient } from '../shared/http.js';
2
+ export class GeminiClient extends BaseHttpClient {
3
+ // GET /v1beta/models
4
+ getModels(options) {
5
+ return this.requestRaw('GET', '/v1beta/models', undefined, options, 'access');
6
+ }
7
+ // POST /v1beta/models/*action
8
+ postModelsAction(action, body, options) {
9
+ return this.requestRaw('POST', `/v1beta/models/${action}`, JSON.stringify(body), options, 'access');
10
+ }
11
+ // GET /v1beta/models/*action
12
+ getModelsAction(action, query, options) {
13
+ return this.requestRaw('GET', `/v1beta/models/${action}`, undefined, { ...options, query }, 'access');
14
+ }
15
+ // POST /v1internal:method (localhost only)
16
+ postV1Internal(method, body, options) {
17
+ return this.requestRaw('POST', `/v1internal:${method}`, JSON.stringify(body), options);
18
+ }
19
+ }
@@ -0,0 +1,2 @@
1
+ export { GeminiClient } from './client.js';
2
+ export type { GeminiInlineData, GeminiFunctionCall, GeminiFunctionResponse, GeminiPart, GeminiContent, GeminiGenerationConfig, GeminiToolDeclaration, GeminiGenerateContentRequest, GeminiCandidate, GeminiPromptFeedback, GeminiGenerateContentResponse, GeminiStreamChunk, GeminiCompatibleRequest, GeminiCompatibleResponse } from '../shared/types.js';
@@ -0,0 +1 @@
1
+ export { GeminiClient } from './client.js';
@@ -0,0 +1,260 @@
1
+ import type { AmpModelMapping, AmpModelMappingsPatch, AmpUpstreamAPIKeyEntry, AmpUpstreamAPIKeysPatch, ApiCallRequest, ApiCallResponse, AuthFileDeleteResponse, AuthFileListQuery, AuthFileListResponse, AuthFileModelsQuery, AuthFileModelsResponse, AuthFileStatusRequest, AuthFileStatusResponse, AuthStatusResponse, ClaudeKey, ClaudeKeyPatch, ClaudeMessagesRequest, CliproxyAuthsQuery, CliproxyAuthsResponse, CliproxyChatRequest, CliproxyModelsQuery, CliproxyModelsResponse, CodexKey, CodexKeyPatch, Config, DeleteLogsResponse, ErrorLogFilesResponse, GeminiCompatibleRequest, GeminiGenerateContentRequest, GeminiKey, GeminiKeyPatch, KeepAliveResponse, KeyedValueResponse, LogLinesResponse, ModelListResponse, OAuthCallbackRequest, OAuthCallbackResponse, OAuthExcludedModelsPatch, OAuthModelAlias, OAuthModelAliasPatch, OAuthStartResponse, OpenAIChatCompletionRequest, OpenAICompatibility, OpenAICompatPatch, OpenAICompletionRequest, OpenAIResponsesRequest, PatchByIndexOrMatch, PatchStringListRequest, RootResponse, UsageExportResponse, UsageGetResponse, UsageImportRequest, UsageImportResponse, VertexCompatKey, VertexCompatPatch } from './types.js';
2
+ export interface HttpClientOptions {
3
+ baseUrl: string;
4
+ accessKey?: string;
5
+ managementKey?: string;
6
+ localPassword?: string;
7
+ fetch?: typeof fetch;
8
+ }
9
+ export interface RequestOptions {
10
+ query?: Record<string, string | number | boolean | undefined>;
11
+ headers?: Record<string, string>;
12
+ }
13
+ export declare class CliproxyApiClient {
14
+ readonly baseUrl: string;
15
+ private accessKey?;
16
+ private managementKey?;
17
+ private localPassword?;
18
+ private fetchImpl;
19
+ constructor(options: HttpClientOptions);
20
+ setAccessKey(key?: string): void;
21
+ setManagementKey(key?: string): void;
22
+ setLocalPassword(value?: string): void;
23
+ private buildUrl;
24
+ private requestJson;
25
+ private requestText;
26
+ private requestRaw;
27
+ private applyAuth;
28
+ private throwApiError;
29
+ getWebsocketUrl(path?: string): string;
30
+ getRoot(): Promise<RootResponse>;
31
+ getManagementHtml(): Promise<Response>;
32
+ keepAlive(): Promise<KeepAliveResponse>;
33
+ anthropicCallback(query: {
34
+ code?: string;
35
+ state?: string;
36
+ error?: string;
37
+ error_description?: string;
38
+ }): Promise<Response>;
39
+ codexCallback(query: {
40
+ code?: string;
41
+ state?: string;
42
+ error?: string;
43
+ error_description?: string;
44
+ }): Promise<Response>;
45
+ googleCallback(query: {
46
+ code?: string;
47
+ state?: string;
48
+ error?: string;
49
+ error_description?: string;
50
+ }): Promise<Response>;
51
+ iflowCallback(query: {
52
+ code?: string;
53
+ state?: string;
54
+ error?: string;
55
+ error_description?: string;
56
+ }): Promise<Response>;
57
+ antigravityCallback(query: {
58
+ code?: string;
59
+ state?: string;
60
+ error?: string;
61
+ error_description?: string;
62
+ }): Promise<Response>;
63
+ postV1Internal(method: string, body: GeminiGenerateContentRequest, options?: RequestOptions): Promise<Response>;
64
+ getModels(): Promise<ModelListResponse>;
65
+ postChatCompletions(body: OpenAIChatCompletionRequest, options?: RequestOptions): Promise<Response>;
66
+ postCompletions(body: OpenAICompletionRequest, options?: RequestOptions): Promise<Response>;
67
+ postMessages(body: ClaudeMessagesRequest, options?: RequestOptions): Promise<Response>;
68
+ postMessagesCountTokens(body: ClaudeMessagesRequest, options?: RequestOptions): Promise<Response>;
69
+ postResponses(body: OpenAIResponsesRequest, options?: RequestOptions): Promise<Response>;
70
+ postResponsesCompact(body: OpenAIResponsesRequest, options?: RequestOptions): Promise<Response>;
71
+ getCliproxyAuths(query?: CliproxyAuthsQuery): Promise<CliproxyAuthsResponse>;
72
+ getCliproxyModels(query?: CliproxyModelsQuery): Promise<CliproxyModelsResponse>;
73
+ postCliproxyChat(body: CliproxyChatRequest, options?: RequestOptions): Promise<Response>;
74
+ getGeminiModels(options?: RequestOptions): Promise<Response>;
75
+ postGeminiModelsAction(action: string, body: GeminiCompatibleRequest, options?: RequestOptions): Promise<Response>;
76
+ getGeminiModelsAction(action: string, query?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<Response>;
77
+ getUsage(): Promise<UsageGetResponse>;
78
+ exportUsage(): Promise<UsageExportResponse>;
79
+ importUsage(body: UsageImportRequest): Promise<UsageImportResponse>;
80
+ getConfig(): Promise<Config>;
81
+ getConfigYaml(): Promise<string>;
82
+ putConfigYaml(body: string): Promise<KeyedValueResponse<"status", "ok">>;
83
+ getLatestVersion(): Promise<KeyedValueResponse<"latest-version", string>>;
84
+ getDebug(): Promise<KeyedValueResponse<"debug", boolean>>;
85
+ putDebug(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
86
+ patchDebug(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
87
+ getLoggingToFile(): Promise<KeyedValueResponse<"logging-to-file", boolean>>;
88
+ putLoggingToFile(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
89
+ patchLoggingToFile(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
90
+ getLogsMaxTotalSizeMB(): Promise<KeyedValueResponse<"logs-max-total-size-mb", number>>;
91
+ putLogsMaxTotalSizeMB(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
92
+ patchLogsMaxTotalSizeMB(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
93
+ getErrorLogsMaxFiles(): Promise<KeyedValueResponse<"error-logs-max-files", number>>;
94
+ putErrorLogsMaxFiles(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
95
+ patchErrorLogsMaxFiles(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
96
+ getUsageStatisticsEnabled(): Promise<KeyedValueResponse<"usage-statistics-enabled", boolean>>;
97
+ putUsageStatisticsEnabled(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
98
+ patchUsageStatisticsEnabled(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
99
+ getProxyUrl(): Promise<KeyedValueResponse<"proxy-url", string>>;
100
+ putProxyUrl(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
101
+ patchProxyUrl(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
102
+ deleteProxyUrl(): Promise<KeyedValueResponse<"status", "ok">>;
103
+ apiCall(body: ApiCallRequest): Promise<ApiCallResponse>;
104
+ getSwitchProject(): Promise<KeyedValueResponse<"switch-project", boolean>>;
105
+ putSwitchProject(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
106
+ patchSwitchProject(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
107
+ getSwitchPreviewModel(): Promise<KeyedValueResponse<"switch-preview-model", boolean>>;
108
+ putSwitchPreviewModel(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
109
+ patchSwitchPreviewModel(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
110
+ getApiKeys(): Promise<KeyedValueResponse<"api-keys", string[]>>;
111
+ putApiKeys(body: string[] | {
112
+ items: string[];
113
+ }): Promise<KeyedValueResponse<"status", "ok">>;
114
+ patchApiKeys(body: PatchStringListRequest): Promise<KeyedValueResponse<"status", "ok">>;
115
+ deleteApiKeys(query?: {
116
+ index?: number;
117
+ value?: string;
118
+ }): Promise<KeyedValueResponse<"status", "ok">>;
119
+ getGeminiKeys(): Promise<KeyedValueResponse<"gemini-api-key", GeminiKey[]>>;
120
+ putGeminiKeys(body: GeminiKey[] | {
121
+ items: GeminiKey[];
122
+ }): Promise<KeyedValueResponse<"status", "ok">>;
123
+ patchGeminiKey(body: PatchByIndexOrMatch<GeminiKeyPatch>): Promise<KeyedValueResponse<"status", "ok">>;
124
+ deleteGeminiKey(query?: {
125
+ 'api-key'?: string;
126
+ index?: number;
127
+ }): Promise<KeyedValueResponse<"status", "ok">>;
128
+ getLogs(query?: {
129
+ limit?: number;
130
+ after?: number;
131
+ }): Promise<LogLinesResponse>;
132
+ deleteLogs(): Promise<DeleteLogsResponse>;
133
+ getRequestErrorLogs(): Promise<ErrorLogFilesResponse>;
134
+ downloadRequestErrorLog(name: string): Promise<Response>;
135
+ getRequestLogById(id: string): Promise<Response>;
136
+ getRequestLog(): Promise<KeyedValueResponse<"request-log", boolean>>;
137
+ putRequestLog(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
138
+ patchRequestLog(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
139
+ getWebsocketAuth(): Promise<KeyedValueResponse<"ws-auth", boolean>>;
140
+ putWebsocketAuth(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
141
+ patchWebsocketAuth(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
142
+ getAmpCode(): Promise<KeyedValueResponse<"ampcode", import("./types.js").AmpCodeConfig>>;
143
+ getAmpUpstreamUrl(): Promise<KeyedValueResponse<"upstream-url", string>>;
144
+ putAmpUpstreamUrl(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
145
+ patchAmpUpstreamUrl(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
146
+ deleteAmpUpstreamUrl(): Promise<KeyedValueResponse<"status", "ok">>;
147
+ getAmpUpstreamApiKey(): Promise<KeyedValueResponse<"upstream-api-key", string>>;
148
+ putAmpUpstreamApiKey(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
149
+ patchAmpUpstreamApiKey(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
150
+ deleteAmpUpstreamApiKey(): Promise<KeyedValueResponse<"status", "ok">>;
151
+ getAmpRestrictManagementToLocalhost(): Promise<KeyedValueResponse<"restrict-management-to-localhost", boolean>>;
152
+ putAmpRestrictManagementToLocalhost(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
153
+ patchAmpRestrictManagementToLocalhost(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
154
+ getAmpModelMappings(): Promise<KeyedValueResponse<"model-mappings", AmpModelMapping[]>>;
155
+ putAmpModelMappings(body: AmpModelMapping[] | AmpModelMappingsPatch): Promise<KeyedValueResponse<"status", "ok">>;
156
+ patchAmpModelMappings(body: AmpModelMappingsPatch): Promise<KeyedValueResponse<"status", "ok">>;
157
+ deleteAmpModelMappings(query?: {
158
+ index?: number;
159
+ match?: string;
160
+ }): Promise<KeyedValueResponse<"status", "ok">>;
161
+ getAmpForceModelMappings(): Promise<KeyedValueResponse<"force-model-mappings", boolean>>;
162
+ putAmpForceModelMappings(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
163
+ patchAmpForceModelMappings(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
164
+ getAmpUpstreamApiKeys(): Promise<KeyedValueResponse<"upstream-api-keys", AmpUpstreamAPIKeyEntry[]>>;
165
+ putAmpUpstreamApiKeys(body: AmpUpstreamAPIKeyEntry[] | AmpUpstreamAPIKeysPatch): Promise<KeyedValueResponse<"status", "ok">>;
166
+ patchAmpUpstreamApiKeys(body: AmpUpstreamAPIKeysPatch): Promise<KeyedValueResponse<"status", "ok">>;
167
+ deleteAmpUpstreamApiKeys(query?: {
168
+ index?: number;
169
+ match?: string;
170
+ }): Promise<KeyedValueResponse<"status", "ok">>;
171
+ getRequestRetry(): Promise<KeyedValueResponse<"request-retry", number>>;
172
+ putRequestRetry(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
173
+ patchRequestRetry(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
174
+ getMaxRetryInterval(): Promise<KeyedValueResponse<"max-retry-interval", number>>;
175
+ putMaxRetryInterval(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
176
+ patchMaxRetryInterval(body: KeyedValueResponse<'value', number>): Promise<KeyedValueResponse<"status", "ok">>;
177
+ getForceModelPrefix(): Promise<KeyedValueResponse<"force-model-prefix", boolean>>;
178
+ putForceModelPrefix(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
179
+ patchForceModelPrefix(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
180
+ getRoutingStrategy(): Promise<KeyedValueResponse<"strategy", string>>;
181
+ putRoutingStrategy(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
182
+ patchRoutingStrategy(body: KeyedValueResponse<'value', string>): Promise<KeyedValueResponse<"status", "ok">>;
183
+ getClaudeKeys(): Promise<KeyedValueResponse<"claude-api-key", ClaudeKey[]>>;
184
+ putClaudeKeys(body: ClaudeKey[] | {
185
+ items: ClaudeKey[];
186
+ }): Promise<KeyedValueResponse<"status", "ok">>;
187
+ patchClaudeKey(body: PatchByIndexOrMatch<ClaudeKeyPatch>): Promise<KeyedValueResponse<"status", "ok">>;
188
+ deleteClaudeKey(query?: {
189
+ 'api-key'?: string;
190
+ index?: number;
191
+ }): Promise<KeyedValueResponse<"status", "ok">>;
192
+ getCodexKeys(): Promise<KeyedValueResponse<"codex-api-key", CodexKey[]>>;
193
+ putCodexKeys(body: CodexKey[] | {
194
+ items: CodexKey[];
195
+ }): Promise<KeyedValueResponse<"status", "ok">>;
196
+ patchCodexKey(body: PatchByIndexOrMatch<CodexKeyPatch>): Promise<KeyedValueResponse<"status", "ok">>;
197
+ deleteCodexKey(query?: {
198
+ 'api-key'?: string;
199
+ index?: number;
200
+ }): Promise<KeyedValueResponse<"status", "ok">>;
201
+ getOpenAICompatibility(): Promise<KeyedValueResponse<"openai-compatibility", OpenAICompatibility[]>>;
202
+ putOpenAICompatibility(body: OpenAICompatibility[] | {
203
+ items: OpenAICompatibility[];
204
+ }): Promise<KeyedValueResponse<"status", "ok">>;
205
+ patchOpenAICompatibility(body: PatchByIndexOrMatch<OpenAICompatPatch>): Promise<KeyedValueResponse<"status", "ok">>;
206
+ deleteOpenAICompatibility(query?: {
207
+ name?: string;
208
+ index?: number;
209
+ }): Promise<KeyedValueResponse<"status", "ok">>;
210
+ getVertexCompatKeys(): Promise<KeyedValueResponse<"vertex-api-key", VertexCompatKey[]>>;
211
+ putVertexCompatKeys(body: VertexCompatKey[] | {
212
+ items: VertexCompatKey[];
213
+ }): Promise<KeyedValueResponse<"status", "ok">>;
214
+ patchVertexCompatKey(body: PatchByIndexOrMatch<VertexCompatPatch>): Promise<KeyedValueResponse<"status", "ok">>;
215
+ deleteVertexCompatKey(query?: {
216
+ 'api-key'?: string;
217
+ index?: number;
218
+ }): Promise<KeyedValueResponse<"status", "ok">>;
219
+ getOAuthExcludedModels(): Promise<KeyedValueResponse<"oauth-excluded-models", Record<string, string[]>>>;
220
+ putOAuthExcludedModels(body: Record<string, string[]> | {
221
+ items: Record<string, string[]>;
222
+ }): Promise<KeyedValueResponse<"status", "ok">>;
223
+ patchOAuthExcludedModels(body: OAuthExcludedModelsPatch): Promise<KeyedValueResponse<"status", "ok">>;
224
+ deleteOAuthExcludedModels(query?: {
225
+ provider?: string;
226
+ }): Promise<KeyedValueResponse<"status", "ok">>;
227
+ getOAuthModelAlias(): Promise<KeyedValueResponse<"oauth-model-alias", Record<string, OAuthModelAlias[]>>>;
228
+ putOAuthModelAlias(body: Record<string, OAuthModelAlias[]> | {
229
+ items: Record<string, OAuthModelAlias[]>;
230
+ }): Promise<KeyedValueResponse<"status", "ok">>;
231
+ patchOAuthModelAlias(body: PatchByIndexOrMatch<OAuthModelAliasPatch> | OAuthModelAliasPatch): Promise<KeyedValueResponse<"status", "ok">>;
232
+ deleteOAuthModelAlias(query?: {
233
+ provider?: string;
234
+ channel?: string;
235
+ }): Promise<KeyedValueResponse<"status", "ok">>;
236
+ listAuthFiles(query?: AuthFileListQuery): Promise<AuthFileListResponse>;
237
+ getAuthFileModels(query: AuthFileModelsQuery): Promise<AuthFileModelsResponse>;
238
+ getStaticModelDefinitions(channel: string): Promise<Response>;
239
+ downloadAuthFile(query: {
240
+ name: string;
241
+ }): Promise<Response>;
242
+ uploadAuthFile(file: Blob, name?: string): Promise<Response>;
243
+ deleteAuthFile(query: {
244
+ name: string;
245
+ }): Promise<AuthFileDeleteResponse>;
246
+ patchAuthFileStatus(body: AuthFileStatusRequest): Promise<AuthFileStatusResponse>;
247
+ importVertexCredential(file: Blob): Promise<Response>;
248
+ requestAnthropicAuthUrl(): Promise<OAuthStartResponse>;
249
+ requestCodexAuthUrl(): Promise<OAuthStartResponse>;
250
+ requestGeminiCliAuthUrl(): Promise<OAuthStartResponse>;
251
+ requestAntigravityAuthUrl(): Promise<OAuthStartResponse>;
252
+ requestQwenAuthUrl(): Promise<OAuthStartResponse>;
253
+ requestKimiAuthUrl(): Promise<OAuthStartResponse>;
254
+ requestIFlowAuthUrl(): Promise<OAuthStartResponse>;
255
+ requestIFlowCookieToken(body: KeyedValueResponse<'cookie', string>): Promise<OAuthStartResponse>;
256
+ postOAuthCallback(body: OAuthCallbackRequest): Promise<OAuthCallbackResponse>;
257
+ getAuthStatus(query?: {
258
+ state?: string;
259
+ }): Promise<AuthStatusResponse>;
260
+ }