@redonvn/event-ws-cliproxyapi-sdk 1.0.1 → 1.0.3
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.
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type { AmpModelMapping, AmpModelMappingsPatch, AmpUpstreamAPIKeyEntry, AmpUpstreamAPIKeysPatch, ApiCallRequest, ApiCallResponse, AuthFileDeleteResponse, AuthFileListQuery, AuthFileListResponse, AuthFileModelsQuery, AuthFileModelsResponse, AuthFileStatusRequest, AuthFileStatusResponse, AuthStatusResponse, DesktopKeysResponse, ClaudeKey, ClaudeKeyPatch, CodexKey, CodexKeyPatch, Config, DeleteLogsResponse, ErrorLogFilesResponse, GeminiKey, GeminiKeyPatch, KeyedValueResponse, LogLinesResponse, OAuthCallbackRequest, OAuthCallbackResponse, OAuthExcludedModelsPatch, OAuthModelAlias, OAuthModelAliasPatch, OAuthStartResponse, OpenAICompatibility, OpenAICompatPatch, PatchByIndexOrMatch, PatchStringListRequest, UsageExportResponse, UsageGetResponse, UsageImportRequest, UsageImportResponse, VertexCompatKey, VertexCompatPatch } from '../shared/types.js';
|
|
1
|
+
import type { AmpModelMapping, AmpModelMappingsPatch, AmpUpstreamAPIKeyEntry, AmpUpstreamAPIKeysPatch, ApiCallRequest, ApiCallResponse, AuthFileDeleteResponse, AuthFileListQuery, AuthFileListResponse, AuthFileModelsQuery, AuthFileModelsResponse, AuthFileStatusRequest, AuthFileStatusResponse, AuthStatusResponse, DesktopKeysResponse, ManagementApiKeysResponse, ClaudeKey, ClaudeKeyPatch, CodexKey, CodexKeyPatch, Config, DeleteLogsResponse, ErrorLogFilesResponse, GeminiKey, GeminiKeyPatch, KeyedValueResponse, LogLinesResponse, OAuthCallbackRequest, OAuthCallbackResponse, OAuthExcludedModelsPatch, OAuthModelAlias, OAuthModelAliasPatch, OAuthStartResponse, OpenAICompatibility, OpenAICompatPatch, PatchByIndexOrMatch, PatchStringListRequest, UsageExportResponse, UsageGetResponse, UsageImportRequest, UsageImportResponse, UpdateConnectionSettingsRequest, VertexCompatKey, VertexCompatPatch } from '../shared/types.js';
|
|
2
2
|
import { BaseHttpClient } from '../shared/http.js';
|
|
3
3
|
export declare class ManagementClient extends BaseHttpClient {
|
|
4
4
|
getDesktopKeys(): Promise<DesktopKeysResponse>;
|
|
5
|
+
getManagementApiKeys(): Promise<ManagementApiKeysResponse>;
|
|
5
6
|
getUsage(): Promise<UsageGetResponse>;
|
|
6
7
|
exportUsage(): Promise<UsageExportResponse>;
|
|
7
8
|
importUsage(body: UsageImportRequest): Promise<UsageImportResponse>;
|
|
8
9
|
getConfig(): Promise<Config>;
|
|
9
10
|
getConfigYaml(): Promise<string>;
|
|
10
11
|
putConfigYaml(body: string): Promise<KeyedValueResponse<"status", "ok">>;
|
|
12
|
+
putConnectionSettings(body: UpdateConnectionSettingsRequest): Promise<KeyedValueResponse<"status", "ok">>;
|
|
11
13
|
getLatestVersion(): Promise<KeyedValueResponse<"latest-version", string>>;
|
|
12
14
|
getDebug(): Promise<KeyedValueResponse<"debug", boolean>>;
|
|
13
15
|
putDebug(body: KeyedValueResponse<'value', boolean>): Promise<KeyedValueResponse<"status", "ok">>;
|
|
@@ -3,6 +3,24 @@ export class ManagementClient extends BaseHttpClient {
|
|
|
3
3
|
getDesktopKeys() {
|
|
4
4
|
return this.requestJson('GET', '/desktop/keys');
|
|
5
5
|
}
|
|
6
|
+
async getManagementApiKeys() {
|
|
7
|
+
try {
|
|
8
|
+
const data = await this.getDesktopKeys();
|
|
9
|
+
return {
|
|
10
|
+
'api-keys': Array.isArray(data?.apiKeys) ? data.apiKeys : [],
|
|
11
|
+
'management-key': data?.managementKey ?? this.managementKey ?? '',
|
|
12
|
+
'base-url': data?.baseUrl,
|
|
13
|
+
'bridge-url': data?.bridgeUrl,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
const data = await this.getApiKeys();
|
|
18
|
+
return {
|
|
19
|
+
'api-keys': Array.isArray(data?.['api-keys']) ? data['api-keys'] : [],
|
|
20
|
+
'management-key': this.managementKey ?? '',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
6
24
|
getUsage() {
|
|
7
25
|
return this.requestJson('GET', '/v0/management/usage', undefined, undefined, 'management');
|
|
8
26
|
}
|
|
@@ -24,6 +42,9 @@ export class ManagementClient extends BaseHttpClient {
|
|
|
24
42
|
return text ? JSON.parse(text) : { status: 'ok' };
|
|
25
43
|
});
|
|
26
44
|
}
|
|
45
|
+
putConnectionSettings(body) {
|
|
46
|
+
return this.requestJson('PUT', '/v0/management/connection-settings', body, undefined, 'management');
|
|
47
|
+
}
|
|
27
48
|
getLatestVersion() {
|
|
28
49
|
return this.requestJson('GET', '/v0/management/latest-version', undefined, undefined, 'management');
|
|
29
50
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ManagementClient } from './client.js';
|
|
2
|
-
export type { SDKConfig, StreamingConfig, AccessConfig, AccessProvider, TLSConfig, PprofConfig, RemoteManagementConfig, QuotaExceededConfig, RoutingConfig, OAuthModelAlias, AmpModelMapping, AmpUpstreamAPIKeyEntry, AmpCodeConfig, PayloadConfig, PayloadFilterRule, PayloadRule, PayloadModelRule, CloakConfig, ClaudeModel, ClaudeKey, CodexModel, CodexKey, GeminiModel, GeminiKey, OpenAICompatibilityAPIKey, OpenAICompatibilityModel, OpenAICompatibility, VertexCompatModel, VertexCompatKey, Config, UsageTokenStats, UsageRequestDetail, UsageModelSnapshot, UsageApiSnapshot, UsageStatisticsSnapshot, UsageGetResponse, UsageExportResponse, UsageImportRequest, UsageImportResponse, ApiCallRequest, ApiCallResponse, ErrorResponse, StatusResponse, LogLinesResponse, DeleteLogsResponse, ErrorLogFileInfo, ErrorLogFilesResponse, AuthFileEntry, AuthFileListResponse, AuthFileModelsResponse, AuthFileUploadResponse, AuthFileDeleteResponse, AuthFileStatusRequest, AuthFileStatusResponse, OAuthCallbackRequest, OAuthCallbackResponse, OAuthStartResponse, AuthStatusResponse, AuthFileDownloadRequest, AuthFileListQuery, AuthFileModelsQuery, PatchStringListRequest, PatchByIndexOrMatch, GeminiKeyPatch, ClaudeKeyPatch, CodexKeyPatch, OpenAICompatPatch, VertexCompatPatch, OAuthExcludedModelsPatch, OAuthModelAliasPatch, AmpModelMappingsPatch, AmpUpstreamAPIKeysPatch, AmpStringListPatch, AuthFileUploadRequest, VertexImportRequest, RootResponse, KeepAliveResponse, DesktopKeysResponse, ModelThinkingSupport, ModelInfo, ModelListResponse } from '../shared/types.js';
|
|
2
|
+
export type { SDKConfig, StreamingConfig, AccessConfig, AccessProvider, TLSConfig, PprofConfig, RemoteManagementConfig, QuotaExceededConfig, RoutingConfig, OAuthModelAlias, AmpModelMapping, AmpUpstreamAPIKeyEntry, AmpCodeConfig, PayloadConfig, PayloadFilterRule, PayloadRule, PayloadModelRule, CloakConfig, ClaudeModel, ClaudeKey, CodexModel, CodexKey, GeminiModel, GeminiKey, OpenAICompatibilityAPIKey, OpenAICompatibilityModel, OpenAICompatibility, VertexCompatModel, VertexCompatKey, Config, UsageTokenStats, UsageRequestDetail, UsageModelSnapshot, UsageApiSnapshot, UsageStatisticsSnapshot, UsageGetResponse, UsageExportResponse, UsageImportRequest, UsageImportResponse, UpdateConnectionSettingsRequest, ApiCallRequest, ApiCallResponse, ErrorResponse, StatusResponse, LogLinesResponse, DeleteLogsResponse, ErrorLogFileInfo, ErrorLogFilesResponse, AuthFileEntry, AuthFileListResponse, AuthFileModelsResponse, AuthFileUploadResponse, AuthFileDeleteResponse, AuthFileStatusRequest, AuthFileStatusResponse, OAuthCallbackRequest, OAuthCallbackResponse, OAuthStartResponse, AuthStatusResponse, AuthFileDownloadRequest, AuthFileListQuery, AuthFileModelsQuery, PatchStringListRequest, PatchByIndexOrMatch, GeminiKeyPatch, ClaudeKeyPatch, CodexKeyPatch, OpenAICompatPatch, VertexCompatPatch, OAuthExcludedModelsPatch, OAuthModelAliasPatch, AmpModelMappingsPatch, AmpUpstreamAPIKeysPatch, AmpStringListPatch, AuthFileUploadRequest, VertexImportRequest, RootResponse, KeepAliveResponse, DesktopKeysResponse, ManagementApiKeysResponse, ModelThinkingSupport, ModelInfo, ModelListResponse } from '../shared/types.js';
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -30,6 +30,12 @@ export interface DesktopKeysResponse {
|
|
|
30
30
|
apiKeys: string[];
|
|
31
31
|
managementKey: string;
|
|
32
32
|
}
|
|
33
|
+
export interface ManagementApiKeysResponse {
|
|
34
|
+
'api-keys': string[];
|
|
35
|
+
'management-key': string;
|
|
36
|
+
'base-url'?: string;
|
|
37
|
+
'bridge-url'?: string;
|
|
38
|
+
}
|
|
33
39
|
export interface ModelThinkingSupport {
|
|
34
40
|
min?: number;
|
|
35
41
|
max?: number;
|
|
@@ -326,6 +332,16 @@ export interface UsageImportResponse {
|
|
|
326
332
|
total_requests: number;
|
|
327
333
|
failed_requests: number;
|
|
328
334
|
}
|
|
335
|
+
export interface UpdateConnectionSettingsRequest {
|
|
336
|
+
'base-url'?: string;
|
|
337
|
+
baseUrl?: string;
|
|
338
|
+
'access-api-key'?: string;
|
|
339
|
+
accessApiKey?: string;
|
|
340
|
+
'api-key'?: string;
|
|
341
|
+
apiKey?: string;
|
|
342
|
+
'management-key'?: string;
|
|
343
|
+
managementKey?: string;
|
|
344
|
+
}
|
|
329
345
|
export interface ApiCallRequest {
|
|
330
346
|
auth_index?: string;
|
|
331
347
|
authIndex?: string;
|