@gpuai/sdk 0.5.1 → 0.5.2
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.
- package/.openapi-generator/FILES +4 -0
- package/README.md +6 -2
- package/dist/apis/InferenceApi.d.ts +60 -0
- package/dist/apis/InferenceApi.js +126 -1
- package/dist/esm/apis/InferenceApi.d.ts +60 -0
- package/dist/esm/apis/InferenceApi.js +125 -0
- package/dist/esm/models/DataRetention.d.ts +51 -0
- package/dist/esm/models/DataRetention.js +57 -0
- package/dist/esm/models/Model.d.ts +6 -0
- package/dist/esm/models/Model.js +2 -0
- package/dist/esm/models/UpdateDataRetentionRequest.d.ts +32 -0
- package/dist/esm/models/UpdateDataRetentionRequest.js +43 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/DataRetention.d.ts +51 -0
- package/dist/models/DataRetention.js +65 -0
- package/dist/models/Model.d.ts +6 -0
- package/dist/models/Model.js +2 -0
- package/dist/models/UpdateDataRetentionRequest.d.ts +32 -0
- package/dist/models/UpdateDataRetentionRequest.js +50 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/runtime.js +1 -1
- package/docs/DataRetention.md +38 -0
- package/docs/FineTuningApi.md +2 -2
- package/docs/InferenceApi.md +163 -12
- package/docs/Model.md +2 -0
- package/docs/UpdateDataRetentionRequest.md +34 -0
- package/package.json +1 -1
- package/src/apis/InferenceApi.ts +162 -0
- package/src/models/DataRetention.ts +95 -0
- package/src/models/Model.ts +8 -0
- package/src/models/UpdateDataRetentionRequest.ts +66 -0
- package/src/models/index.ts +2 -0
- package/src/runtime.ts +1 -1
package/docs/InferenceApi.md
CHANGED
|
@@ -9,11 +9,13 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
9
9
|
| [**createEmbeddings**](InferenceApi.md#createembeddings) | **POST** /embeddings | Create embeddings (OpenAI-compatible) |
|
|
10
10
|
| [**createImage**](InferenceApi.md#createimage) | **POST** /images/generations | Create image (OpenAI-compatible) |
|
|
11
11
|
| [**createVideo**](InferenceApi.md#createvideo) | **POST** /videos | Create a video generation job (async) |
|
|
12
|
+
| [**getDataRetention**](InferenceApi.md#getdataretention) | **GET** /organization/data-retention | Get the org zero data retention setting |
|
|
12
13
|
| [**getModel**](InferenceApi.md#getmodel) | **GET** /models/{id} | Get a specific model (OpenAI-compatible) |
|
|
13
14
|
| [**getVideo**](InferenceApi.md#getvideo) | **GET** /videos/{id} | Get a video generation job |
|
|
14
15
|
| [**getVideoContent**](InferenceApi.md#getvideocontent) | **GET** /videos/{id}/content | Download a completed video artifact |
|
|
15
16
|
| [**listModels**](InferenceApi.md#listmodels) | **GET** /models | List available models (OpenAI-compatible) |
|
|
16
17
|
| [**listVideos**](InferenceApi.md#listvideos) | **GET** /videos | List video generation jobs |
|
|
18
|
+
| [**updateDataRetention**](InferenceApi.md#updatedataretentionoperation) | **PUT** /organization/data-retention | Turn zero data retention on or off for the org |
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
|
|
@@ -85,7 +87,7 @@ example().catch(console.error);
|
|
|
85
87
|
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
86
88
|
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
87
89
|
| **404** | Model or resource not found (OpenAI error envelope). | - |
|
|
88
|
-
| **409** | Invalid request (OpenAI error envelope). | - |
|
|
90
|
+
| **409** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
89
91
|
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
90
92
|
|
|
91
93
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -93,7 +95,7 @@ example().catch(console.error);
|
|
|
93
95
|
|
|
94
96
|
## createChatCompletion
|
|
95
97
|
|
|
96
|
-
> ChatCompletionResponse createChatCompletion(chatCompletionRequest)
|
|
98
|
+
> ChatCompletionResponse createChatCompletion(chatCompletionRequest, xGPUAIZeroDataRetention)
|
|
97
99
|
|
|
98
100
|
Create a chat completion (OpenAI-compatible)
|
|
99
101
|
|
|
@@ -117,6 +119,8 @@ async function example() {
|
|
|
117
119
|
const body = {
|
|
118
120
|
// ChatCompletionRequest
|
|
119
121
|
chatCompletionRequest: ...,
|
|
122
|
+
// 'true' | 'false' | Send `true` to require zero data retention for this request even when the org setting is off. It can only tighten routing: `false` never relaxes an org with zero data retention on. Responses routed under zero data retention echo this header with `true`. A model without a zero-data-retention host returns 400 `zero_data_retention_unavailable`; a value other than true/false returns 400 `invalid_header`. (optional)
|
|
123
|
+
xGPUAIZeroDataRetention: xGPUAIZeroDataRetention_example,
|
|
120
124
|
} satisfies CreateChatCompletionRequest;
|
|
121
125
|
|
|
122
126
|
try {
|
|
@@ -137,6 +141,7 @@ example().catch(console.error);
|
|
|
137
141
|
| Name | Type | Description | Notes |
|
|
138
142
|
|------------- | ------------- | ------------- | -------------|
|
|
139
143
|
| **chatCompletionRequest** | [ChatCompletionRequest](ChatCompletionRequest.md) | | |
|
|
144
|
+
| **xGPUAIZeroDataRetention** | `true`, `false` | Send `true` to require zero data retention for this request even when the org setting is off. It can only tighten routing: `false` never relaxes an org with zero data retention on. Responses routed under zero data retention echo this header with `true`. A model without a zero-data-retention host returns 400 `zero_data_retention_unavailable`; a value other than true/false returns 400 `invalid_header`. | [Optional] [Defaults to `undefined`] [Enum: true, false] |
|
|
140
145
|
|
|
141
146
|
### Return type
|
|
142
147
|
|
|
@@ -156,7 +161,7 @@ example().catch(console.error);
|
|
|
156
161
|
| Status code | Description | Response headers |
|
|
157
162
|
|-------------|-------------|------------------|
|
|
158
163
|
| **200** | Successful response. application/json for non-streaming requests; text/event-stream for streaming requests (stream=true). | - |
|
|
159
|
-
| **400** | Invalid request (OpenAI error envelope). | - |
|
|
164
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
160
165
|
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
161
166
|
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
162
167
|
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
@@ -164,14 +169,14 @@ example().catch(console.error);
|
|
|
164
169
|
| **422** | Request validation failed (OpenAI error envelope). | - |
|
|
165
170
|
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
166
171
|
| **500** | Internal server error (OpenAI error envelope). | - |
|
|
167
|
-
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
172
|
+
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. Code `data_retention_check_failed` means the org zero data retention setting could not be read, so the request was not sent; retry shortly. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
168
173
|
|
|
169
174
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
170
175
|
|
|
171
176
|
|
|
172
177
|
## createEmbeddings
|
|
173
178
|
|
|
174
|
-
> EmbeddingsResponse createEmbeddings(embeddingsRequest)
|
|
179
|
+
> EmbeddingsResponse createEmbeddings(embeddingsRequest, xGPUAIZeroDataRetention)
|
|
175
180
|
|
|
176
181
|
Create embeddings (OpenAI-compatible)
|
|
177
182
|
|
|
@@ -197,6 +202,8 @@ async function example() {
|
|
|
197
202
|
const body = {
|
|
198
203
|
// EmbeddingsRequest
|
|
199
204
|
embeddingsRequest: ...,
|
|
205
|
+
// 'true' | 'false' | Send `true` to require zero data retention for this request even when the org setting is off. It can only tighten routing: `false` never relaxes an org with zero data retention on. Responses routed under zero data retention echo this header with `true`. A model without a zero-data-retention host returns 400 `zero_data_retention_unavailable`; a value other than true/false returns 400 `invalid_header`. (optional)
|
|
206
|
+
xGPUAIZeroDataRetention: xGPUAIZeroDataRetention_example,
|
|
200
207
|
} satisfies CreateEmbeddingsRequest;
|
|
201
208
|
|
|
202
209
|
try {
|
|
@@ -217,6 +224,7 @@ example().catch(console.error);
|
|
|
217
224
|
| Name | Type | Description | Notes |
|
|
218
225
|
|------------- | ------------- | ------------- | -------------|
|
|
219
226
|
| **embeddingsRequest** | [EmbeddingsRequest](EmbeddingsRequest.md) | | |
|
|
227
|
+
| **xGPUAIZeroDataRetention** | `true`, `false` | Send `true` to require zero data retention for this request even when the org setting is off. It can only tighten routing: `false` never relaxes an org with zero data retention on. Responses routed under zero data retention echo this header with `true`. A model without a zero-data-retention host returns 400 `zero_data_retention_unavailable`; a value other than true/false returns 400 `invalid_header`. | [Optional] [Defaults to `undefined`] [Enum: true, false] |
|
|
220
228
|
|
|
221
229
|
### Return type
|
|
222
230
|
|
|
@@ -236,7 +244,7 @@ example().catch(console.error);
|
|
|
236
244
|
| Status code | Description | Response headers |
|
|
237
245
|
|-------------|-------------|------------------|
|
|
238
246
|
| **200** | One embedding vector per input, in request order. | - |
|
|
239
|
-
| **400** | Invalid request (OpenAI error envelope). | - |
|
|
247
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
240
248
|
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
241
249
|
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
242
250
|
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
@@ -245,7 +253,7 @@ example().catch(console.error);
|
|
|
245
253
|
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
246
254
|
| **500** | Internal server error (OpenAI error envelope). | - |
|
|
247
255
|
| **502** | The upstream answered but its response could not be used (OpenAI error envelope): code upstream_response_too_large when the vector payload exceeded the per-request size limit, or upstream_error for a malformed / misaligned response. Not retryable as-is for upstream_response_too_large — send fewer inputs. | - |
|
|
248
|
-
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
256
|
+
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. Code `data_retention_check_failed` means the org zero data retention setting could not be read, so the request was not sent; retry shortly. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
249
257
|
| **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | - |
|
|
250
258
|
|
|
251
259
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -253,7 +261,7 @@ example().catch(console.error);
|
|
|
253
261
|
|
|
254
262
|
## createImage
|
|
255
263
|
|
|
256
|
-
> ImagesResponse createImage(imagesGenerationsRequest, idempotencyKey)
|
|
264
|
+
> ImagesResponse createImage(imagesGenerationsRequest, idempotencyKey, xGPUAIZeroDataRetention)
|
|
257
265
|
|
|
258
266
|
Create image (OpenAI-compatible)
|
|
259
267
|
|
|
@@ -281,6 +289,8 @@ async function example() {
|
|
|
281
289
|
imagesGenerationsRequest: ...,
|
|
282
290
|
// string (optional)
|
|
283
291
|
idempotencyKey: idempotencyKey_example,
|
|
292
|
+
// 'true' | 'false' | Send `true` to require zero data retention for this request even when the org setting is off. It can only tighten routing: `false` never relaxes an org with zero data retention on. Responses routed under zero data retention echo this header with `true`. A model without a zero-data-retention host returns 400 `zero_data_retention_unavailable`; a value other than true/false returns 400 `invalid_header`. (optional)
|
|
293
|
+
xGPUAIZeroDataRetention: xGPUAIZeroDataRetention_example,
|
|
284
294
|
} satisfies CreateImageRequest;
|
|
285
295
|
|
|
286
296
|
try {
|
|
@@ -302,6 +312,7 @@ example().catch(console.error);
|
|
|
302
312
|
|------------- | ------------- | ------------- | -------------|
|
|
303
313
|
| **imagesGenerationsRequest** | [ImagesGenerationsRequest](ImagesGenerationsRequest.md) | | |
|
|
304
314
|
| **idempotencyKey** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
315
|
+
| **xGPUAIZeroDataRetention** | `true`, `false` | Send `true` to require zero data retention for this request even when the org setting is off. It can only tighten routing: `false` never relaxes an org with zero data retention on. Responses routed under zero data retention echo this header with `true`. A model without a zero-data-retention host returns 400 `zero_data_retention_unavailable`; a value other than true/false returns 400 `invalid_header`. | [Optional] [Defaults to `undefined`] [Enum: true, false] |
|
|
305
316
|
|
|
306
317
|
### Return type
|
|
307
318
|
|
|
@@ -321,7 +332,7 @@ example().catch(console.error);
|
|
|
321
332
|
| Status code | Description | Response headers |
|
|
322
333
|
|-------------|-------------|------------------|
|
|
323
334
|
| **200** | OpenAI-shaped image generation response (b64_json only). | - |
|
|
324
|
-
| **400** | Invalid request (OpenAI error envelope). | - |
|
|
335
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
325
336
|
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
326
337
|
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
327
338
|
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
@@ -329,7 +340,7 @@ example().catch(console.error);
|
|
|
329
340
|
| **422** | Request validation failed (OpenAI error envelope). | - |
|
|
330
341
|
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
331
342
|
| **500** | Internal server error (OpenAI error envelope). | - |
|
|
332
|
-
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
343
|
+
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. Code `data_retention_check_failed` means the org zero data retention setting could not be read, so the request was not sent; retry shortly. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
333
344
|
| **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | - |
|
|
334
345
|
|
|
335
346
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -405,7 +416,7 @@ example().catch(console.error);
|
|
|
405
416
|
| Status code | Description | Response headers |
|
|
406
417
|
|-------------|-------------|------------------|
|
|
407
418
|
| **200** | A video generation job object. | - |
|
|
408
|
-
| **400** | Invalid request (OpenAI error envelope). | - |
|
|
419
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
409
420
|
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
410
421
|
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
411
422
|
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
@@ -416,6 +427,71 @@ example().catch(console.error);
|
|
|
416
427
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
417
428
|
|
|
418
429
|
|
|
430
|
+
## getDataRetention
|
|
431
|
+
|
|
432
|
+
> DataRetention getDataRetention()
|
|
433
|
+
|
|
434
|
+
Get the org zero data retention setting
|
|
435
|
+
|
|
436
|
+
Returns whether zero data retention (ZDR) is on for the organization. When it is on, chat, embeddings and image requests route only to model hosts that keep no prompt or output content, a model without one returns 400 `zero_data_retention_unavailable`, and video generation is refused. Requires the `serverless:read` scope. The organization is taken from the authenticated API key.
|
|
437
|
+
|
|
438
|
+
### Example
|
|
439
|
+
|
|
440
|
+
```ts
|
|
441
|
+
import {
|
|
442
|
+
Configuration,
|
|
443
|
+
InferenceApi,
|
|
444
|
+
} from '@gpuai/sdk';
|
|
445
|
+
import type { GetDataRetentionRequest } from '@gpuai/sdk';
|
|
446
|
+
|
|
447
|
+
async function example() {
|
|
448
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
449
|
+
const config = new Configuration({
|
|
450
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
451
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
452
|
+
});
|
|
453
|
+
const api = new InferenceApi(config);
|
|
454
|
+
|
|
455
|
+
try {
|
|
456
|
+
const data = await api.getDataRetention();
|
|
457
|
+
console.log(data);
|
|
458
|
+
} catch (error) {
|
|
459
|
+
console.error(error);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// Run the test
|
|
464
|
+
example().catch(console.error);
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Parameters
|
|
468
|
+
|
|
469
|
+
This endpoint does not need any parameter.
|
|
470
|
+
|
|
471
|
+
### Return type
|
|
472
|
+
|
|
473
|
+
[**DataRetention**](DataRetention.md)
|
|
474
|
+
|
|
475
|
+
### Authorization
|
|
476
|
+
|
|
477
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
478
|
+
|
|
479
|
+
### HTTP request headers
|
|
480
|
+
|
|
481
|
+
- **Content-Type**: Not defined
|
|
482
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
### HTTP response details
|
|
486
|
+
| Status code | Description | Response headers |
|
|
487
|
+
|-------------|-------------|------------------|
|
|
488
|
+
| **200** | OK | - |
|
|
489
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
490
|
+
| **0** | Error response (RFC 7807) | - |
|
|
491
|
+
|
|
492
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
493
|
+
|
|
494
|
+
|
|
419
495
|
## getModel
|
|
420
496
|
|
|
421
497
|
> Model getModel(id)
|
|
@@ -703,7 +779,7 @@ example().catch(console.error);
|
|
|
703
779
|
| Status code | Description | Response headers |
|
|
704
780
|
|-------------|-------------|------------------|
|
|
705
781
|
| **200** | OpenAI-shaped model list. | - |
|
|
706
|
-
| **400** | Invalid request (OpenAI error envelope). | - |
|
|
782
|
+
| **400** | Invalid request (OpenAI error envelope). On inference routes this includes `zero_data_retention_unavailable` when zero data retention is required and the model has no zero-data-retention host. | - |
|
|
707
783
|
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
708
784
|
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
709
785
|
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
@@ -785,3 +861,78 @@ example().catch(console.error);
|
|
|
785
861
|
|
|
786
862
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
787
863
|
|
|
864
|
+
|
|
865
|
+
## updateDataRetention
|
|
866
|
+
|
|
867
|
+
> DataRetention updateDataRetention(updateDataRetentionRequest)
|
|
868
|
+
|
|
869
|
+
Turn zero data retention on or off for the org
|
|
870
|
+
|
|
871
|
+
Sets the organization\'s zero data retention (ZDR) setting. Takes effect from the next inference request. Requires the `serverless:write` scope AND org-admin privileges (a non-admin member gets 403). `zero_data_retention` is required (422 when missing).
|
|
872
|
+
|
|
873
|
+
### Example
|
|
874
|
+
|
|
875
|
+
```ts
|
|
876
|
+
import {
|
|
877
|
+
Configuration,
|
|
878
|
+
InferenceApi,
|
|
879
|
+
} from '@gpuai/sdk';
|
|
880
|
+
import type { UpdateDataRetentionOperationRequest } from '@gpuai/sdk';
|
|
881
|
+
|
|
882
|
+
async function example() {
|
|
883
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
884
|
+
const config = new Configuration({
|
|
885
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
886
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
887
|
+
});
|
|
888
|
+
const api = new InferenceApi(config);
|
|
889
|
+
|
|
890
|
+
const body = {
|
|
891
|
+
// UpdateDataRetentionRequest
|
|
892
|
+
updateDataRetentionRequest: ...,
|
|
893
|
+
} satisfies UpdateDataRetentionOperationRequest;
|
|
894
|
+
|
|
895
|
+
try {
|
|
896
|
+
const data = await api.updateDataRetention(body);
|
|
897
|
+
console.log(data);
|
|
898
|
+
} catch (error) {
|
|
899
|
+
console.error(error);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// Run the test
|
|
904
|
+
example().catch(console.error);
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
### Parameters
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
| Name | Type | Description | Notes |
|
|
911
|
+
|------------- | ------------- | ------------- | -------------|
|
|
912
|
+
| **updateDataRetentionRequest** | [UpdateDataRetentionRequest](UpdateDataRetentionRequest.md) | | |
|
|
913
|
+
|
|
914
|
+
### Return type
|
|
915
|
+
|
|
916
|
+
[**DataRetention**](DataRetention.md)
|
|
917
|
+
|
|
918
|
+
### Authorization
|
|
919
|
+
|
|
920
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
921
|
+
|
|
922
|
+
### HTTP request headers
|
|
923
|
+
|
|
924
|
+
- **Content-Type**: `application/json`
|
|
925
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
### HTTP response details
|
|
929
|
+
| Status code | Description | Response headers |
|
|
930
|
+
|-------------|-------------|------------------|
|
|
931
|
+
| **200** | OK | - |
|
|
932
|
+
| **403** | Error response (RFC 7807) | - |
|
|
933
|
+
| **422** | Error response (RFC 7807) | - |
|
|
934
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
935
|
+
| **0** | Error response (RFC 7807) | - |
|
|
936
|
+
|
|
937
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
938
|
+
|
package/docs/Model.md
CHANGED
|
@@ -17,6 +17,7 @@ Name | Type
|
|
|
17
17
|
`supportedParameters` | Array<string>
|
|
18
18
|
`supportsTools` | boolean
|
|
19
19
|
`supportsStructuredOutputs` | boolean
|
|
20
|
+
`zeroDataRetention` | boolean
|
|
20
21
|
`parameters` | [Array<ModelParametersInner>](ModelParametersInner.md)
|
|
21
22
|
`pricing` | [ModelPricing](ModelPricing.md)
|
|
22
23
|
`aliases` | Array<string>
|
|
@@ -42,6 +43,7 @@ const example = {
|
|
|
42
43
|
"supportedParameters": null,
|
|
43
44
|
"supportsTools": null,
|
|
44
45
|
"supportsStructuredOutputs": null,
|
|
46
|
+
"zeroDataRetention": null,
|
|
45
47
|
"parameters": null,
|
|
46
48
|
"pricing": null,
|
|
47
49
|
"aliases": null,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# UpdateDataRetentionRequest
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`zeroDataRetention` | boolean
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { UpdateDataRetentionRequest } from '@gpuai/sdk'
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"zeroDataRetention": null,
|
|
19
|
+
} satisfies UpdateDataRetentionRequest
|
|
20
|
+
|
|
21
|
+
console.log(example)
|
|
22
|
+
|
|
23
|
+
// Convert the instance to a JSON string
|
|
24
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
25
|
+
console.log(exampleJSON)
|
|
26
|
+
|
|
27
|
+
// Parse the JSON string back to an object
|
|
28
|
+
const exampleParsed = JSON.parse(exampleJSON) as UpdateDataRetentionRequest
|
|
29
|
+
console.log(exampleParsed)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
33
|
+
|
|
34
|
+
|
package/package.json
CHANGED
package/src/apis/InferenceApi.ts
CHANGED
|
@@ -23,6 +23,11 @@ import {
|
|
|
23
23
|
ChatCompletionResponseFromJSON,
|
|
24
24
|
ChatCompletionResponseToJSON,
|
|
25
25
|
} from '../models/ChatCompletionResponse';
|
|
26
|
+
import {
|
|
27
|
+
type DataRetention,
|
|
28
|
+
DataRetentionFromJSON,
|
|
29
|
+
DataRetentionToJSON,
|
|
30
|
+
} from '../models/DataRetention';
|
|
26
31
|
import {
|
|
27
32
|
type EmbeddingsRequest,
|
|
28
33
|
EmbeddingsRequestFromJSON,
|
|
@@ -58,6 +63,16 @@ import {
|
|
|
58
63
|
OpenAIErrorEnvelopeFromJSON,
|
|
59
64
|
OpenAIErrorEnvelopeToJSON,
|
|
60
65
|
} from '../models/OpenAIErrorEnvelope';
|
|
66
|
+
import {
|
|
67
|
+
type Problem,
|
|
68
|
+
ProblemFromJSON,
|
|
69
|
+
ProblemToJSON,
|
|
70
|
+
} from '../models/Problem';
|
|
71
|
+
import {
|
|
72
|
+
type UpdateDataRetentionRequest,
|
|
73
|
+
UpdateDataRetentionRequestFromJSON,
|
|
74
|
+
UpdateDataRetentionRequestToJSON,
|
|
75
|
+
} from '../models/UpdateDataRetentionRequest';
|
|
61
76
|
import {
|
|
62
77
|
type VideoCreateRequest,
|
|
63
78
|
VideoCreateRequestFromJSON,
|
|
@@ -80,15 +95,18 @@ export interface CancelVideoRequest {
|
|
|
80
95
|
|
|
81
96
|
export interface CreateChatCompletionRequest {
|
|
82
97
|
chatCompletionRequest: ChatCompletionRequest;
|
|
98
|
+
xGPUAIZeroDataRetention?: CreateChatCompletionXGPUAIZeroDataRetentionEnum;
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
export interface CreateEmbeddingsRequest {
|
|
86
102
|
embeddingsRequest: EmbeddingsRequest;
|
|
103
|
+
xGPUAIZeroDataRetention?: CreateEmbeddingsXGPUAIZeroDataRetentionEnum;
|
|
87
104
|
}
|
|
88
105
|
|
|
89
106
|
export interface CreateImageRequest {
|
|
90
107
|
imagesGenerationsRequest: ImagesGenerationsRequest;
|
|
91
108
|
idempotencyKey?: string;
|
|
109
|
+
xGPUAIZeroDataRetention?: CreateImageXGPUAIZeroDataRetentionEnum;
|
|
92
110
|
}
|
|
93
111
|
|
|
94
112
|
export interface CreateVideoRequest {
|
|
@@ -117,6 +135,10 @@ export interface ListVideosRequest {
|
|
|
117
135
|
limit?: number;
|
|
118
136
|
}
|
|
119
137
|
|
|
138
|
+
export interface UpdateDataRetentionOperationRequest {
|
|
139
|
+
updateDataRetentionRequest: UpdateDataRetentionRequest;
|
|
140
|
+
}
|
|
141
|
+
|
|
120
142
|
/**
|
|
121
143
|
*
|
|
122
144
|
*/
|
|
@@ -192,6 +214,10 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
192
214
|
|
|
193
215
|
headerParameters['Content-Type'] = 'application/json';
|
|
194
216
|
|
|
217
|
+
if (requestParameters['xGPUAIZeroDataRetention'] != null) {
|
|
218
|
+
headerParameters['X-GPUAI-Zero-Data-Retention'] = String(requestParameters['xGPUAIZeroDataRetention']);
|
|
219
|
+
}
|
|
220
|
+
|
|
195
221
|
if (this.configuration && this.configuration.accessToken) {
|
|
196
222
|
const token = this.configuration.accessToken;
|
|
197
223
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -247,6 +273,10 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
247
273
|
|
|
248
274
|
headerParameters['Content-Type'] = 'application/json';
|
|
249
275
|
|
|
276
|
+
if (requestParameters['xGPUAIZeroDataRetention'] != null) {
|
|
277
|
+
headerParameters['X-GPUAI-Zero-Data-Retention'] = String(requestParameters['xGPUAIZeroDataRetention']);
|
|
278
|
+
}
|
|
279
|
+
|
|
250
280
|
if (this.configuration && this.configuration.accessToken) {
|
|
251
281
|
const token = this.configuration.accessToken;
|
|
252
282
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -308,6 +338,10 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
308
338
|
headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
|
|
309
339
|
}
|
|
310
340
|
|
|
341
|
+
if (requestParameters['xGPUAIZeroDataRetention'] != null) {
|
|
342
|
+
headerParameters['X-GPUAI-Zero-Data-Retention'] = String(requestParameters['xGPUAIZeroDataRetention']);
|
|
343
|
+
}
|
|
344
|
+
|
|
311
345
|
if (this.configuration && this.configuration.accessToken) {
|
|
312
346
|
const token = this.configuration.accessToken;
|
|
313
347
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -409,6 +443,53 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
409
443
|
return await response.value();
|
|
410
444
|
}
|
|
411
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Creates request options for getDataRetention without sending the request
|
|
448
|
+
*/
|
|
449
|
+
async getDataRetentionRequestOpts(): Promise<runtime.RequestOpts> {
|
|
450
|
+
const queryParameters: any = {};
|
|
451
|
+
|
|
452
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
453
|
+
|
|
454
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
455
|
+
const token = this.configuration.accessToken;
|
|
456
|
+
const tokenString = await token("bearerAuth", []);
|
|
457
|
+
|
|
458
|
+
if (tokenString) {
|
|
459
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
let urlPath = `/organization/data-retention`;
|
|
464
|
+
|
|
465
|
+
return {
|
|
466
|
+
path: urlPath,
|
|
467
|
+
method: 'GET',
|
|
468
|
+
headers: headerParameters,
|
|
469
|
+
query: queryParameters,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Returns whether zero data retention (ZDR) is on for the organization. When it is on, chat, embeddings and image requests route only to model hosts that keep no prompt or output content, a model without one returns 400 `zero_data_retention_unavailable`, and video generation is refused. Requires the `serverless:read` scope. The organization is taken from the authenticated API key.
|
|
475
|
+
* Get the org zero data retention setting
|
|
476
|
+
*/
|
|
477
|
+
async getDataRetentionRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DataRetention>> {
|
|
478
|
+
const requestOptions = await this.getDataRetentionRequestOpts();
|
|
479
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
480
|
+
|
|
481
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DataRetentionFromJSON(jsonValue));
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Returns whether zero data retention (ZDR) is on for the organization. When it is on, chat, embeddings and image requests route only to model hosts that keep no prompt or output content, a model without one returns 400 `zero_data_retention_unavailable`, and video generation is refused. Requires the `serverless:read` scope. The organization is taken from the authenticated API key.
|
|
486
|
+
* Get the org zero data retention setting
|
|
487
|
+
*/
|
|
488
|
+
async getDataRetention(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DataRetention> {
|
|
489
|
+
const response = await this.getDataRetentionRaw(initOverrides);
|
|
490
|
+
return await response.value();
|
|
491
|
+
}
|
|
492
|
+
|
|
412
493
|
/**
|
|
413
494
|
* Creates request options for getModel without sending the request
|
|
414
495
|
*/
|
|
@@ -672,8 +753,89 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
672
753
|
return await response.value();
|
|
673
754
|
}
|
|
674
755
|
|
|
756
|
+
/**
|
|
757
|
+
* Creates request options for updateDataRetention without sending the request
|
|
758
|
+
*/
|
|
759
|
+
async updateDataRetentionRequestOpts(requestParameters: UpdateDataRetentionOperationRequest): Promise<runtime.RequestOpts> {
|
|
760
|
+
if (requestParameters['updateDataRetentionRequest'] == null) {
|
|
761
|
+
throw new runtime.RequiredError(
|
|
762
|
+
'updateDataRetentionRequest',
|
|
763
|
+
'Required parameter "updateDataRetentionRequest" was null or undefined when calling updateDataRetention().'
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
const queryParameters: any = {};
|
|
768
|
+
|
|
769
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
770
|
+
|
|
771
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
772
|
+
|
|
773
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
774
|
+
const token = this.configuration.accessToken;
|
|
775
|
+
const tokenString = await token("bearerAuth", []);
|
|
776
|
+
|
|
777
|
+
if (tokenString) {
|
|
778
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
let urlPath = `/organization/data-retention`;
|
|
783
|
+
|
|
784
|
+
return {
|
|
785
|
+
path: urlPath,
|
|
786
|
+
method: 'PUT',
|
|
787
|
+
headers: headerParameters,
|
|
788
|
+
query: queryParameters,
|
|
789
|
+
body: UpdateDataRetentionRequestToJSON(requestParameters['updateDataRetentionRequest']),
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Sets the organization\'s zero data retention (ZDR) setting. Takes effect from the next inference request. Requires the `serverless:write` scope AND org-admin privileges (a non-admin member gets 403). `zero_data_retention` is required (422 when missing).
|
|
795
|
+
* Turn zero data retention on or off for the org
|
|
796
|
+
*/
|
|
797
|
+
async updateDataRetentionRaw(requestParameters: UpdateDataRetentionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DataRetention>> {
|
|
798
|
+
const requestOptions = await this.updateDataRetentionRequestOpts(requestParameters);
|
|
799
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
800
|
+
|
|
801
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DataRetentionFromJSON(jsonValue));
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Sets the organization\'s zero data retention (ZDR) setting. Takes effect from the next inference request. Requires the `serverless:write` scope AND org-admin privileges (a non-admin member gets 403). `zero_data_retention` is required (422 when missing).
|
|
806
|
+
* Turn zero data retention on or off for the org
|
|
807
|
+
*/
|
|
808
|
+
async updateDataRetention(requestParameters: UpdateDataRetentionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DataRetention> {
|
|
809
|
+
const response = await this.updateDataRetentionRaw(requestParameters, initOverrides);
|
|
810
|
+
return await response.value();
|
|
811
|
+
}
|
|
812
|
+
|
|
675
813
|
}
|
|
676
814
|
|
|
815
|
+
/**
|
|
816
|
+
* @export
|
|
817
|
+
*/
|
|
818
|
+
export const CreateChatCompletionXGPUAIZeroDataRetentionEnum = {
|
|
819
|
+
True: 'true',
|
|
820
|
+
False: 'false'
|
|
821
|
+
} as const;
|
|
822
|
+
export type CreateChatCompletionXGPUAIZeroDataRetentionEnum = typeof CreateChatCompletionXGPUAIZeroDataRetentionEnum[keyof typeof CreateChatCompletionXGPUAIZeroDataRetentionEnum];
|
|
823
|
+
/**
|
|
824
|
+
* @export
|
|
825
|
+
*/
|
|
826
|
+
export const CreateEmbeddingsXGPUAIZeroDataRetentionEnum = {
|
|
827
|
+
True: 'true',
|
|
828
|
+
False: 'false'
|
|
829
|
+
} as const;
|
|
830
|
+
export type CreateEmbeddingsXGPUAIZeroDataRetentionEnum = typeof CreateEmbeddingsXGPUAIZeroDataRetentionEnum[keyof typeof CreateEmbeddingsXGPUAIZeroDataRetentionEnum];
|
|
831
|
+
/**
|
|
832
|
+
* @export
|
|
833
|
+
*/
|
|
834
|
+
export const CreateImageXGPUAIZeroDataRetentionEnum = {
|
|
835
|
+
True: 'true',
|
|
836
|
+
False: 'false'
|
|
837
|
+
} as const;
|
|
838
|
+
export type CreateImageXGPUAIZeroDataRetentionEnum = typeof CreateImageXGPUAIZeroDataRetentionEnum[keyof typeof CreateImageXGPUAIZeroDataRetentionEnum];
|
|
677
839
|
/**
|
|
678
840
|
* @export
|
|
679
841
|
*/
|