@daocloud-proto/hydra 0.2.0-dev-1 → 0.2.0-dev-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.
@@ -7,6 +7,15 @@
7
7
  import * as HydraCommonCommon from "../../../common/common.pb"
8
8
  import * as fm from "../../../fetch.pb"
9
9
  import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
10
+
11
+ export enum TimePeriod {
12
+ TIME_PERIOD_UNSPECIFIED = "TIME_PERIOD_UNSPECIFIED",
13
+ TIME_PERIOD_HOUR = "TIME_PERIOD_HOUR",
14
+ TIME_PERIOD_DAY = "TIME_PERIOD_DAY",
15
+ TIME_PERIOD_WEEK = "TIME_PERIOD_WEEK",
16
+ TIME_PERIOD_MONTH = "TIME_PERIOD_MONTH",
17
+ }
18
+
10
19
  export type CreateAPIKeyRequest = {
11
20
  name?: string
12
21
  }
@@ -34,6 +43,31 @@ export type DeleteAPIKeyRequest = {
34
43
  id?: string
35
44
  }
36
45
 
46
+ export type APIKeyUsageStatisticsRequest = {
47
+ startTime?: GoogleProtobufTimestamp.Timestamp
48
+ endTime?: GoogleProtobufTimestamp.Timestamp
49
+ ids?: string[]
50
+ models?: string[]
51
+ period?: TimePeriod
52
+ }
53
+
54
+ export type APIKeyUsageStatisticsResponse = {
55
+ dataPoints?: DataPoint[]
56
+ totalUsage?: Usage
57
+ }
58
+
59
+ export type Usage = {
60
+ total?: string
61
+ input?: string
62
+ output?: string
63
+ }
64
+
65
+ export type DataPoint = {
66
+ timestamp?: GoogleProtobufTimestamp.Timestamp
67
+ usage?: Usage
68
+ model?: string
69
+ }
70
+
37
71
  export class APIKeyManagement {
38
72
  static CreateAPIKey(req: CreateAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
39
73
  return fm.fetchReq<CreateAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/apikeys`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
@@ -44,4 +78,7 @@ export class APIKeyManagement {
44
78
  static DeleteAPIKey(req: DeleteAPIKeyRequest, initReq?: fm.InitReq): Promise<APIKey> {
45
79
  return fm.fetchReq<DeleteAPIKeyRequest, APIKey>(`/apis/hydra.io/v1alpha1/apikeys/${req["id"]}`, {...initReq, method: "DELETE", body: JSON.stringify(req, fm.replacer)})
46
80
  }
81
+ static GetAPIKeyUsageStatistics(req: APIKeyUsageStatisticsRequest, initReq?: fm.InitReq): Promise<APIKeyUsageStatisticsResponse> {
82
+ return fm.fetchReq<APIKeyUsageStatisticsRequest, APIKeyUsageStatisticsResponse>(`/apis/hydra.io/v1alpha1/apikeys-stats?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
83
+ }
47
84
  }
@@ -22,12 +22,28 @@ export enum ModelSupportFeature {
22
22
  AUDIO_TO_TEXT = "AUDIO_TO_TEXT",
23
23
  }
24
24
 
25
+ export enum ModelPublibModelConfigRateLimitLimitedBy {
26
+ LIMITED_BY_UNSPECIFIED = "LIMITED_BY_UNSPECIFIED",
27
+ USER_ID = "USER_ID",
28
+ API_KEY = "API_KEY",
29
+ }
30
+
25
31
  export type ModelPrice = {
26
32
  inputPerKTokens?: string
27
33
  outputPerKTokens?: string
28
34
  perImage?: string
29
35
  }
30
36
 
37
+ export type ModelPublibModelConfigRateLimit = {
38
+ limitedBy?: ModelPublibModelConfigRateLimitLimitedBy
39
+ limit?: string
40
+ duration?: string
41
+ }
42
+
43
+ export type ModelPublibModelConfig = {
44
+ rateLimit?: ModelPublibModelConfigRateLimit
45
+ }
46
+
31
47
  export type Model = {
32
48
  modelId?: string
33
49
  modelAvatar?: string
@@ -44,6 +60,7 @@ export type Model = {
44
60
  publicAccessModelName?: string
45
61
  publicModelPrice?: ModelPrice
46
62
  readme?: HydraCommonCommon.I18nName
63
+ publicModelConfig?: ModelPublibModelConfig
47
64
  }
48
65
 
49
66
  export type ListModelRequest = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daocloud-proto/hydra",
3
- "version": "v0.2.0-dev-1",
3
+ "version": "v0.2.0-dev-3",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC"