@gpuai/sdk 0.4.0 → 0.4.1

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 (47) hide show
  1. package/.openapi-generator/FILES +8 -0
  2. package/README.md +7 -2
  3. package/dist/apis/InstancesApi.d.ts +18 -0
  4. package/dist/apis/InstancesApi.js +49 -0
  5. package/dist/esm/apis/InstancesApi.d.ts +18 -0
  6. package/dist/esm/apis/InstancesApi.js +49 -0
  7. package/dist/esm/models/GpuSuggestion.d.ts +82 -0
  8. package/dist/esm/models/GpuSuggestion.js +77 -0
  9. package/dist/esm/models/GpuSuggestionCheaper.d.ts +62 -0
  10. package/dist/esm/models/GpuSuggestionCheaper.js +63 -0
  11. package/dist/esm/models/GpuSuggestionGpu.d.ts +50 -0
  12. package/dist/esm/models/GpuSuggestionGpu.js +55 -0
  13. package/dist/esm/models/Instance.d.ts +7 -0
  14. package/dist/esm/models/Instance.js +3 -0
  15. package/dist/esm/models/InstanceGpuMemory.d.ts +51 -0
  16. package/dist/esm/models/InstanceGpuMemory.js +55 -0
  17. package/dist/esm/models/index.d.ts +4 -0
  18. package/dist/esm/models/index.js +4 -0
  19. package/dist/esm/runtime.js +1 -1
  20. package/dist/models/GpuSuggestion.d.ts +82 -0
  21. package/dist/models/GpuSuggestion.js +85 -0
  22. package/dist/models/GpuSuggestionCheaper.d.ts +62 -0
  23. package/dist/models/GpuSuggestionCheaper.js +70 -0
  24. package/dist/models/GpuSuggestionGpu.d.ts +50 -0
  25. package/dist/models/GpuSuggestionGpu.js +62 -0
  26. package/dist/models/Instance.d.ts +7 -0
  27. package/dist/models/Instance.js +3 -0
  28. package/dist/models/InstanceGpuMemory.d.ts +51 -0
  29. package/dist/models/InstanceGpuMemory.js +62 -0
  30. package/dist/models/index.d.ts +4 -0
  31. package/dist/models/index.js +4 -0
  32. package/dist/runtime.js +1 -1
  33. package/docs/GpuSuggestion.md +47 -0
  34. package/docs/GpuSuggestionCheaper.md +45 -0
  35. package/docs/GpuSuggestionGpu.md +41 -0
  36. package/docs/Instance.md +2 -0
  37. package/docs/InstanceGpuMemory.md +41 -0
  38. package/docs/InstancesApi.md +75 -0
  39. package/package.json +1 -1
  40. package/src/apis/InstancesApi.ts +64 -0
  41. package/src/models/GpuSuggestion.ts +150 -0
  42. package/src/models/GpuSuggestionCheaper.ts +111 -0
  43. package/src/models/GpuSuggestionGpu.ts +93 -0
  44. package/src/models/Instance.ts +15 -0
  45. package/src/models/InstanceGpuMemory.ts +94 -0
  46. package/src/models/index.ts +4 -0
  47. package/src/runtime.ts +1 -1
@@ -10,6 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import type { InstanceConnection } from './InstanceConnection';
13
+ import type { InstanceGpuMemory } from './InstanceGpuMemory';
13
14
  /**
14
15
  *
15
16
  * @export
@@ -64,6 +65,12 @@ export interface Instance {
64
65
  * @memberof Instance
65
66
  */
66
67
  pricePerHour: number;
