@breign/client 1.0.130 → 1.0.131

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.
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { AiGatewayChatCompletionRequestUio, AiGatewayChatCompletionResponseUio, AiGatewayEmbeddingRequestUio, AiGatewayEmbeddingResponseUio, AiGatewayModelListUio, AiGatewayModelUio, OpenAiChatCompletionRequestUio, OpenAiChatCompletionResponseUio } from '../models/index';
13
+ import type { AiGatewayChatCompletionRequestUio, AiGatewayChatCompletionResponseUio, AiGatewayEmbeddingRequestUio, AiGatewayEmbeddingResponseUio, AiGatewayModelListUio, AiGatewayModelUio, AiGatewayUsageUio, OpenAiChatCompletionRequestUio, OpenAiChatCompletionResponseUio } from '../models/index';
14
14
  export interface CreateAiGatewayChatCompletionRequest {
15
15
  organizationId: string;
16
16
  aiGatewayChatCompletionRequestUio: AiGatewayChatCompletionRequestUio;
@@ -26,6 +26,12 @@ export interface CreateOpenAiChatCompletionRequest {
26
26
  export interface GetAiGatewayCreditsRequest {
27
27
  organizationId: string;
28
28
  }
29
+ export interface GetAiGatewayMetricsRequest {
30
+ organizationId: string;
31
+ startDate?: Date;
32
+ endDate?: Date;
33
+ granularity?: GetAiGatewayMetricsGranularityEnum;
34
+ }
29
35
  export interface GetAiGatewayModelRequest {
30
36
  organizationId: string;
31
37
  model: string;
@@ -77,6 +83,16 @@ export declare class AiGatewayApi extends runtime.BaseAPI {
77
83
  * Get AI gateway credits
78
84
  */
79
85
  getAiGatewayCredits(organizationId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
86
+ /**
87
+ * Usage de la passerelle pour l\'organisation sur une période : totaux, série temporelle et répartitions par modèle, par provider et par utilisateur. Réservé aux administrateurs de l\'organisation.
88
+ * Get AI gateway usage metrics
89
+ */
90
+ getAiGatewayMetricsRaw(requestParameters: GetAiGatewayMetricsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AiGatewayUsageUio>>;
91
+ /**
92
+ * Usage de la passerelle pour l\'organisation sur une période : totaux, série temporelle et répartitions par modèle, par provider et par utilisateur. Réservé aux administrateurs de l\'organisation.
93
+ * Get AI gateway usage metrics
94
+ */
95
+ getAiGatewayMetrics(organizationId: string, startDate?: Date, endDate?: Date, granularity?: GetAiGatewayMetricsGranularityEnum, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayUsageUio>;
80
96
  /**
81
97
  * Returns a single model in an OpenAI-compatible shape, resolved against the organization\'s engine providers.
82
98
  * Get a model available through the AI gateway
@@ -98,3 +114,12 @@ export declare class AiGatewayApi extends runtime.BaseAPI {
98
114
  */
99
115
  listAiGatewayModels(organizationId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayModelListUio>;
100
116
  }
117
+ /**
118
+ * @export
119
+ */
120
+ export declare const GetAiGatewayMetricsGranularityEnum: {
121
+ readonly Hour: "hour";
122
+ readonly Day: "day";
123
+ readonly Week: "week";
124
+ };
125
+ export type GetAiGatewayMetricsGranularityEnum = typeof GetAiGatewayMetricsGranularityEnum[keyof typeof GetAiGatewayMetricsGranularityEnum];
@@ -46,7 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
46
46
  };
47
47
  })();
48
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.AiGatewayApi = void 0;
49
+ exports.GetAiGatewayMetricsGranularityEnum = exports.AiGatewayApi = void 0;
50
50
  const runtime = __importStar(require("../runtime"));
51
51
  const index_1 = require("../models/index");
52
52
  /**
@@ -183,6 +183,44 @@ class AiGatewayApi extends runtime.BaseAPI {
183
183
  async getAiGatewayCredits(organizationId, initOverrides) {
184
184
  await this.getAiGatewayCreditsRaw({ organizationId: organizationId }, initOverrides);
185
185
  }
186
+ /**
187
+ * Usage de la passerelle pour l\'organisation sur une période : totaux, série temporelle et répartitions par modèle, par provider et par utilisateur. Réservé aux administrateurs de l\'organisation.
188
+ * Get AI gateway usage metrics
189
+ */
190
+ async getAiGatewayMetricsRaw(requestParameters, initOverrides) {
191
+ if (requestParameters['organizationId'] == null) {
192
+ throw new runtime.RequiredError('organizationId', 'Required parameter "organizationId" was null or undefined when calling getAiGatewayMetrics().');
193
+ }
194
+ const queryParameters = {};
195
+ if (requestParameters['startDate'] != null) {
196
+ queryParameters['startDate'] = requestParameters['startDate'].toISOString();
197
+ }
198
+ if (requestParameters['endDate'] != null) {
199
+ queryParameters['endDate'] = requestParameters['endDate'].toISOString();
200
+ }
201
+ if (requestParameters['granularity'] != null) {
202
+ queryParameters['granularity'] = requestParameters['granularity'];
203
+ }
204
+ const headerParameters = {};
205
+ if (this.configuration && this.configuration.apiKey) {
206
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
207
+ }
208
+ const response = await this.request({
209
+ path: `/organizations/{organizationId}/ai-gateway/metrics`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
210
+ method: 'GET',
211
+ headers: headerParameters,
212
+ query: queryParameters,
213
+ }, initOverrides);
214
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AiGatewayUsageUioFromJSON)(jsonValue));
215
+ }
216
+ /**
217
+ * Usage de la passerelle pour l\'organisation sur une période : totaux, série temporelle et répartitions par modèle, par provider et par utilisateur. Réservé aux administrateurs de l\'organisation.
218
+ * Get AI gateway usage metrics
219
+ */
220
+ async getAiGatewayMetrics(organizationId, startDate, endDate, granularity, initOverrides) {
221
+ const response = await this.getAiGatewayMetricsRaw({ organizationId: organizationId, startDate: startDate, endDate: endDate, granularity: granularity }, initOverrides);
222
+ return await response.value();
223
+ }
186
224
  /**
187
225
  * Returns a single model in an OpenAI-compatible shape, resolved against the organization\'s engine providers.
188
226
  * Get a model available through the AI gateway
@@ -246,3 +284,11 @@ class AiGatewayApi extends runtime.BaseAPI {
246
284
  }
247
285
  }
248
286
  exports.AiGatewayApi = AiGatewayApi;
287
+ /**
288
+ * @export
289
+ */
290
+ exports.GetAiGatewayMetricsGranularityEnum = {
291
+ Hour: 'hour',
292
+ Day: 'day',
293
+ Week: 'week'
294
+ };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Consommation agrégée sur une dimension (modèle, provider ou utilisateur).
14
+ * @export
15
+ * @interface AiGatewayUsageBreakdownItemUio
16
+ */
17
+ export interface AiGatewayUsageBreakdownItemUio {
18
+ /**
19
+ * Identifiant brut de la dimension (id de modèle, de provider ou d'utilisateur)
20
+ * @type {string}
21
+ * @memberof AiGatewayUsageBreakdownItemUio
22
+ */
23
+ key: string;
24
+ /**
25
+ * Libellé affichable ; pour un utilisateur, son email lorsqu'il est connu
26
+ * @type {string}
27
+ * @memberof AiGatewayUsageBreakdownItemUio
28
+ */
29
+ label: string;
30
+ /**
31
+ *
32
+ * @type {number}
33
+ * @memberof AiGatewayUsageBreakdownItemUio
34
+ */
35
+ requests: number;
36
+ /**
37
+ *
38
+ * @type {number}
39
+ * @memberof AiGatewayUsageBreakdownItemUio
40
+ */
41
+ inputTokens: number;
42
+ /**
43
+ *
44
+ * @type {number}
45
+ * @memberof AiGatewayUsageBreakdownItemUio
46
+ */
47
+ outputTokens: number;
48
+ /**
49
+ *
50
+ * @type {number}
51
+ * @memberof AiGatewayUsageBreakdownItemUio
52
+ */
53
+ totalTokens: number;
54
+ }
55
+ /**
56
+ * Check if a given object implements the AiGatewayUsageBreakdownItemUio interface.
57
+ */
58
+ export declare function instanceOfAiGatewayUsageBreakdownItemUio(value: object): value is AiGatewayUsageBreakdownItemUio;
59
+ export declare function AiGatewayUsageBreakdownItemUioFromJSON(json: any): AiGatewayUsageBreakdownItemUio;
60
+ export declare function AiGatewayUsageBreakdownItemUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): AiGatewayUsageBreakdownItemUio;
61
+ export declare function AiGatewayUsageBreakdownItemUioToJSON(json: any): AiGatewayUsageBreakdownItemUio;
62
+ export declare function AiGatewayUsageBreakdownItemUioToJSONTyped(value?: AiGatewayUsageBreakdownItemUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfAiGatewayUsageBreakdownItemUio = instanceOfAiGatewayUsageBreakdownItemUio;
17
+ exports.AiGatewayUsageBreakdownItemUioFromJSON = AiGatewayUsageBreakdownItemUioFromJSON;
18
+ exports.AiGatewayUsageBreakdownItemUioFromJSONTyped = AiGatewayUsageBreakdownItemUioFromJSONTyped;
19
+ exports.AiGatewayUsageBreakdownItemUioToJSON = AiGatewayUsageBreakdownItemUioToJSON;
20
+ exports.AiGatewayUsageBreakdownItemUioToJSONTyped = AiGatewayUsageBreakdownItemUioToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the AiGatewayUsageBreakdownItemUio interface.
23
+ */
24
+ function instanceOfAiGatewayUsageBreakdownItemUio(value) {
25
+ if (!('key' in value) || value['key'] === undefined)
26
+ return false;
27
+ if (!('label' in value) || value['label'] === undefined)
28
+ return false;
29
+ if (!('requests' in value) || value['requests'] === undefined)
30
+ return false;
31
+ if (!('inputTokens' in value) || value['inputTokens'] === undefined)
32
+ return false;
33
+ if (!('outputTokens' in value) || value['outputTokens'] === undefined)
34
+ return false;
35
+ if (!('totalTokens' in value) || value['totalTokens'] === undefined)
36
+ return false;
37
+ return true;
38
+ }
39
+ function AiGatewayUsageBreakdownItemUioFromJSON(json) {
40
+ return AiGatewayUsageBreakdownItemUioFromJSONTyped(json, false);
41
+ }
42
+ function AiGatewayUsageBreakdownItemUioFromJSONTyped(json, ignoreDiscriminator) {
43
+ if (json == null) {
44
+ return json;
45
+ }
46
+ return {
47
+ 'key': json['key'],
48
+ 'label': json['label'],
49
+ 'requests': json['requests'],
50
+ 'inputTokens': json['inputTokens'],
51
+ 'outputTokens': json['outputTokens'],
52
+ 'totalTokens': json['totalTokens'],
53
+ };
54
+ }
55
+ function AiGatewayUsageBreakdownItemUioToJSON(json) {
56
+ return AiGatewayUsageBreakdownItemUioToJSONTyped(json, false);
57
+ }
58
+ function AiGatewayUsageBreakdownItemUioToJSONTyped(value, ignoreDiscriminator = false) {
59
+ if (value == null) {
60
+ return value;
61
+ }
62
+ return {
63
+ 'key': value['key'],
64
+ 'label': value['label'],
65
+ 'requests': value['requests'],
66
+ 'inputTokens': value['inputTokens'],
67
+ 'outputTokens': value['outputTokens'],
68
+ 'totalTokens': value['totalTokens'],
69
+ };
70
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface AiGatewayUsagePointUio
16
+ */
17
+ export interface AiGatewayUsagePointUio {
18
+ /**
19
+ * Clé de regroupement temporel, dépendante de la granularité demandée
20
+ * @type {string}
21
+ * @memberof AiGatewayUsagePointUio
22
+ */
23
+ bucket: string;
24
+ /**
25
+ *
26
+ * @type {string}
27
+ * @memberof AiGatewayUsagePointUio
28
+ */
29
+ label: string;
30
+ /**
31
+ *
32
+ * @type {number}
33
+ * @memberof AiGatewayUsagePointUio
34
+ */
35
+ requests: number;
36
+ /**
37
+ *
38
+ * @type {number}
39
+ * @memberof AiGatewayUsagePointUio
40
+ */
41
+ inputTokens: number;
42
+ /**
43
+ *
44
+ * @type {number}
45
+ * @memberof AiGatewayUsagePointUio
46
+ */
47
+ outputTokens: number;
48
+ }
49
+ /**
50
+ * Check if a given object implements the AiGatewayUsagePointUio interface.
51
+ */
52
+ export declare function instanceOfAiGatewayUsagePointUio(value: object): value is AiGatewayUsagePointUio;
53
+ export declare function AiGatewayUsagePointUioFromJSON(json: any): AiGatewayUsagePointUio;
54
+ export declare function AiGatewayUsagePointUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): AiGatewayUsagePointUio;
55
+ export declare function AiGatewayUsagePointUioToJSON(json: any): AiGatewayUsagePointUio;
56
+ export declare function AiGatewayUsagePointUioToJSONTyped(value?: AiGatewayUsagePointUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfAiGatewayUsagePointUio = instanceOfAiGatewayUsagePointUio;
17
+ exports.AiGatewayUsagePointUioFromJSON = AiGatewayUsagePointUioFromJSON;
18
+ exports.AiGatewayUsagePointUioFromJSONTyped = AiGatewayUsagePointUioFromJSONTyped;
19
+ exports.AiGatewayUsagePointUioToJSON = AiGatewayUsagePointUioToJSON;
20
+ exports.AiGatewayUsagePointUioToJSONTyped = AiGatewayUsagePointUioToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the AiGatewayUsagePointUio interface.
23
+ */
24
+ function instanceOfAiGatewayUsagePointUio(value) {
25
+ if (!('bucket' in value) || value['bucket'] === undefined)
26
+ return false;
27
+ if (!('label' in value) || value['label'] === undefined)
28
+ return false;
29
+ if (!('requests' in value) || value['requests'] === undefined)
30
+ return false;
31
+ if (!('inputTokens' in value) || value['inputTokens'] === undefined)
32
+ return false;
33
+ if (!('outputTokens' in value) || value['outputTokens'] === undefined)
34
+ return false;
35
+ return true;
36
+ }
37
+ function AiGatewayUsagePointUioFromJSON(json) {
38
+ return AiGatewayUsagePointUioFromJSONTyped(json, false);
39
+ }
40
+ function AiGatewayUsagePointUioFromJSONTyped(json, ignoreDiscriminator) {
41
+ if (json == null) {
42
+ return json;
43
+ }
44
+ return {
45
+ 'bucket': json['bucket'],
46
+ 'label': json['label'],
47
+ 'requests': json['requests'],
48
+ 'inputTokens': json['inputTokens'],
49
+ 'outputTokens': json['outputTokens'],
50
+ };
51
+ }
52
+ function AiGatewayUsagePointUioToJSON(json) {
53
+ return AiGatewayUsagePointUioToJSONTyped(json, false);
54
+ }
55
+ function AiGatewayUsagePointUioToJSONTyped(value, ignoreDiscriminator = false) {
56
+ if (value == null) {
57
+ return value;
58
+ }
59
+ return {
60
+ 'bucket': value['bucket'],
61
+ 'label': value['label'],
62
+ 'requests': value['requests'],
63
+ 'inputTokens': value['inputTokens'],
64
+ 'outputTokens': value['outputTokens'],
65
+ };
66
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface AiGatewayUsageTotalUio
16
+ */
17
+ export interface AiGatewayUsageTotalUio {
18
+ /**
19
+ *
20
+ * @type {number}
21
+ * @memberof AiGatewayUsageTotalUio
22
+ */
23
+ requests: number;
24
+ /**
25
+ *
26
+ * @type {number}
27
+ * @memberof AiGatewayUsageTotalUio
28
+ */
29
+ inputTokens: number;
30
+ /**
31
+ *
32
+ * @type {number}
33
+ * @memberof AiGatewayUsageTotalUio
34
+ */
35
+ outputTokens: number;
36
+ /**
37
+ *
38
+ * @type {number}
39
+ * @memberof AiGatewayUsageTotalUio
40
+ */
41
+ reasoningTokens: number;
42
+ /**
43
+ *
44
+ * @type {number}
45
+ * @memberof AiGatewayUsageTotalUio
46
+ */
47
+ totalTokens: number;
48
+ /**
49
+ *
50
+ * @type {number}
51
+ * @memberof AiGatewayUsageTotalUio
52
+ */
53
+ uniqueUsers: number;
54
+ }
55
+ /**
56
+ * Check if a given object implements the AiGatewayUsageTotalUio interface.
57
+ */
58
+ export declare function instanceOfAiGatewayUsageTotalUio(value: object): value is AiGatewayUsageTotalUio;
59
+ export declare function AiGatewayUsageTotalUioFromJSON(json: any): AiGatewayUsageTotalUio;
60
+ export declare function AiGatewayUsageTotalUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): AiGatewayUsageTotalUio;
61
+ export declare function AiGatewayUsageTotalUioToJSON(json: any): AiGatewayUsageTotalUio;
62
+ export declare function AiGatewayUsageTotalUioToJSONTyped(value?: AiGatewayUsageTotalUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfAiGatewayUsageTotalUio = instanceOfAiGatewayUsageTotalUio;
17
+ exports.AiGatewayUsageTotalUioFromJSON = AiGatewayUsageTotalUioFromJSON;
18
+ exports.AiGatewayUsageTotalUioFromJSONTyped = AiGatewayUsageTotalUioFromJSONTyped;
19
+ exports.AiGatewayUsageTotalUioToJSON = AiGatewayUsageTotalUioToJSON;
20
+ exports.AiGatewayUsageTotalUioToJSONTyped = AiGatewayUsageTotalUioToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the AiGatewayUsageTotalUio interface.
23
+ */
24
+ function instanceOfAiGatewayUsageTotalUio(value) {
25
+ if (!('requests' in value) || value['requests'] === undefined)
26
+ return false;
27
+ if (!('inputTokens' in value) || value['inputTokens'] === undefined)
28
+ return false;
29
+ if (!('outputTokens' in value) || value['outputTokens'] === undefined)
30
+ return false;
31
+ if (!('reasoningTokens' in value) || value['reasoningTokens'] === undefined)
32
+ return false;
33
+ if (!('totalTokens' in value) || value['totalTokens'] === undefined)
34
+ return false;
35
+ if (!('uniqueUsers' in value) || value['uniqueUsers'] === undefined)
36
+ return false;
37
+ return true;
38
+ }
39
+ function AiGatewayUsageTotalUioFromJSON(json) {
40
+ return AiGatewayUsageTotalUioFromJSONTyped(json, false);
41
+ }
42
+ function AiGatewayUsageTotalUioFromJSONTyped(json, ignoreDiscriminator) {
43
+ if (json == null) {
44
+ return json;
45
+ }
46
+ return {
47
+ 'requests': json['requests'],
48
+ 'inputTokens': json['inputTokens'],
49
+ 'outputTokens': json['outputTokens'],
50
+ 'reasoningTokens': json['reasoningTokens'],
51
+ 'totalTokens': json['totalTokens'],
52
+ 'uniqueUsers': json['uniqueUsers'],
53
+ };
54
+ }
55
+ function AiGatewayUsageTotalUioToJSON(json) {
56
+ return AiGatewayUsageTotalUioToJSONTyped(json, false);
57
+ }
58
+ function AiGatewayUsageTotalUioToJSONTyped(value, ignoreDiscriminator = false) {
59
+ if (value == null) {
60
+ return value;
61
+ }
62
+ return {
63
+ 'requests': value['requests'],
64
+ 'inputTokens': value['inputTokens'],
65
+ 'outputTokens': value['outputTokens'],
66
+ 'reasoningTokens': value['reasoningTokens'],
67
+ 'totalTokens': value['totalTokens'],
68
+ 'uniqueUsers': value['uniqueUsers'],
69
+ };
70
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * brain-client
3
+ * Api ands models for brain-app and brain-app
4
+ *
5
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { AiGatewayUsageTotalUio } from './AiGatewayUsageTotalUio';
13
+ import type { AiGatewayUsagePointUio } from './AiGatewayUsagePointUio';
14
+ import type { AiGatewayUsageBreakdownItemUio } from './AiGatewayUsageBreakdownItemUio';
15
+ /**
16
+ *
17
+ * @export
18
+ * @interface AiGatewayUsageUio
19
+ */
20
+ export interface AiGatewayUsageUio {
21
+ /**
22
+ *
23
+ * @type {AiGatewayUsageTotalUio}
24
+ * @memberof AiGatewayUsageUio
25
+ */
26
+ total: AiGatewayUsageTotalUio;
27
+ /**
28
+ *
29
+ * @type {Array<AiGatewayUsagePointUio>}
30
+ * @memberof AiGatewayUsageUio
31
+ */
32
+ series: Array<AiGatewayUsagePointUio>;
33
+ /**
34
+ *
35
+ * @type {Array<AiGatewayUsageBreakdownItemUio>}
36
+ * @memberof AiGatewayUsageUio
37
+ */
38
+ byModel: Array<AiGatewayUsageBreakdownItemUio>;
39
+ /**
40
+ *
41
+ * @type {Array<AiGatewayUsageBreakdownItemUio>}
42
+ * @memberof AiGatewayUsageUio
43
+ */
44
+ byProvider: Array<AiGatewayUsageBreakdownItemUio>;
45
+ /**
46
+ *
47
+ * @type {Array<AiGatewayUsageBreakdownItemUio>}
48
+ * @memberof AiGatewayUsageUio
49
+ */
50
+ byUser: Array<AiGatewayUsageBreakdownItemUio>;
51
+ }
52
+ /**
53
+ * Check if a given object implements the AiGatewayUsageUio interface.
54
+ */
55
+ export declare function instanceOfAiGatewayUsageUio(value: object): value is AiGatewayUsageUio;
56
+ export declare function AiGatewayUsageUioFromJSON(json: any): AiGatewayUsageUio;
57
+ export declare function AiGatewayUsageUioFromJSONTyped(json: any, ignoreDiscriminator: boolean): AiGatewayUsageUio;
58
+ export declare function AiGatewayUsageUioToJSON(json: any): AiGatewayUsageUio;
59
+ export declare function AiGatewayUsageUioToJSONTyped(value?: AiGatewayUsageUio | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * brain-client
6
+ * Api ands models for brain-app and brain-app
7
+ *
8
+ * The version of the OpenAPI document: 0.0.0-SNAPSHOT
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfAiGatewayUsageUio = instanceOfAiGatewayUsageUio;
17
+ exports.AiGatewayUsageUioFromJSON = AiGatewayUsageUioFromJSON;
18
+ exports.AiGatewayUsageUioFromJSONTyped = AiGatewayUsageUioFromJSONTyped;
19
+ exports.AiGatewayUsageUioToJSON = AiGatewayUsageUioToJSON;
20
+ exports.AiGatewayUsageUioToJSONTyped = AiGatewayUsageUioToJSONTyped;
21
+ const AiGatewayUsageTotalUio_1 = require("./AiGatewayUsageTotalUio");
22
+ const AiGatewayUsagePointUio_1 = require("./AiGatewayUsagePointUio");
23
+ const AiGatewayUsageBreakdownItemUio_1 = require("./AiGatewayUsageBreakdownItemUio");
24
+ /**
25
+ * Check if a given object implements the AiGatewayUsageUio interface.
26
+ */
27
+ function instanceOfAiGatewayUsageUio(value) {
28
+ if (!('total' in value) || value['total'] === undefined)
29
+ return false;
30
+ if (!('series' in value) || value['series'] === undefined)
31
+ return false;
32
+ if (!('byModel' in value) || value['byModel'] === undefined)
33
+ return false;
34
+ if (!('byProvider' in value) || value['byProvider'] === undefined)
35
+ return false;
36
+ if (!('byUser' in value) || value['byUser'] === undefined)
37
+ return false;
38
+ return true;
39
+ }
40
+ function AiGatewayUsageUioFromJSON(json) {
41
+ return AiGatewayUsageUioFromJSONTyped(json, false);
42
+ }
43
+ function AiGatewayUsageUioFromJSONTyped(json, ignoreDiscriminator) {
44
+ if (json == null) {
45
+ return json;
46
+ }
47
+ return {
48
+ 'total': (0, AiGatewayUsageTotalUio_1.AiGatewayUsageTotalUioFromJSON)(json['total']),
49
+ 'series': (json['series'].map(AiGatewayUsagePointUio_1.AiGatewayUsagePointUioFromJSON)),
50
+ 'byModel': (json['byModel'].map(AiGatewayUsageBreakdownItemUio_1.AiGatewayUsageBreakdownItemUioFromJSON)),
51
+ 'byProvider': (json['byProvider'].map(AiGatewayUsageBreakdownItemUio_1.AiGatewayUsageBreakdownItemUioFromJSON)),
52
+ 'byUser': (json['byUser'].map(AiGatewayUsageBreakdownItemUio_1.AiGatewayUsageBreakdownItemUioFromJSON)),
53
+ };
54
+ }
55
+ function AiGatewayUsageUioToJSON(json) {
56
+ return AiGatewayUsageUioToJSONTyped(json, false);
57
+ }
58
+ function AiGatewayUsageUioToJSONTyped(value, ignoreDiscriminator = false) {
59
+ if (value == null) {
60
+ return value;
61
+ }
62
+ return {
63
+ 'total': (0, AiGatewayUsageTotalUio_1.AiGatewayUsageTotalUioToJSON)(value['total']),
64
+ 'series': (value['series'].map(AiGatewayUsagePointUio_1.AiGatewayUsagePointUioToJSON)),
65
+ 'byModel': (value['byModel'].map(AiGatewayUsageBreakdownItemUio_1.AiGatewayUsageBreakdownItemUioToJSON)),
66
+ 'byProvider': (value['byProvider'].map(AiGatewayUsageBreakdownItemUio_1.AiGatewayUsageBreakdownItemUioToJSON)),
67
+ 'byUser': (value['byUser'].map(AiGatewayUsageBreakdownItemUio_1.AiGatewayUsageBreakdownItemUioToJSON)),
68
+ };
69
+ }
@@ -61,6 +61,10 @@ export * from './AiGatewayMessageUio';
61
61
  export * from './AiGatewayModelListDataInnerUio';
62
62
  export * from './AiGatewayModelListUio';
63
63
  export * from './AiGatewayModelUio';
64
+ export * from './AiGatewayUsageBreakdownItemUio';
65
+ export * from './AiGatewayUsagePointUio';
66
+ export * from './AiGatewayUsageTotalUio';
67
+ export * from './AiGatewayUsageUio';
64
68
  export * from './AnimationCreateRequestUio';
65
69
  export * from './AnimationUio';
66
70
  export * from './AnonymizationStatusUio';
@@ -79,6 +79,10 @@ __exportStar(require("./AiGatewayMessageUio"), exports);
79
79
  __exportStar(require("./AiGatewayModelListDataInnerUio"), exports);
80
80
  __exportStar(require("./AiGatewayModelListUio"), exports);
81
81
  __exportStar(require("./AiGatewayModelUio"), exports);
82
+ __exportStar(require("./AiGatewayUsageBreakdownItemUio"), exports);
83
+ __exportStar(require("./AiGatewayUsagePointUio"), exports);
84
+ __exportStar(require("./AiGatewayUsageTotalUio"), exports);
85
+ __exportStar(require("./AiGatewayUsageUio"), exports);
82
86
  __exportStar(require("./AnimationCreateRequestUio"), exports);
83
87
  __exportStar(require("./AnimationUio"), exports);
84
88
  __exportStar(require("./AnonymizationStatusUio"), exports);
package/dist/openapi.json CHANGED
@@ -12672,6 +12672,80 @@
12672
12672
  "tags" : [ "ai-gateway" ]
12673
12673
  }
12674
12674
  },
12675
+ "/organizations/{organizationId}/ai-gateway/metrics" : {
12676
+ "get" : {
12677
+ "description" : "Usage de la passerelle pour l'organisation sur une période : totaux, série temporelle et répartitions par modèle, par provider et par utilisateur. Réservé aux administrateurs de l'organisation.",
12678
+ "operationId" : "getAiGatewayMetrics",
12679
+ "parameters" : [ {
12680
+ "description" : "ID of the organization",
12681
+ "in" : "path",
12682
+ "name" : "organizationId",
12683
+ "required" : true,
12684
+ "schema" : {
12685
+ "type" : "string"
12686
+ }
12687
+ }, {
12688
+ "description" : "Début de la période ; par défaut le premier jour du mois courant",
12689
+ "in" : "query",
12690
+ "name" : "startDate",
12691
+ "schema" : {
12692
+ "format" : "date-time",
12693
+ "type" : "string"
12694
+ }
12695
+ }, {
12696
+ "description" : "Fin de la période ; par défaut le dernier jour du mois courant",
12697
+ "in" : "query",
12698
+ "name" : "endDate",
12699
+ "schema" : {
12700
+ "format" : "date-time",
12701
+ "type" : "string"
12702
+ }
12703
+ }, {
12704
+ "description" : "Pas de regroupement de la série temporelle",
12705
+ "in" : "query",
12706
+ "name" : "granularity",
12707
+ "schema" : {
12708
+ "default" : "day",
12709
+ "enum" : [ "hour", "day", "week" ],
12710
+ "type" : "string"
12711
+ }
12712
+ } ],
12713
+ "responses" : {
12714
+ "200" : {
12715
+ "content" : {
12716
+ "application/json" : {
12717
+ "schema" : {
12718
+ "$ref" : "#/components/schemas/AiGatewayUsage"
12719
+ }
12720
+ }
12721
+ },
12722
+ "description" : "Usage metrics retrieved successfully"
12723
+ },
12724
+ "401" : {
12725
+ "content" : {
12726
+ "application/json" : {
12727
+ "schema" : {
12728
+ "$ref" : "#/components/schemas/AiGatewayError"
12729
+ }
12730
+ }
12731
+ },
12732
+ "description" : "Unauthenticated — no caller identity could be established"
12733
+ },
12734
+ "403" : {
12735
+ "content" : {
12736
+ "application/json" : {
12737
+ "schema" : {
12738
+ "$ref" : "#/components/schemas/AiGatewayError"
12739
+ }
12740
+ }
12741
+ },
12742
+ "description" : "Forbidden — the caller is not an admin of the organization"
12743
+ }
12744
+ },
12745
+ "summary" : "Get AI gateway usage metrics",
12746
+ "tags" : [ "ai-gateway" ]
12747
+ }
12748
+ },
12675
12749
  "/organizations/{organizationId}/openai/chat/completions" : {
12676
12750
  "post" : {
12677
12751
  "description" : "OpenAI-compatible chat completion. Contrairement à `/ai-gateway/chat/completions`, la réponse OpenAI native est relayée sans transformation, `stream_options` est accepté, et la consommation de tokens est enregistrée dans les métriques de l'organisation.\n\nToutes les erreurs utilisent l'enveloppe OpenAI `{ error: { message } }`.",
@@ -19577,6 +19651,112 @@
19577
19651
  },
19578
19652
  "type" : "object"
19579
19653
  },
19654
+ "AiGatewayUsage" : {
19655
+ "properties" : {
19656
+ "total" : {
19657
+ "$ref" : "#/components/schemas/AiGatewayUsageTotal"
19658
+ },
19659
+ "series" : {
19660
+ "items" : {
19661
+ "$ref" : "#/components/schemas/AiGatewayUsagePoint"
19662
+ },
19663
+ "type" : "array"
19664
+ },
19665
+ "byModel" : {
19666
+ "items" : {
19667
+ "$ref" : "#/components/schemas/AiGatewayUsageBreakdownItem"
19668
+ },
19669
+ "type" : "array"
19670
+ },
19671
+ "byProvider" : {
19672
+ "items" : {
19673
+ "$ref" : "#/components/schemas/AiGatewayUsageBreakdownItem"
19674
+ },
19675
+ "type" : "array"
19676
+ },
19677
+ "byUser" : {
19678
+ "items" : {
19679
+ "$ref" : "#/components/schemas/AiGatewayUsageBreakdownItem"
19680
+ },
19681
+ "type" : "array"
19682
+ }
19683
+ },
19684
+ "required" : [ "byModel", "byProvider", "byUser", "series", "total" ],
19685
+ "type" : "object"
19686
+ },
19687
+ "AiGatewayUsageTotal" : {
19688
+ "properties" : {
19689
+ "requests" : {
19690
+ "type" : "integer"
19691
+ },
19692
+ "inputTokens" : {
19693
+ "type" : "integer"
19694
+ },
19695
+ "outputTokens" : {
19696
+ "type" : "integer"
19697
+ },
19698
+ "reasoningTokens" : {
19699
+ "type" : "integer"
19700
+ },
19701
+ "totalTokens" : {
19702
+ "type" : "integer"
19703
+ },
19704
+ "uniqueUsers" : {
19705
+ "type" : "integer"
19706
+ }
19707
+ },
19708
+ "required" : [ "inputTokens", "outputTokens", "reasoningTokens", "requests", "totalTokens", "uniqueUsers" ],
19709
+ "type" : "object"
19710
+ },
19711
+ "AiGatewayUsagePoint" : {
19712
+ "properties" : {
19713
+ "bucket" : {
19714
+ "description" : "Clé de regroupement temporel, dépendante de la granularité demandée",
19715
+ "type" : "string"
19716
+ },
19717
+ "label" : {
19718
+ "type" : "string"
19719
+ },
19720
+ "requests" : {
19721
+ "type" : "integer"
19722
+ },
19723
+ "inputTokens" : {
19724
+ "type" : "integer"
19725
+ },
19726
+ "outputTokens" : {
19727
+ "type" : "integer"
19728
+ }
19729
+ },
19730
+ "required" : [ "bucket", "inputTokens", "label", "outputTokens", "requests" ],
19731
+ "type" : "object"
19732
+ },
19733
+ "AiGatewayUsageBreakdownItem" : {
19734
+ "description" : "Consommation agrégée sur une dimension (modèle, provider ou utilisateur).",
19735
+ "properties" : {
19736
+ "key" : {
19737
+ "description" : "Identifiant brut de la dimension (id de modèle, de provider ou d'utilisateur)",
19738
+ "type" : "string"
19739
+ },
19740
+ "label" : {
19741
+ "description" : "Libellé affichable ; pour un utilisateur, son email lorsqu'il est connu",
19742
+ "type" : "string"
19743
+ },
19744
+ "requests" : {
19745
+ "type" : "integer"
19746
+ },
19747
+ "inputTokens" : {
19748
+ "type" : "integer"
19749
+ },
19750
+ "outputTokens" : {
19751
+ "type" : "integer"
19752
+ },
19753
+ "totalTokens" : {
19754
+ "type" : "integer"
19755
+ }
19756
+ },
19757
+ "required" : [ "inputTokens", "key", "label", "outputTokens", "requests", "totalTokens" ],
19758
+ "type" : "object"
19759
+ },
19580
19760
  "OpenAiChatCompletionRequest" : {
19581
19761
  "additionalProperties" : false,
19582
19762
  "properties" : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breign/client",
3
- "version": "1.0.130",
3
+ "version": "1.0.131",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",