@breign/client 1.0.130 → 1.0.132

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 (40) hide show
  1. package/dist/apis/AiGatewayApi.d.ts +133 -1
  2. package/dist/apis/AiGatewayApi.js +264 -1
  3. package/dist/models/AiGatewayUsageBreakdownItemUio.d.ts +62 -0
  4. package/dist/models/AiGatewayUsageBreakdownItemUio.js +70 -0
  5. package/dist/models/AiGatewayUsagePointUio.d.ts +56 -0
  6. package/dist/models/AiGatewayUsagePointUio.js +66 -0
  7. package/dist/models/AiGatewayUsageTotalUio.d.ts +62 -0
  8. package/dist/models/AiGatewayUsageTotalUio.js +70 -0
  9. package/dist/models/AiGatewayUsageUio.d.ts +59 -0
  10. package/dist/models/AiGatewayUsageUio.js +69 -0
  11. package/dist/models/AiGatewayV1CreditsUio.d.ts +38 -0
  12. package/dist/models/AiGatewayV1CreditsUio.js +52 -0
  13. package/dist/models/AiGatewayV1EndpointPricingUio.d.ts +50 -0
  14. package/dist/models/AiGatewayV1EndpointPricingUio.js +54 -0
  15. package/dist/models/AiGatewayV1EndpointUio.d.ts +111 -0
  16. package/dist/models/AiGatewayV1EndpointUio.js +85 -0
  17. package/dist/models/AiGatewayV1GenerationDataUio.d.ts +146 -0
  18. package/dist/models/AiGatewayV1GenerationDataUio.js +96 -0
  19. package/dist/models/AiGatewayV1GenerationUio.d.ts +33 -0
  20. package/dist/models/AiGatewayV1GenerationUio.js +51 -0
  21. package/dist/models/AiGatewayV1ModelEndpointsDataArchitectureUio.d.ts +56 -0
  22. package/dist/models/AiGatewayV1ModelEndpointsDataArchitectureUio.js +56 -0
  23. package/dist/models/AiGatewayV1ModelEndpointsDataUio.d.ts +70 -0
  24. package/dist/models/AiGatewayV1ModelEndpointsDataUio.js +72 -0
  25. package/dist/models/AiGatewayV1ModelEndpointsUio.d.ts +33 -0
  26. package/dist/models/AiGatewayV1ModelEndpointsUio.js +51 -0
  27. package/dist/models/AiGatewayV1ModelListUio.d.ts +46 -0
  28. package/dist/models/AiGatewayV1ModelListUio.js +62 -0
  29. package/dist/models/AiGatewayV1ModelPricingUio.d.ts +50 -0
  30. package/dist/models/AiGatewayV1ModelPricingUio.js +54 -0
  31. package/dist/models/AiGatewayV1ModelUio.d.ts +114 -0
  32. package/dist/models/AiGatewayV1ModelUio.js +99 -0
  33. package/dist/models/AiGatewayV1ReportRowUio.d.ts +140 -0
  34. package/dist/models/AiGatewayV1ReportRowUio.js +104 -0
  35. package/dist/models/AiGatewayV1ReportUio.d.ts +33 -0
  36. package/dist/models/AiGatewayV1ReportUio.js +51 -0
  37. package/dist/models/index.d.ts +17 -0
  38. package/dist/models/index.js +17 -0
  39. package/dist/openapi.json +1337 -345
  40. package/package.json +1 -1
@@ -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, AiGatewayV1CreditsUio, AiGatewayV1GenerationUio, AiGatewayV1ModelEndpointsUio, AiGatewayV1ModelListUio, AiGatewayV1ReportUio, OpenAiChatCompletionRequestUio, OpenAiChatCompletionResponseUio } from '../models/index';
14
14
  export interface CreateAiGatewayChatCompletionRequest {
15
15
  organizationId: string;
16
16
  aiGatewayChatCompletionRequestUio: AiGatewayChatCompletionRequestUio;
@@ -26,13 +26,46 @@ 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;
32
38
  }