68
+ /**
69
+ *
70
+ * @type {InstanceGpuMemory}
71
+ * @memberof Instance
72
+ */
73
+ gpuMemory?: InstanceGpuMemory;
67
74
  /**
68
75
  *
69
76
  * @type {InstanceConnection}
@@ -20,6 +20,7 @@ exports.InstanceFromJSONTyped = InstanceFromJSONTyped;
20
20
  exports.InstanceToJSON = InstanceToJSON;
21
21
  exports.InstanceToJSONTyped = InstanceToJSONTyped;
22
22
  const InstanceConnection_1 = require("./InstanceConnection");
23
+ const InstanceGpuMemory_1 = require("./InstanceGpuMemory");
23
24
  /**
24
25
  * @export
25
26
  */
@@ -78,6 +79,7 @@ function InstanceFromJSONTyped(json, ignoreDiscriminator) {
78
79
  'region': json['region'],
79
80
  'tier': json['tier'],
80
81
  'pricePerHour': json['price_per_hour'],
82
+ 'gpuMemory': json['gpu_memory'] == null ? undefined : (0, InstanceGpuMemory_1.InstanceGpuMemoryFromJSON)(json['gpu_memory']),
81
83
  'connection': json['connection'] == null ? undefined : (0, InstanceConnection_1.InstanceConnectionFromJSON)(json['connection']),
82
84
  'diskGb': json['disk_gb'] == null ? undefined : json['disk_gb'],
83
85
  'image': json['image'] == null ? undefined : json['image'],
@@ -107,6 +109,7 @@ function InstanceToJSONTyped(value, ignoreDiscriminator = false) {
107
109
  'region': value['region'],
108
110
  'tier': value['tier'],
109
111
  'price_per_hour': value['pricePerHour'],
112
+ 'gpu_memory': (0, InstanceGpuMemory_1.InstanceGpuMemoryToJSON)(value['gpuMemory']),
110
113
  'connection': (0, InstanceConnection_1.InstanceConnectionToJSON)(value['connection']),
111
114
  'disk_gb': value['diskGb'],
112
115
  'image': value['image'],
@@ -0,0 +1,51 @@
1
+ /**
2
+ * GPU.ai Public Developer API
3
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: support@gpu.ai
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
+ * The highest GPU memory use seen on an instance since launch, from the telemetry every instance reports about every two minutes. On an instance with several GPUs it is the busiest GPU. Absent on an instance until its first sample arrives.
14
+ *
15
+ * @export
16
+ * @interface InstanceGpuMemory
17
+ */
18
+ export interface InstanceGpuMemory {
19
+ /**
20
+ * Highest memory in use on the GPU, in MiB.
21
+ * @type {number}
22
+ * @memberof InstanceGpuMemory
23
+ */
24
+ peakUsedMb: number;
25
+ /**
26
+ * The GPU's total memory, in MiB.
27
+ * @type {number}
28
+ * @memberof InstanceGpuMemory
29
+ */
30
+ totalMb: number;
31
+ /**
32
+ * How many telemetry samples the peak is taken from.
33
+ * @type {number}
34
+ * @memberof InstanceGpuMemory
35
+ */
36
+ samples: number;
37
+ /**
38
+ *
39
+ * @type {Date}
40
+ * @memberof InstanceGpuMemory
41
+ */
42
+ lastSampleAt: Date;
43
+ }
44
+ /**
45
+ * Check if a given object implements the InstanceGpuMemory interface.
46
+ */
47
+ export declare function instanceOfInstanceGpuMemory(value: object): value is InstanceGpuMemory;
48
+ export declare function InstanceGpuMemoryFromJSON(json: any): InstanceGpuMemory;
49
+ export declare function InstanceGpuMemoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): InstanceGpuMemory;
50
+ export declare function InstanceGpuMemoryToJSON(json: any): InstanceGpuMemory;
51
+ export declare function InstanceGpuMemoryToJSONTyped(value?: InstanceGpuMemory | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * GPU.ai Public Developer API
6
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: support@gpu.ai
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.instanceOfInstanceGpuMemory = instanceOfInstanceGpuMemory;
17
+ exports.InstanceGpuMemoryFromJSON = InstanceGpuMemoryFromJSON;
18
+ exports.InstanceGpuMemoryFromJSONTyped = InstanceGpuMemoryFromJSONTyped;
19
+ exports.InstanceGpuMemoryToJSON = InstanceGpuMemoryToJSON;
20
+ exports.InstanceGpuMemoryToJSONTyped = InstanceGpuMemoryToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the InstanceGpuMemory interface.
23
+ */
24
+ function instanceOfInstanceGpuMemory(value) {
25
+ if ((!('peakUsedMb' in value) && !('peak_used_mb' in value)) || (value['peakUsedMb'] === undefined && value['peak_used_mb'] === undefined))
26
+ return false;
27
+ if ((!('totalMb' in value) && !('total_mb' in value)) || (value['totalMb'] === undefined && value['total_mb'] === undefined))
28
+ return false;
29
+ if (!('samples' in value) || value['samples'] === undefined)
30
+ return false;
31
+ if ((!('lastSampleAt' in value) && !('last_sample_at' in value)) || (value['lastSampleAt'] === undefined && value['last_sample_at'] === undefined))
32
+ return false;
33
+ return true;
34
+ }
35
+ function InstanceGpuMemoryFromJSON(json) {
36
+ return InstanceGpuMemoryFromJSONTyped(json, false);
37
+ }
38
+ function InstanceGpuMemoryFromJSONTyped(json, ignoreDiscriminator) {
39
+ if (json == null) {
40
+ return json;
41
+ }
42
+ return {
43
+ 'peakUsedMb': json['peak_used_mb'],
44
+ 'totalMb': json['total_mb'],
45
+ 'samples': json['samples'],
46
+ 'lastSampleAt': (new Date(json['last_sample_at'])),
47
+ };
48
+ }
49
+ function InstanceGpuMemoryToJSON(json) {
50
+ return InstanceGpuMemoryToJSONTyped(json, false);
51
+ }
52
+ function InstanceGpuMemoryToJSONTyped(value, ignoreDiscriminator = false) {
53
+ if (value == null) {
54
+ return value;
55
+ }
56
+ return {
57
+ 'peak_used_mb': value['peakUsedMb'],
58
+ 'total_mb': value['totalMb'],
59
+ 'samples': value['samples'],
60
+ 'last_sample_at': value['lastSampleAt'].toISOString(),
61
+ };
62
+ }
@@ -53,6 +53,9 @@ export * from './FunctionVersion';
53
53
  export * from './GPUType';
54
54
  export * from './GPUTypePage';
55
55
  export * from './GetHealth200Response';
56
+ export * from './GpuSuggestion';
57
+ export * from './GpuSuggestionCheaper';
58
+ export * from './GpuSuggestionGpu';
56
59
  export * from './ImagesGenerationsRequest';
57
60
  export * from './ImagesResponse';
58
61
  export * from './ImagesResponseDataInner';
@@ -60,6 +63,7 @@ export * from './ImagesResponseUsage';
60
63
  export * from './IncludeItem';
61
64
  export * from './Instance';
62
65
  export * from './InstanceConnection';
66
+ export * from './InstanceGpuMemory';
63
67
  export * from './InstancePage';
64
68
  export * from './Invoice';
65
69
  export * from './InvoiceList';
@@ -71,6 +71,9 @@ __exportStar(require("./FunctionVersion"), exports);
71
71
  __exportStar(require("./GPUType"), exports);
72
72
  __exportStar(require("./GPUTypePage"), exports);
73
73
  __exportStar(require("./GetHealth200Response"), exports);
74
+ __exportStar(require("./GpuSuggestion"), exports);
75
+ __exportStar(require("./GpuSuggestionCheaper"), exports);
76
+ __exportStar(require("./GpuSuggestionGpu"), exports);
74
77
  __exportStar(require("./ImagesGenerationsRequest"), exports);
75
78
  __exportStar(require("./ImagesResponse"), exports);
76
79
  __exportStar(require("./ImagesResponseDataInner"), exports);
@@ -78,6 +81,7 @@ __exportStar(require("./ImagesResponseUsage"), exports);
78
81
  __exportStar(require("./IncludeItem"), exports);
79
82
  __exportStar(require("./Instance"), exports);
80
83
  __exportStar(require("./InstanceConnection"), exports);
84
+ __exportStar(require("./InstanceGpuMemory"), exports);
81
85
  __exportStar(require("./InstancePage"), exports);
82
86
  __exportStar(require("./Invoice"), exports);
83
87
  __exportStar(require("./InvoiceList"), exports);
package/dist/runtime.js CHANGED
@@ -69,7 +69,7 @@ class Configuration {
69
69
  return undefined;
70
70
  }
71
71
  get headers() {
72
- return Object.assign({ 'User-Agent': 'gpuai-sdk-ts/0.4.0' }, this.configuration.headers);
72
+ return Object.assign({ 'User-Agent': 'gpuai-sdk-ts/0.4.1' }, this.configuration.headers);
73
73
  }
74
74
  get credentials() {
75
75
  return this.configuration.credentials;
@@ -0,0 +1,47 @@
1
+
2
+ # GpuSuggestion
3
+
4
+ Whether a lower-priced GPU model would have fit an instance\'s observed peak GPU memory. It names GPU models and prices only.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `status` | string
11
+ `peakUsedMb` | number
12
+ `requiredMb` | number
13
+ `samples` | number
14
+ `observedMinutes` | number
15
+ `current` | [GpuSuggestionGpu](GpuSuggestionGpu.md)
16
+ `suggestion` | [GpuSuggestionCheaper](GpuSuggestionCheaper.md)
17
+
18
+ ## Example
19
+
20
+ ```typescript
21
+ import type { GpuSuggestion } from '@gpuai/sdk'
22
+
23
+ // TODO: Update the object below with actual values
24
+ const example = {
25
+ "status": null,
26
+ "peakUsedMb": null,
27
+ "requiredMb": null,
28
+ "samples": null,
29
+ "observedMinutes": null,
30
+ "current": null,
31
+ "suggestion": null,
32
+ } satisfies GpuSuggestion
33
+
34
+ console.log(example)
35
+
36
+ // Convert the instance to a JSON string
37
+ const exampleJSON: string = JSON.stringify(example)
38
+ console.log(exampleJSON)
39
+
40
+ // Parse the JSON string back to an object
41
+ const exampleParsed = JSON.parse(exampleJSON) as GpuSuggestion
42
+ console.log(exampleParsed)
43
+ ```
44
+
45
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
46
+
47
+
@@ -0,0 +1,45 @@
1
+
2
+ # GpuSuggestionCheaper
3
+
4
+ The suggested GPU model and what it would save.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `gpuType` | string
11
+ `gpuName` | string
12
+ `vramGb` | number
13
+ `pricePerHour` | number
14
+ `savingPerHour` | number
15
+ `savingPct` | number
16
+
17
+ ## Example
18
+
19
+ ```typescript
20
+ import type { GpuSuggestionCheaper } from '@gpuai/sdk'
21
+
22
+ // TODO: Update the object below with actual values
23
+ const example = {
24
+ "gpuType": null,
25
+ "gpuName": null,
26
+ "vramGb": null,
27
+ "pricePerHour": null,
28
+ "savingPerHour": null,
29
+ "savingPct": null,
30
+ } satisfies GpuSuggestionCheaper
31
+
32
+ console.log(example)
33
+
34
+ // Convert the instance to a JSON string
35
+ const exampleJSON: string = JSON.stringify(example)
36
+ console.log(exampleJSON)
37
+
38
+ // Parse the JSON string back to an object
39
+ const exampleParsed = JSON.parse(exampleJSON) as GpuSuggestionCheaper
40
+ console.log(exampleParsed)
41
+ ```
42
+
43
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
44
+
45
+
@@ -0,0 +1,41 @@
1
+
2
+ # GpuSuggestionGpu
3
+
4
+ A GPU model at an hourly price.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `gpuType` | string
11
+ `gpuName` | string
12
+ `vramGb` | number
13
+ `pricePerHour` | number
14
+
15
+ ## Example
16
+
17
+ ```typescript
18
+ import type { GpuSuggestionGpu } from '@gpuai/sdk'
19
+
20
+ // TODO: Update the object below with actual values
21
+ const example = {
22
+ "gpuType": null,
23
+ "gpuName": null,
24
+ "vramGb": null,
25
+ "pricePerHour": null,
26
+ } satisfies GpuSuggestionGpu
27
+
28
+ console.log(example)
29
+
30
+ // Convert the instance to a JSON string
31
+ const exampleJSON: string = JSON.stringify(example)
32
+ console.log(exampleJSON)
33
+
34
+ // Parse the JSON string back to an object
35
+ const exampleParsed = JSON.parse(exampleJSON) as GpuSuggestionGpu
36
+ console.log(exampleParsed)
37
+ ```
38
+
39
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
40
+
41
+
package/docs/Instance.md CHANGED
@@ -14,6 +14,7 @@ Name | Type
14
14
  `region` | string
15
15
  `tier` | string
16
16
  `pricePerHour` | number
17
+ `gpuMemory` | [InstanceGpuMemory](InstanceGpuMemory.md)
17
18
  `connection` | [InstanceConnection](InstanceConnection.md)
18
19
  `diskGb` | number
19
20
  `image` | string
@@ -41,6 +42,7 @@ const example = {
41
42
  "region": null,
42
43
  "tier": null,
43
44
  "pricePerHour": null,
45
+ "gpuMemory": null,
44
46
  "connection": null,
45
47
  "diskGb": null,
46
48
  "image": null,
@@ -0,0 +1,41 @@
1
+
2
+ # InstanceGpuMemory
3
+
4
+ The highest GPU memory use seen on an instance since launch, from the telemetry every instance reports about every two minutes. On an instance with several GPUs it is the busiest GPU. Absent on an instance until its first sample arrives.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `peakUsedMb` | number
11
+ `totalMb` | number
12
+ `samples` | number
13
+ `lastSampleAt` | Date
14
+
15
+ ## Example
16
+
17
+ ```typescript
18
+ import type { InstanceGpuMemory } from '@gpuai/sdk'
19
+
20
+ // TODO: Update the object below with actual values
21
+ const example = {
22
+ "peakUsedMb": null,
23
+ "totalMb": null,
24
+ "samples": null,
25
+ "lastSampleAt": null,
26
+ } satisfies InstanceGpuMemory
27
+
28
+ console.log(example)
29
+
30
+ // Convert the instance to a JSON string
31
+ const exampleJSON: string = JSON.stringify(example)
32
+ console.log(exampleJSON)
33
+
34
+ // Parse the JSON string back to an object
35
+ const exampleParsed = JSON.parse(exampleJSON) as InstanceGpuMemory
36
+ console.log(exampleParsed)
37
+ ```
38
+
39
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
40
+
41
+
@@ -7,6 +7,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
7
7
  | [**createInstance**](InstancesApi.md#createinstanceoperation) | **POST** /instances | Create an instance (async — returns 202 + Operation-Id header) |
8
8
  | [**deleteInstance**](InstancesApi.md#deleteinstance) | **DELETE** /instances/{id} | Terminate an instance (idempotent) |
9
9
  | [**getInstance**](InstancesApi.md#getinstance) | **GET** /instances/{id} | Get an instance |
10
+ | [**getInstanceGpuSuggestion**](InstancesApi.md#getinstancegpusuggestion) | **GET** /instances/{id}/gpu-suggestion | Suggest a lower-priced GPU for an instance |
10
11
  | [**listInstances**](InstancesApi.md#listinstances) | **GET** /instances | List instances |
11
12
  | [**updateInstance**](InstancesApi.md#updateinstanceoperation) | **PATCH** /instances/{id} | Update an instance (rename only in v1) |
12
13
 
@@ -238,6 +239,80 @@ example().catch(console.error);
238
239
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
239
240
 
240
241
 
242
+ ## getInstanceGpuSuggestion
243
+
244
+ > GpuSuggestion getInstanceGpuSuggestion(id)
245
+
246
+ Suggest a lower-priced GPU for an instance
247
+
248
+ Compares the highest GPU memory this instance has used (its `gpu_memory` peak, plus headroom) with the GPU models currently listed, and names the cheapest model that would have fit when the saving is worth a look. It never changes anything: it reports what the telemetry shows. Memory use can grow later, so treat it as a starting point. `status` is `insufficient_data` until the instance has about an hour of telemetry, `no_cheaper_fit` when no cheaper listed model covers the peak, and `suggestion` when one does. Requires the `instances:read` scope. An instance owned by another organization returns 404.
249
+
250
+ ### Example
251
+
252
+ ```ts
253
+ import {
254
+ Configuration,
255
+ InstancesApi,
256
+ } from '@gpuai/sdk';
257
+ import type { GetInstanceGpuSuggestionRequest } from '@gpuai/sdk';
258
+
259
+ async function example() {
260
+ console.log("🚀 Testing @gpuai/sdk SDK...");
261
+ const config = new Configuration({
262
+ // Configure HTTP bearer authorization: bearerAuth
263
+ accessToken: "YOUR BEARER TOKEN",
264
+ });
265
+ const api = new InstancesApi(config);
266
+
267
+ const body = {
268
+ // string
269
+ id: id_example,
270
+ } satisfies GetInstanceGpuSuggestionRequest;
271
+
272
+ try {
273
+ const data = await api.getInstanceGpuSuggestion(body);
274
+ console.log(data);
275
+ } catch (error) {
276
+ console.error(error);
277
+ }
278
+ }
279
+
280
+ // Run the test
281
+ example().catch(console.error);
282
+ ```
283
+
284
+ ### Parameters
285
+
286
+
287
+ | Name | Type | Description | Notes |
288
+ |------------- | ------------- | ------------- | -------------|
289
+ | **id** | `string` | | [Defaults to `undefined`] |
290
+
291
+ ### Return type
292
+
293
+ [**GpuSuggestion**](GpuSuggestion.md)
294
+
295
+ ### Authorization
296
+
297
+ [bearerAuth](../README.md#bearerAuth)
298
+
299
+ ### HTTP request headers
300
+
301
+ - **Content-Type**: Not defined
302
+ - **Accept**: `application/json`, `application/problem+json`
303
+
304
+
305
+ ### HTTP response details
306
+ | Status code | Description | Response headers |
307
+ |-------------|-------------|------------------|
308
+ | **200** | OK | - |
309
+ | **404** | The instance does not exist or is not owned by the caller\'s organization. | - |
310
+ | **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
311
+ | **0** | Error response (RFC 7807) | - |
312
+
313
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
314
+
315
+
241
316
  ## listInstances
242
317
 
243
318
  > InstancePage listInstances(cursor, limit, status)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpuai/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript SDK for the GPU.ai Public Developer API",
5
5
  "author": "GPU.ai Support <support@gpu.ai>",
6
6
  "repository": {
@@ -18,6 +18,11 @@ import {
18
18
  CreateInstanceRequestFromJSON,
19
19
  CreateInstanceRequestToJSON,
20
20
  } from '../models/CreateInstanceRequest';
21
+ import {
22
+ type GpuSuggestion,
23
+ GpuSuggestionFromJSON,
24
+ GpuSuggestionToJSON,
25
+ } from '../models/GpuSuggestion';
21
26
  import {
22
27
  type Instance,
23
28
  InstanceFromJSON,
@@ -59,6 +64,10 @@ export interface GetInstanceRequest {
59
64
  include?: GetInstanceIncludeEnum;
60
65
  }
61
66
 
67
+ export interface GetInstanceGpuSuggestionRequest {
68
+ id: string;
69
+ }
70
+
62
71
  export interface ListInstancesRequest {
63
72
  cursor?: string;
64
73
  limit?: number;
@@ -251,6 +260,61 @@ export class InstancesApi extends runtime.BaseAPI {
251
260
  return await response.value();
252
261
  }
253
262
 
263
+ /**
264
+ * Creates request options for getInstanceGpuSuggestion without sending the request
265
+ */
266
+ async getInstanceGpuSuggestionRequestOpts(requestParameters: GetInstanceGpuSuggestionRequest): Promise<runtime.RequestOpts> {
267
+ if (requestParameters['id'] == null) {
268
+ throw new runtime.RequiredError(
269
+ 'id',
270
+ 'Required parameter "id" was null or undefined when calling getInstanceGpuSuggestion().'
271
+ );
272
+ }
273
+
274
+ const queryParameters: any = {};
275
+
276
+ const headerParameters: runtime.HTTPHeaders = {};
277
+
278
+ if (this.configuration && this.configuration.accessToken) {
279
+ const token = this.configuration.accessToken;
280
+ const tokenString = await token("bearerAuth", []);
281
+
282
+ if (tokenString) {
283
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
284
+ }
285
+ }
286
+
287
+ let urlPath = `/instances/{id}/gpu-suggestion`;
288
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
289
+
290
+ return {
291
+ path: urlPath,
292
+ method: 'GET',
293
+ headers: headerParameters,
294
+ query: queryParameters,
295
+ };
296
+ }
297
+
298
+ /**
299
+ * Compares the highest GPU memory this instance has used (its `gpu_memory` peak, plus headroom) with the GPU models currently listed, and names the cheapest model that would have fit when the saving is worth a look. It never changes anything: it reports what the telemetry shows. Memory use can grow later, so treat it as a starting point. `status` is `insufficient_data` until the instance has about an hour of telemetry, `no_cheaper_fit` when no cheaper listed model covers the peak, and `suggestion` when one does. Requires the `instances:read` scope. An instance owned by another organization returns 404.
300
+ * Suggest a lower-priced GPU for an instance
301
+ */
302
+ async getInstanceGpuSuggestionRaw(requestParameters: GetInstanceGpuSuggestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GpuSuggestion>> {
303
+ const requestOptions = await this.getInstanceGpuSuggestionRequestOpts(requestParameters);
304
+ const response = await this.request(requestOptions, initOverrides);
305
+
306
+ return new runtime.JSONApiResponse(response, (jsonValue) => GpuSuggestionFromJSON(jsonValue));
307
+ }
308
+
309
+ /**
310
+ * Compares the highest GPU memory this instance has used (its `gpu_memory` peak, plus headroom) with the GPU models currently listed, and names the cheapest model that would have fit when the saving is worth a look. It never changes anything: it reports what the telemetry shows. Memory use can grow later, so treat it as a starting point. `status` is `insufficient_data` until the instance has about an hour of telemetry, `no_cheaper_fit` when no cheaper listed model covers the peak, and `suggestion` when one does. Requires the `instances:read` scope. An instance owned by another organization returns 404.
311
+ * Suggest a lower-priced GPU for an instance
312
+ */
313
+ async getInstanceGpuSuggestion(requestParameters: GetInstanceGpuSuggestionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GpuSuggestion> {
314
+ const response = await this.getInstanceGpuSuggestionRaw(requestParameters, initOverrides);
315
+ return await response.value();
316
+ }
317
+
254
318
  /**
255
319
  * Creates request options for listInstances without sending the request
256
320
  */