39
+ export interface GetAiGatewayV1CreditsRequest {
40
+ organizationId: string;
41
+ }
42
+ export interface GetAiGatewayV1GenerationRequest {
43
+ organizationId: string;
44
+ id: string;
45
+ }
46
+ export interface GetAiGatewayV1ModelEndpointsRequest {
47
+ organizationId: string;
48
+ creator: string;
49
+ model: string;
50
+ }
51
+ export interface GetAiGatewayV1ReportRequest {
52
+ organizationId: string;
53
+ startDate: string;
54
+ endDate: string;
55
+ groupBy?: GetAiGatewayV1ReportGroupByEnum;
56
+ datePart?: GetAiGatewayV1ReportDatePartEnum;
57
+ userId?: string;
58
+ model?: string;
59
+ provider?: string;
60
+ tags?: string;
61
+ tagsMatch?: GetAiGatewayV1ReportTagsMatchEnum;
62
+ }
33
63
  export interface ListAiGatewayModelsRequest {
34
64
  organizationId: string;
35
65
  }
66
+ export interface ListAiGatewayV1ModelsRequest {
67
+ organizationId: string;
68
+ }
36
69
  /**
37
70
  *
38
71
  */
@@ -77,6 +110,16 @@ export declare class AiGatewayApi extends runtime.BaseAPI {
77
110
  * Get AI gateway credits
78
111
  */
79
112
  getAiGatewayCredits(organizationId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
113
+ /**
114
+ * 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.
115
+ * Get AI gateway usage metrics
116
+ */
117
+ getAiGatewayMetricsRaw(requestParameters: GetAiGatewayMetricsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AiGatewayUsageUio>>;
118
+ /**
119
+ * 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.
120
+ * Get AI gateway usage metrics
121
+ */
122
+ getAiGatewayMetrics(organizationId: string, startDate?: Date, endDate?: Date, granularity?: GetAiGatewayMetricsGranularityEnum, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayUsageUio>;
80
123
  /**
81
124
  * Returns a single model in an OpenAI-compatible shape, resolved against the organization\'s engine providers.
82
125
  * Get a model available through the AI gateway
@@ -87,6 +130,46 @@ export declare class AiGatewayApi extends runtime.BaseAPI {
87
130
  * Get a model available through the AI gateway
88
131
  */
89
132
  getAiGatewayModel(organizationId: string, model: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayModelUio>;
133
+ /**
134
+ * Équivalent de `GET /v1/credits`. `total_used` est la dépense cumulée de l\'organisation, calculée depuis la configuration de prix. `balance` est toujours null : Breign n\'a pas de notion de crédits prépayés.
135
+ * Check credit balance (AI Gateway REST API)
136
+ */
137
+ getAiGatewayV1CreditsRaw(requestParameters: GetAiGatewayV1CreditsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AiGatewayV1CreditsUio>>;
138
+ /**
139
+ * Équivalent de `GET /v1/credits`. `total_used` est la dépense cumulée de l\'organisation, calculée depuis la configuration de prix. `balance` est toujours null : Breign n\'a pas de notion de crédits prépayés.
140
+ * Check credit balance (AI Gateway REST API)
141
+ */
142
+ getAiGatewayV1Credits(organizationId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayV1CreditsUio>;
143
+ /**
144
+ * Équivalent de `GET /v1/generation`. L\'identifiant est renvoyé comme `id` des complétions compatibles OpenAI, injecté dans le premier chunk en streaming, et exposé dans `providerMetadata.gateway.generationId` sur les routes AI SDK.
145
+ * Look up a generation (AI Gateway REST API)
146
+ */
147
+ getAiGatewayV1GenerationRaw(requestParameters: GetAiGatewayV1GenerationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AiGatewayV1GenerationUio>>;
148
+ /**
149
+ * Équivalent de `GET /v1/generation`. L\'identifiant est renvoyé comme `id` des complétions compatibles OpenAI, injecté dans le premier chunk en streaming, et exposé dans `providerMetadata.gateway.generationId` sur les routes AI SDK.
150
+ * Look up a generation (AI Gateway REST API)
151
+ */
152
+ getAiGatewayV1Generation(organizationId: string, id: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayV1GenerationUio>;
153
+ /**
154
+ * Équivalent de `GET /v1/models/{creator}/{model}/endpoints`. Un modèle n\'étant servi que par le provider qui le déclare dans l\'organisation, la liste contient toujours un seul endpoint. Les identifiants Breign n\'ayant pas toujours de créateur, `{creator}/{model}` est résolu d\'abord tel quel, puis sur le seul segment `{model}`.
155
+ * Get model endpoints (AI Gateway REST API)
156
+ */
157
+ getAiGatewayV1ModelEndpointsRaw(requestParameters: GetAiGatewayV1ModelEndpointsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AiGatewayV1ModelEndpointsUio>>;
158
+ /**
159
+ * Équivalent de `GET /v1/models/{creator}/{model}/endpoints`. Un modèle n\'étant servi que par le provider qui le déclare dans l\'organisation, la liste contient toujours un seul endpoint. Les identifiants Breign n\'ayant pas toujours de créateur, `{creator}/{model}` est résolu d\'abord tel quel, puis sur le seul segment `{model}`.
160
+ * Get model endpoints (AI Gateway REST API)
161
+ */
162
+ getAiGatewayV1ModelEndpoints(organizationId: string, creator: string, model: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayV1ModelEndpointsUio>;
163
+ /**
164
+ * Équivalent de `GET /v1/report`. L\'attribution applicative provient des en-têtes `ai-reporting-user` et `ai-reporting-tags` posés sur les appels d\'inférence. Réservé aux administrateurs de l\'organisation.
165
+ * Query spend report (AI Gateway REST API)
166
+ */
167
+ getAiGatewayV1ReportRaw(requestParameters: GetAiGatewayV1ReportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AiGatewayV1ReportUio>>;
168
+ /**
169
+ * Équivalent de `GET /v1/report`. L\'attribution applicative provient des en-têtes `ai-reporting-user` et `ai-reporting-tags` posés sur les appels d\'inférence. Réservé aux administrateurs de l\'organisation.
170
+ * Query spend report (AI Gateway REST API)
171
+ */
172
+ getAiGatewayV1Report(organizationId: string, startDate: string, endDate: string, groupBy?: GetAiGatewayV1ReportGroupByEnum, datePart?: GetAiGatewayV1ReportDatePartEnum, userId?: string, model?: string, provider?: string, tags?: string, tagsMatch?: GetAiGatewayV1ReportTagsMatchEnum, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayV1ReportUio>;
90
173
  /**
91
174
  * Lists every model exposed by the organization\'s engine providers, in an OpenAI-compatible envelope. Accessible à tout membre de l\'organisation. Chaque `id` est l\'identifiant côté provider : c\'est la valeur à renvoyer dans `model` sur les endpoints de complétion et d\'embedding.
92
175
  * List models available through the AI gateway
@@ -97,4 +180,53 @@ export declare class AiGatewayApi extends runtime.BaseAPI {
97
180
  * List models available through the AI gateway
98
181
  */
99
182
  listAiGatewayModels(organizationId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayModelListUio>;
183
+ /**
184
+ * Équivalent de `GET /v1/models` de l\'AI Gateway Vercel, monté sous le préfixe organisation. Liste les modèles des providers configurés pour l\'organisation.
185
+ * List models (AI Gateway REST API)
186
+ */
187
+ listAiGatewayV1ModelsRaw(requestParameters: ListAiGatewayV1ModelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AiGatewayV1ModelListUio>>;
188
+ /**
189
+ * Équivalent de `GET /v1/models` de l\'AI Gateway Vercel, monté sous le préfixe organisation. Liste les modèles des providers configurés pour l\'organisation.
190
+ * List models (AI Gateway REST API)
191
+ */
192
+ listAiGatewayV1Models(organizationId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AiGatewayV1ModelListUio>;
100
193
  }
194
+ /**
195
+ * @export
196
+ */
197
+ export declare const GetAiGatewayMetricsGranularityEnum: {
198
+ readonly Hour: "hour";
199
+ readonly Day: "day";
200
+ readonly Week: "week";
201
+ };
202
+ export type GetAiGatewayMetricsGranularityEnum = typeof GetAiGatewayMetricsGranularityEnum[keyof typeof GetAiGatewayMetricsGranularityEnum];
203
+ /**
204
+ * @export
205
+ */
206
+ export declare const GetAiGatewayV1ReportGroupByEnum: {
207
+ readonly Day: "day";
208
+ readonly User: "user";
209
+ readonly Model: "model";
210
+ readonly Tag: "tag";
211
+ readonly Provider: "provider";
212
+ readonly CredentialType: "credential_type";
213
+ readonly ZeroDataRetention: "zero_data_retention";
214
+ readonly ApiKeyName: "api_key_name";
215
+ };
216
+ export type GetAiGatewayV1ReportGroupByEnum = typeof GetAiGatewayV1ReportGroupByEnum[keyof typeof GetAiGatewayV1ReportGroupByEnum];
217
+ /**
218
+ * @export
219
+ */
220
+ export declare const GetAiGatewayV1ReportDatePartEnum: {
221
+ readonly Day: "day";
222
+ readonly Hour: "hour";
223
+ };
224
+ export type GetAiGatewayV1ReportDatePartEnum = typeof GetAiGatewayV1ReportDatePartEnum[keyof typeof GetAiGatewayV1ReportDatePartEnum];
225
+ /**
226
+ * @export
227
+ */
228
+ export declare const GetAiGatewayV1ReportTagsMatchEnum: {
229
+ readonly Any: "any";
230
+ readonly All: "all";
231
+ };
232
+ export type GetAiGatewayV1ReportTagsMatchEnum = typeof GetAiGatewayV1ReportTagsMatchEnum[keyof typeof GetAiGatewayV1ReportTagsMatchEnum];
@@ -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.GetAiGatewayV1ReportTagsMatchEnum = exports.GetAiGatewayV1ReportDatePartEnum = exports.GetAiGatewayV1ReportGroupByEnum = 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
@@ -215,6 +253,167 @@ class AiGatewayApi extends runtime.BaseAPI {
215
253
  const response = await this.getAiGatewayModelRaw({ organizationId: organizationId, model: model }, initOverrides);
216
254
  return await response.value();
217
255
  }
256
+ /**
257
+ * Équivalent de `GET /v1/credits`. `total_used` est la dépense cumulée de l\'organisation, calculée depuis la configuration de prix. `balance` est toujours null : Breign n\'a pas de notion de crédits prépayés.
258
+ * Check credit balance (AI Gateway REST API)
259
+ */
260
+ async getAiGatewayV1CreditsRaw(requestParameters, initOverrides) {
261
+ if (requestParameters['organizationId'] == null) {
262
+ throw new runtime.RequiredError('organizationId', 'Required parameter "organizationId" was null or undefined when calling getAiGatewayV1Credits().');
263
+ }
264
+ const queryParameters = {};
265
+ const headerParameters = {};
266
+ if (this.configuration && this.configuration.apiKey) {
267
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
268
+ }
269
+ const response = await this.request({
270
+ path: `/organizations/{organizationId}/ai-gateway/v1/credits`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
271
+ method: 'GET',
272
+ headers: headerParameters,
273
+ query: queryParameters,
274
+ }, initOverrides);
275
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AiGatewayV1CreditsUioFromJSON)(jsonValue));
276
+ }
277
+ /**
278
+ * Équivalent de `GET /v1/credits`. `total_used` est la dépense cumulée de l\'organisation, calculée depuis la configuration de prix. `balance` est toujours null : Breign n\'a pas de notion de crédits prépayés.
279
+ * Check credit balance (AI Gateway REST API)
280
+ */
281
+ async getAiGatewayV1Credits(organizationId, initOverrides) {
282
+ const response = await this.getAiGatewayV1CreditsRaw({ organizationId: organizationId }, initOverrides);
283
+ return await response.value();
284
+ }
285
+ /**
286
+ * Équivalent de `GET /v1/generation`. L\'identifiant est renvoyé comme `id` des complétions compatibles OpenAI, injecté dans le premier chunk en streaming, et exposé dans `providerMetadata.gateway.generationId` sur les routes AI SDK.
287
+ * Look up a generation (AI Gateway REST API)
288
+ */
289
+ async getAiGatewayV1GenerationRaw(requestParameters, initOverrides) {
290
+ if (requestParameters['organizationId'] == null) {
291
+ throw new runtime.RequiredError('organizationId', 'Required parameter "organizationId" was null or undefined when calling getAiGatewayV1Generation().');
292
+ }
293
+ if (requestParameters['id'] == null) {
294
+ throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getAiGatewayV1Generation().');
295
+ }
296
+ const queryParameters = {};
297
+ if (requestParameters['id'] != null) {
298
+ queryParameters['id'] = requestParameters['id'];
299
+ }
300
+ const headerParameters = {};
301
+ if (this.configuration && this.configuration.apiKey) {
302
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
303
+ }
304
+ const response = await this.request({
305
+ path: `/organizations/{organizationId}/ai-gateway/v1/generation`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
306
+ method: 'GET',
307
+ headers: headerParameters,
308
+ query: queryParameters,
309
+ }, initOverrides);
310
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AiGatewayV1GenerationUioFromJSON)(jsonValue));
311
+ }
312
+ /**
313
+ * Équivalent de `GET /v1/generation`. L\'identifiant est renvoyé comme `id` des complétions compatibles OpenAI, injecté dans le premier chunk en streaming, et exposé dans `providerMetadata.gateway.generationId` sur les routes AI SDK.
314
+ * Look up a generation (AI Gateway REST API)
315
+ */
316
+ async getAiGatewayV1Generation(organizationId, id, initOverrides) {
317
+ const response = await this.getAiGatewayV1GenerationRaw({ organizationId: organizationId, id: id }, initOverrides);
318
+ return await response.value();
319
+ }
320
+ /**
321
+ * Équivalent de `GET /v1/models/{creator}/{model}/endpoints`. Un modèle n\'étant servi que par le provider qui le déclare dans l\'organisation, la liste contient toujours un seul endpoint. Les identifiants Breign n\'ayant pas toujours de créateur, `{creator}/{model}` est résolu d\'abord tel quel, puis sur le seul segment `{model}`.
322
+ * Get model endpoints (AI Gateway REST API)
323
+ */
324
+ async getAiGatewayV1ModelEndpointsRaw(requestParameters, initOverrides) {
325
+ if (requestParameters['organizationId'] == null) {
326
+ throw new runtime.RequiredError('organizationId', 'Required parameter "organizationId" was null or undefined when calling getAiGatewayV1ModelEndpoints().');
327
+ }
328
+ if (requestParameters['creator'] == null) {
329
+ throw new runtime.RequiredError('creator', 'Required parameter "creator" was null or undefined when calling getAiGatewayV1ModelEndpoints().');
330
+ }
331
+ if (requestParameters['model'] == null) {
332
+ throw new runtime.RequiredError('model', 'Required parameter "model" was null or undefined when calling getAiGatewayV1ModelEndpoints().');
333
+ }
334
+ const queryParameters = {};
335
+ const headerParameters = {};
336
+ if (this.configuration && this.configuration.apiKey) {
337
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
338
+ }
339
+ const response = await this.request({
340
+ path: `/organizations/{organizationId}/ai-gateway/v1/models/{creator}/{model}/endpoints`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))).replace(`{${"creator"}}`, encodeURIComponent(String(requestParameters['creator']))).replace(`{${"model"}}`, encodeURIComponent(String(requestParameters['model']))),
341
+ method: 'GET',
342
+ headers: headerParameters,
343
+ query: queryParameters,
344
+ }, initOverrides);
345
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AiGatewayV1ModelEndpointsUioFromJSON)(jsonValue));
346
+ }
347
+ /**
348
+ * Équivalent de `GET /v1/models/{creator}/{model}/endpoints`. Un modèle n\'étant servi que par le provider qui le déclare dans l\'organisation, la liste contient toujours un seul endpoint. Les identifiants Breign n\'ayant pas toujours de créateur, `{creator}/{model}` est résolu d\'abord tel quel, puis sur le seul segment `{model}`.
349
+ * Get model endpoints (AI Gateway REST API)
350
+ */
351
+ async getAiGatewayV1ModelEndpoints(organizationId, creator, model, initOverrides) {
352
+ const response = await this.getAiGatewayV1ModelEndpointsRaw({ organizationId: organizationId, creator: creator, model: model }, initOverrides);
353
+ return await response.value();
354
+ }
355
+ /**
356
+ * Équivalent de `GET /v1/report`. L\'attribution applicative provient des en-têtes `ai-reporting-user` et `ai-reporting-tags` posés sur les appels d\'inférence. Réservé aux administrateurs de l\'organisation.
357
+ * Query spend report (AI Gateway REST API)
358
+ */
359
+ async getAiGatewayV1ReportRaw(requestParameters, initOverrides) {
360
+ if (requestParameters['organizationId'] == null) {
361
+ throw new runtime.RequiredError('organizationId', 'Required parameter "organizationId" was null or undefined when calling getAiGatewayV1Report().');
362
+ }
363
+ if (requestParameters['startDate'] == null) {
364
+ throw new runtime.RequiredError('startDate', 'Required parameter "startDate" was null or undefined when calling getAiGatewayV1Report().');
365
+ }
366
+ if (requestParameters['endDate'] == null) {
367
+ throw new runtime.RequiredError('endDate', 'Required parameter "endDate" was null or undefined when calling getAiGatewayV1Report().');
368
+ }
369
+ const queryParameters = {};
370
+ if (requestParameters['startDate'] != null) {
371
+ queryParameters['start_date'] = requestParameters['startDate'];
372
+ }
373
+ if (requestParameters['endDate'] != null) {
374
+ queryParameters['end_date'] = requestParameters['endDate'];
375
+ }
376
+ if (requestParameters['groupBy'] != null) {
377
+ queryParameters['group_by'] = requestParameters['groupBy'];
378
+ }
379
+ if (requestParameters['datePart'] != null) {
380
+ queryParameters['date_part'] = requestParameters['datePart'];
381
+ }
382
+ if (requestParameters['userId'] != null) {
383
+ queryParameters['user_id'] = requestParameters['userId'];
384
+ }
385
+ if (requestParameters['model'] != null) {
386
+ queryParameters['model'] = requestParameters['model'];
387
+ }
388
+ if (requestParameters['provider'] != null) {
389
+ queryParameters['provider'] = requestParameters['provider'];
390
+ }
391
+ if (requestParameters['tags'] != null) {
392
+ queryParameters['tags'] = requestParameters['tags'];
393
+ }
394
+ if (requestParameters['tagsMatch'] != null) {
395
+ queryParameters['tags_match'] = requestParameters['tagsMatch'];
396
+ }
397
+ const headerParameters = {};
398
+ if (this.configuration && this.configuration.apiKey) {
399
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
400
+ }
401
+ const response = await this.request({
402
+ path: `/organizations/{organizationId}/ai-gateway/v1/report`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
403
+ method: 'GET',
404
+ headers: headerParameters,
405
+ query: queryParameters,
406
+ }, initOverrides);
407
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AiGatewayV1ReportUioFromJSON)(jsonValue));
408
+ }
409
+ /**
410
+ * Équivalent de `GET /v1/report`. L\'attribution applicative provient des en-têtes `ai-reporting-user` et `ai-reporting-tags` posés sur les appels d\'inférence. Réservé aux administrateurs de l\'organisation.
411
+ * Query spend report (AI Gateway REST API)
412
+ */
413
+ async getAiGatewayV1Report(organizationId, startDate, endDate, groupBy, datePart, userId, model, provider, tags, tagsMatch, initOverrides) {
414
+ const response = await this.getAiGatewayV1ReportRaw({ organizationId: organizationId, startDate: startDate, endDate: endDate, groupBy: groupBy, datePart: datePart, userId: userId, model: model, provider: provider, tags: tags, tagsMatch: tagsMatch }, initOverrides);
415
+ return await response.value();
416
+ }
218
417
  /**
219
418
  * Lists every model exposed by the organization\'s engine providers, in an OpenAI-compatible envelope. Accessible à tout membre de l\'organisation. Chaque `id` est l\'identifiant côté provider : c\'est la valeur à renvoyer dans `model` sur les endpoints de complétion et d\'embedding.
220
419
  * List models available through the AI gateway
@@ -244,5 +443,69 @@ class AiGatewayApi extends runtime.BaseAPI {
244
443
  const response = await this.listAiGatewayModelsRaw({ organizationId: organizationId }, initOverrides);
245
444
  return await response.value();
246
445
  }
446
+ /**
447
+ * Équivalent de `GET /v1/models` de l\'AI Gateway Vercel, monté sous le préfixe organisation. Liste les modèles des providers configurés pour l\'organisation.
448
+ * List models (AI Gateway REST API)
449
+ */
450
+ async listAiGatewayV1ModelsRaw(requestParameters, initOverrides) {
451
+ if (requestParameters['organizationId'] == null) {
452
+ throw new runtime.RequiredError('organizationId', 'Required parameter "organizationId" was null or undefined when calling listAiGatewayV1Models().');
453
+ }
454
+ const queryParameters = {};
455
+ const headerParameters = {};
456
+ if (this.configuration && this.configuration.apiKey) {
457
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key"); // ApiKeyAuth authentication
458
+ }
459
+ const response = await this.request({
460
+ path: `/organizations/{organizationId}/ai-gateway/v1/models`.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))),
461
+ method: 'GET',
462
+ headers: headerParameters,
463
+ query: queryParameters,
464
+ }, initOverrides);
465
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AiGatewayV1ModelListUioFromJSON)(jsonValue));
466
+ }
467
+ /**
468
+ * Équivalent de `GET /v1/models` de l\'AI Gateway Vercel, monté sous le préfixe organisation. Liste les modèles des providers configurés pour l\'organisation.
469
+ * List models (AI Gateway REST API)
470
+ */
471
+ async listAiGatewayV1Models(organizationId, initOverrides) {
472
+ const response = await this.listAiGatewayV1ModelsRaw({ organizationId: organizationId }, initOverrides);
473
+ return await response.value();
474
+ }
247
475
  }
248
476
  exports.AiGatewayApi = AiGatewayApi;
477
+ /**
478
+ * @export
479
+ */
480
+ exports.GetAiGatewayMetricsGranularityEnum = {
481
+ Hour: 'hour',
482
+ Day: 'day',
483
+ Week: 'week'
484
+ };
485
+ /**
486
+ * @export
487
+ */
488
+ exports.GetAiGatewayV1ReportGroupByEnum = {
489
+ Day: 'day',
490
+ User: 'user',
491
+ Model: 'model',
492
+ Tag: 'tag',
493
+ Provider: 'provider',
494
+ CredentialType: 'credential_type',
495
+ ZeroDataRetention: 'zero_data_retention',
496
+ ApiKeyName: 'api_key_name'
497
+ };
498
+ /**
499
+ * @export
500
+ */
501
+ exports.GetAiGatewayV1ReportDatePartEnum = {
502
+ Day: 'day',
503
+ Hour: 'hour'
504
+ };
505
+ /**
506
+ * @export
507
+ */
508
+ exports.GetAiGatewayV1ReportTagsMatchEnum = {
509
+ Any: 'any',
510
+ All: 'all'
511
+ };
@@ -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;