@gpuai/sdk 0.4.0 → 0.4.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 +8 -0
- package/README.md +7 -2
- package/dist/apis/InstancesApi.d.ts +18 -0
- package/dist/apis/InstancesApi.js +49 -0
- package/dist/esm/apis/InstancesApi.d.ts +18 -0
- package/dist/esm/apis/InstancesApi.js +49 -0
- package/dist/esm/models/GpuSuggestion.d.ts +82 -0
- package/dist/esm/models/GpuSuggestion.js +77 -0
- package/dist/esm/models/GpuSuggestionCheaper.d.ts +62 -0
- package/dist/esm/models/GpuSuggestionCheaper.js +63 -0
- package/dist/esm/models/GpuSuggestionGpu.d.ts +50 -0
- package/dist/esm/models/GpuSuggestionGpu.js +55 -0
- package/dist/esm/models/Instance.d.ts +22 -0
- package/dist/esm/models/Instance.js +13 -0
- package/dist/esm/models/InstanceGpuMemory.d.ts +51 -0
- package/dist/esm/models/InstanceGpuMemory.js +55 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/GpuSuggestion.d.ts +82 -0
- package/dist/models/GpuSuggestion.js +85 -0
- package/dist/models/GpuSuggestionCheaper.d.ts +62 -0
- package/dist/models/GpuSuggestionCheaper.js +70 -0
- package/dist/models/GpuSuggestionGpu.d.ts +50 -0
- package/dist/models/GpuSuggestionGpu.js +62 -0
- package/dist/models/Instance.d.ts +22 -0
- package/dist/models/Instance.js +14 -1
- package/dist/models/InstanceGpuMemory.d.ts +51 -0
- package/dist/models/InstanceGpuMemory.js +62 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/dist/runtime.js +1 -1
- package/docs/GpuSuggestion.md +47 -0
- package/docs/GpuSuggestionCheaper.md +45 -0
- package/docs/GpuSuggestionGpu.md +41 -0
- package/docs/Instance.md +4 -0
- package/docs/InstanceGpuMemory.md +41 -0
- package/docs/InstancesApi.md +75 -0
- package/package.json +1 -1
- package/src/apis/InstancesApi.ts +64 -0
- package/src/models/GpuSuggestion.ts +150 -0
- package/src/models/GpuSuggestionCheaper.ts +111 -0
- package/src/models/GpuSuggestionGpu.ts +93 -0
- package/src/models/Instance.ts +33 -0
- package/src/models/InstanceGpuMemory.ts +94 -0
- package/src/models/index.ts +4 -0
- package/src/runtime.ts +1 -1
package/src/apis/InstancesApi.ts
CHANGED
|
@@ -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
|
*/
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* GPU.ai Public Developer API
|
|
5
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@gpu.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
import type { GpuSuggestionCheaper } from './GpuSuggestionCheaper';
|
|
17
|
+
import {
|
|
18
|
+
GpuSuggestionCheaperFromJSON,
|
|
19
|
+
GpuSuggestionCheaperFromJSONTyped,
|
|
20
|
+
GpuSuggestionCheaperToJSON,
|
|
21
|
+
GpuSuggestionCheaperToJSONTyped,
|
|
22
|
+
} from './GpuSuggestionCheaper';
|
|
23
|
+
import type { GpuSuggestionGpu } from './GpuSuggestionGpu';
|
|
24
|
+
import {
|
|
25
|
+
GpuSuggestionGpuFromJSON,
|
|
26
|
+
GpuSuggestionGpuFromJSONTyped,
|
|
27
|
+
GpuSuggestionGpuToJSON,
|
|
28
|
+
GpuSuggestionGpuToJSONTyped,
|
|
29
|
+
} from './GpuSuggestionGpu';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether a lower-priced GPU model would have fit an instance's observed peak GPU memory. It names GPU models and prices only.
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @interface GpuSuggestion
|
|
36
|
+
*/
|
|
37
|
+
export interface GpuSuggestion {
|
|
38
|
+
/**
|
|
39
|
+
* `suggestion` when a cheaper model fits and the saving is at least 10% and $0.05 per hour. `insufficient_data` until the instance has at least 30 samples over at least an hour. `no_cheaper_fit` otherwise.
|
|
40
|
+
*
|
|
41
|
+
* @type {GpuSuggestionStatusEnum}
|
|
42
|
+
* @memberof GpuSuggestion
|
|
43
|
+
*/
|
|
44
|
+
status: GpuSuggestionStatusEnum;
|
|
45
|
+
/**
|
|
46
|
+
* Highest GPU memory seen, in MiB. Null with no telemetry.
|
|
47
|
+
* @type {number}
|
|
48
|
+
* @memberof GpuSuggestion
|
|
49
|
+
*/
|
|
50
|
+
peakUsedMb: number | null;
|
|
51
|
+
/**
|
|
52
|
+
* The peak plus headroom (25% and 1024 MiB), in MiB: the memory a suggested model must have. Null until there is enough telemetry.
|
|
53
|
+
*
|
|
54
|
+
* @type {number}
|
|
55
|
+
* @memberof GpuSuggestion
|
|
56
|
+
*/
|
|
57
|
+
requiredMb: number | null;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @type {number}
|
|
61
|
+
* @memberof GpuSuggestion
|
|
62
|
+
*/
|
|
63
|
+
samples: number;
|
|
64
|
+
/**
|
|
65
|
+
* Minutes between the first and the latest telemetry sample.
|
|
66
|
+
* @type {number}
|
|
67
|
+
* @memberof GpuSuggestion
|
|
68
|
+
*/
|
|
69
|
+
observedMinutes: number;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @type {GpuSuggestionGpu}
|
|
73
|
+
* @memberof GpuSuggestion
|
|
74
|
+
*/
|
|
75
|
+
current: GpuSuggestionGpu;
|
|
76
|
+
/**
|
|
77
|
+
* Set only when status is `suggestion`.
|
|
78
|
+
* @type {GpuSuggestionCheaper}
|
|
79
|
+
* @memberof GpuSuggestion
|
|
80
|
+
*/
|
|
81
|
+
suggestion: GpuSuggestionCheaper | null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @export
|
|
87
|
+
*/
|
|
88
|
+
export const GpuSuggestionStatusEnum = {
|
|
89
|
+
Suggestion: 'suggestion',
|
|
90
|
+
InsufficientData: 'insufficient_data',
|
|
91
|
+
NoCheaperFit: 'no_cheaper_fit'
|
|
92
|
+
} as const;
|
|
93
|
+
export type GpuSuggestionStatusEnum = typeof GpuSuggestionStatusEnum[keyof typeof GpuSuggestionStatusEnum];
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Check if a given object implements the GpuSuggestion interface.
|
|
98
|
+
*/
|
|
99
|
+
export function instanceOfGpuSuggestion(value: object): value is GpuSuggestion {
|
|
100
|
+
if (!('status' in value) || value['status'] === undefined) return false;
|
|
101
|
+
if ((!('peakUsedMb' in (value as Record<string, any>)) && !('peak_used_mb' in (value as Record<string, any>))) || ((value as Record<string, any>)['peakUsedMb'] === undefined && (value as Record<string, any>)['peak_used_mb'] === undefined)) return false;
|
|
102
|
+
if ((!('requiredMb' in (value as Record<string, any>)) && !('required_mb' in (value as Record<string, any>))) || ((value as Record<string, any>)['requiredMb'] === undefined && (value as Record<string, any>)['required_mb'] === undefined)) return false;
|
|
103
|
+
if (!('samples' in value) || value['samples'] === undefined) return false;
|
|
104
|
+
if ((!('observedMinutes' in (value as Record<string, any>)) && !('observed_minutes' in (value as Record<string, any>))) || ((value as Record<string, any>)['observedMinutes'] === undefined && (value as Record<string, any>)['observed_minutes'] === undefined)) return false;
|
|
105
|
+
if (!('current' in value) || value['current'] === undefined) return false;
|
|
106
|
+
if (!('suggestion' in value) || value['suggestion'] === undefined) return false;
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function GpuSuggestionFromJSON(json: any): GpuSuggestion {
|
|
111
|
+
return GpuSuggestionFromJSONTyped(json, false);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function GpuSuggestionFromJSONTyped(json: any, ignoreDiscriminator: boolean): GpuSuggestion {
|
|
115
|
+
if (json == null) {
|
|
116
|
+
return json;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
|
|
120
|
+
'status': json['status'],
|
|
121
|
+
'peakUsedMb': json['peak_used_mb'],
|
|
122
|
+
'requiredMb': json['required_mb'],
|
|
123
|
+
'samples': json['samples'],
|
|
124
|
+
'observedMinutes': json['observed_minutes'],
|
|
125
|
+
'current': GpuSuggestionGpuFromJSON(json['current']),
|
|
126
|
+
'suggestion': GpuSuggestionCheaperFromJSON(json['suggestion']),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function GpuSuggestionToJSON(json: any): GpuSuggestion {
|
|
131
|
+
return GpuSuggestionToJSONTyped(json, false);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function GpuSuggestionToJSONTyped(value?: GpuSuggestion | null, ignoreDiscriminator: boolean = false): any {
|
|
135
|
+
if (value == null) {
|
|
136
|
+
return value;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
|
|
141
|
+
'status': value['status'],
|
|
142
|
+
'peak_used_mb': value['peakUsedMb'],
|
|
143
|
+
'required_mb': value['requiredMb'],
|
|
144
|
+
'samples': value['samples'],
|
|
145
|
+
'observed_minutes': value['observedMinutes'],
|
|
146
|
+
'current': GpuSuggestionGpuToJSON(value['current']),
|
|
147
|
+
'suggestion': GpuSuggestionCheaperToJSON(value['suggestion']),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* GPU.ai Public Developer API
|
|
5
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@gpu.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* The suggested GPU model and what it would save.
|
|
18
|
+
* @export
|
|
19
|
+
* @interface GpuSuggestionCheaper
|
|
20
|
+
*/
|
|
21
|
+
export interface GpuSuggestionCheaper {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof GpuSuggestionCheaper
|
|
26
|
+
*/
|
|
27
|
+
gpuType: string;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof GpuSuggestionCheaper
|
|
32
|
+
*/
|
|
33
|
+
gpuName: string;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {number}
|
|
37
|
+
* @memberof GpuSuggestionCheaper
|
|
38
|
+
*/
|
|
39
|
+
vramGb: number;
|
|
40
|
+
/**
|
|
41
|
+
* The cheapest current listing for this model, per hour.
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @memberof GpuSuggestionCheaper
|
|
44
|
+
*/
|
|
45
|
+
pricePerHour: number;
|
|
46
|
+
/**
|
|
47
|
+
* The instance's hourly price minus this model's.
|
|
48
|
+
* @type {number}
|
|
49
|
+
* @memberof GpuSuggestionCheaper
|
|
50
|
+
*/
|
|
51
|
+
savingPerHour: number;
|
|
52
|
+
/**
|
|
53
|
+
* The saving as a percentage of the instance's hourly price.
|
|
54
|
+
* @type {number}
|
|
55
|
+
* @memberof GpuSuggestionCheaper
|
|
56
|
+
*/
|
|
57
|
+
savingPct: number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Check if a given object implements the GpuSuggestionCheaper interface.
|
|
62
|
+
*/
|
|
63
|
+
export function instanceOfGpuSuggestionCheaper(value: object): value is GpuSuggestionCheaper {
|
|
64
|
+
if ((!('gpuType' in (value as Record<string, any>)) && !('gpu_type' in (value as Record<string, any>))) || ((value as Record<string, any>)['gpuType'] === undefined && (value as Record<string, any>)['gpu_type'] === undefined)) return false;
|
|
65
|
+
if ((!('gpuName' in (value as Record<string, any>)) && !('gpu_name' in (value as Record<string, any>))) || ((value as Record<string, any>)['gpuName'] === undefined && (value as Record<string, any>)['gpu_name'] === undefined)) return false;
|
|
66
|
+
if ((!('vramGb' in (value as Record<string, any>)) && !('vram_gb' in (value as Record<string, any>))) || ((value as Record<string, any>)['vramGb'] === undefined && (value as Record<string, any>)['vram_gb'] === undefined)) return false;
|
|
67
|
+
if ((!('pricePerHour' in (value as Record<string, any>)) && !('price_per_hour' in (value as Record<string, any>))) || ((value as Record<string, any>)['pricePerHour'] === undefined && (value as Record<string, any>)['price_per_hour'] === undefined)) return false;
|
|
68
|
+
if ((!('savingPerHour' in (value as Record<string, any>)) && !('saving_per_hour' in (value as Record<string, any>))) || ((value as Record<string, any>)['savingPerHour'] === undefined && (value as Record<string, any>)['saving_per_hour'] === undefined)) return false;
|
|
69
|
+
if ((!('savingPct' in (value as Record<string, any>)) && !('saving_pct' in (value as Record<string, any>))) || ((value as Record<string, any>)['savingPct'] === undefined && (value as Record<string, any>)['saving_pct'] === undefined)) return false;
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function GpuSuggestionCheaperFromJSON(json: any): GpuSuggestionCheaper {
|
|
74
|
+
return GpuSuggestionCheaperFromJSONTyped(json, false);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function GpuSuggestionCheaperFromJSONTyped(json: any, ignoreDiscriminator: boolean): GpuSuggestionCheaper {
|
|
78
|
+
if (json == null) {
|
|
79
|
+
return json;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
|
|
83
|
+
'gpuType': json['gpu_type'],
|
|
84
|
+
'gpuName': json['gpu_name'],
|
|
85
|
+
'vramGb': json['vram_gb'],
|
|
86
|
+
'pricePerHour': json['price_per_hour'],
|
|
87
|
+
'savingPerHour': json['saving_per_hour'],
|
|
88
|
+
'savingPct': json['saving_pct'],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function GpuSuggestionCheaperToJSON(json: any): GpuSuggestionCheaper {
|
|
93
|
+
return GpuSuggestionCheaperToJSONTyped(json, false);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function GpuSuggestionCheaperToJSONTyped(value?: GpuSuggestionCheaper | null, ignoreDiscriminator: boolean = false): any {
|
|
97
|
+
if (value == null) {
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
|
|
103
|
+
'gpu_type': value['gpuType'],
|
|
104
|
+
'gpu_name': value['gpuName'],
|
|
105
|
+
'vram_gb': value['vramGb'],
|
|
106
|
+
'price_per_hour': value['pricePerHour'],
|
|
107
|
+
'saving_per_hour': value['savingPerHour'],
|
|
108
|
+
'saving_pct': value['savingPct'],
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* GPU.ai Public Developer API
|
|
5
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@gpu.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* A GPU model at an hourly price.
|
|
18
|
+
* @export
|
|
19
|
+
* @interface GpuSuggestionGpu
|
|
20
|
+
*/
|
|
21
|
+
export interface GpuSuggestionGpu {
|
|
22
|
+
/**
|
|
23
|
+
* The GPU model id, as in GET /v1/gpu-types.
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof GpuSuggestionGpu
|
|
26
|
+
*/
|
|
27
|
+
gpuType: string;
|
|
28
|
+
/**
|
|
29
|
+
* The GPU model's display name.
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof GpuSuggestionGpu
|
|
32
|
+
*/
|
|
33
|
+
gpuName: string;
|
|
34
|
+
/**
|
|
35
|
+
* Memory per GPU, in GB.
|
|
36
|
+
* @type {number}
|
|
37
|
+
* @memberof GpuSuggestionGpu
|
|
38
|
+
*/
|
|
39
|
+
vramGb: number;
|
|
40
|
+
/**
|
|
41
|
+
* Hourly price for the same number of GPUs as the instance.
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @memberof GpuSuggestionGpu
|
|
44
|
+
*/
|
|
45
|
+
pricePerHour: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Check if a given object implements the GpuSuggestionGpu interface.
|
|
50
|
+
*/
|
|
51
|
+
export function instanceOfGpuSuggestionGpu(value: object): value is GpuSuggestionGpu {
|
|
52
|
+
if ((!('gpuType' in (value as Record<string, any>)) && !('gpu_type' in (value as Record<string, any>))) || ((value as Record<string, any>)['gpuType'] === undefined && (value as Record<string, any>)['gpu_type'] === undefined)) return false;
|
|
53
|
+
if ((!('gpuName' in (value as Record<string, any>)) && !('gpu_name' in (value as Record<string, any>))) || ((value as Record<string, any>)['gpuName'] === undefined && (value as Record<string, any>)['gpu_name'] === undefined)) return false;
|
|
54
|
+
if ((!('vramGb' in (value as Record<string, any>)) && !('vram_gb' in (value as Record<string, any>))) || ((value as Record<string, any>)['vramGb'] === undefined && (value as Record<string, any>)['vram_gb'] === undefined)) return false;
|
|
55
|
+
if ((!('pricePerHour' in (value as Record<string, any>)) && !('price_per_hour' in (value as Record<string, any>))) || ((value as Record<string, any>)['pricePerHour'] === undefined && (value as Record<string, any>)['price_per_hour'] === undefined)) return false;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function GpuSuggestionGpuFromJSON(json: any): GpuSuggestionGpu {
|
|
60
|
+
return GpuSuggestionGpuFromJSONTyped(json, false);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function GpuSuggestionGpuFromJSONTyped(json: any, ignoreDiscriminator: boolean): GpuSuggestionGpu {
|
|
64
|
+
if (json == null) {
|
|
65
|
+
return json;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
|
|
69
|
+
'gpuType': json['gpu_type'],
|
|
70
|
+
'gpuName': json['gpu_name'],
|
|
71
|
+
'vramGb': json['vram_gb'],
|
|
72
|
+
'pricePerHour': json['price_per_hour'],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function GpuSuggestionGpuToJSON(json: any): GpuSuggestionGpu {
|
|
77
|
+
return GpuSuggestionGpuToJSONTyped(json, false);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function GpuSuggestionGpuToJSONTyped(value?: GpuSuggestionGpu | null, ignoreDiscriminator: boolean = false): any {
|
|
81
|
+
if (value == null) {
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
|
|
87
|
+
'gpu_type': value['gpuType'],
|
|
88
|
+
'gpu_name': value['gpuName'],
|
|
89
|
+
'vram_gb': value['vramGb'],
|
|
90
|
+
'price_per_hour': value['pricePerHour'],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
package/src/models/Instance.ts
CHANGED
|
@@ -20,6 +20,13 @@ import {
|
|
|
20
20
|
InstanceConnectionToJSON,
|
|
21
21
|
InstanceConnectionToJSONTyped,
|
|
22
22
|
} from './InstanceConnection';
|
|
23
|
+
import type { InstanceGpuMemory } from './InstanceGpuMemory';
|
|
24
|
+
import {
|
|
25
|
+
InstanceGpuMemoryFromJSON,
|
|
26
|
+
InstanceGpuMemoryFromJSONTyped,
|
|
27
|
+
InstanceGpuMemoryToJSON,
|
|
28
|
+
InstanceGpuMemoryToJSONTyped,
|
|
29
|
+
} from './InstanceGpuMemory';
|
|
23
30
|
|
|
24
31
|
/**
|
|
25
32
|
*
|
|
@@ -75,6 +82,12 @@ export interface Instance {
|
|
|
75
82
|
* @memberof Instance
|
|
76
83
|
*/
|
|
77
84
|
pricePerHour: number;
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
* @type {InstanceGpuMemory}
|
|
88
|
+
* @memberof Instance
|
|
89
|
+
*/
|
|
90
|
+
gpuMemory?: InstanceGpuMemory;
|
|
78
91
|
/**
|
|
79
92
|
*
|
|
80
93
|
* @type {InstanceConnection}
|
|
@@ -141,6 +154,12 @@ export interface Instance {
|
|
|
141
154
|
* @memberof Instance
|
|
142
155
|
*/
|
|
143
156
|
unreachableSince?: Date;
|
|
157
|
+
/**
|
|
158
|
+
* How far a launch that is not ready yet has got. machine_requested means the machine was requested and no image download has been reported yet; pulling_image means the image is downloading or unpacking; setting_up means the container is up and the platform is finishing SSH and the GPU check. Present only while status is allocating or starting and the platform is following the boot; absent otherwise. Lets a client with a fixed timeout tell a launch that is still moving from one that is stuck.
|
|
159
|
+
* @type {InstanceBootPhaseEnum}
|
|
160
|
+
* @memberof Instance
|
|
161
|
+
*/
|
|
162
|
+
bootPhase?: InstanceBootPhaseEnum;
|
|
144
163
|
}
|
|
145
164
|
|
|
146
165
|
|
|
@@ -168,6 +187,16 @@ export const InstanceTierEnum = {
|
|
|
168
187
|
} as const;
|
|
169
188
|
export type InstanceTierEnum = typeof InstanceTierEnum[keyof typeof InstanceTierEnum];
|
|
170
189
|
|
|
190
|
+
/**
|
|
191
|
+
* @export
|
|
192
|
+
*/
|
|
193
|
+
export const InstanceBootPhaseEnum = {
|
|
194
|
+
MachineRequested: 'machine_requested',
|
|
195
|
+
PullingImage: 'pulling_image',
|
|
196
|
+
SettingUp: 'setting_up'
|
|
197
|
+
} as const;
|
|
198
|
+
export type InstanceBootPhaseEnum = typeof InstanceBootPhaseEnum[keyof typeof InstanceBootPhaseEnum];
|
|
199
|
+
|
|
171
200
|
|
|
172
201
|
/**
|
|
173
202
|
* Check if a given object implements the Instance interface.
|
|
@@ -202,6 +231,7 @@ export function InstanceFromJSONTyped(json: any, ignoreDiscriminator: boolean):
|
|
|
202
231
|
'region': json['region'],
|
|
203
232
|
'tier': json['tier'],
|
|
204
233
|
'pricePerHour': json['price_per_hour'],
|
|
234
|
+
'gpuMemory': json['gpu_memory'] == null ? undefined : InstanceGpuMemoryFromJSON(json['gpu_memory']),
|
|
205
235
|
'connection': json['connection'] == null ? undefined : InstanceConnectionFromJSON(json['connection']),
|
|
206
236
|
'diskGb': json['disk_gb'] == null ? undefined : json['disk_gb'],
|
|
207
237
|
'image': json['image'] == null ? undefined : json['image'],
|
|
@@ -213,6 +243,7 @@ export function InstanceFromJSONTyped(json: any, ignoreDiscriminator: boolean):
|
|
|
213
243
|
'terminatedAt': json['terminated_at'] == null ? undefined : (new Date(json['terminated_at'])),
|
|
214
244
|
'lastReachableAt': json['last_reachable_at'] == null ? undefined : (new Date(json['last_reachable_at'])),
|
|
215
245
|
'unreachableSince': json['unreachable_since'] == null ? undefined : (new Date(json['unreachable_since'])),
|
|
246
|
+
'bootPhase': json['boot_phase'] == null ? undefined : json['boot_phase'],
|
|
216
247
|
};
|
|
217
248
|
}
|
|
218
249
|
|
|
@@ -235,6 +266,7 @@ export function InstanceToJSONTyped(value?: Instance | null, ignoreDiscriminator
|
|
|
235
266
|
'region': value['region'],
|
|
236
267
|
'tier': value['tier'],
|
|
237
268
|
'price_per_hour': value['pricePerHour'],
|
|
269
|
+
'gpu_memory': InstanceGpuMemoryToJSON(value['gpuMemory']),
|
|
238
270
|
'connection': InstanceConnectionToJSON(value['connection']),
|
|
239
271
|
'disk_gb': value['diskGb'],
|
|
240
272
|
'image': value['image'],
|
|
@@ -246,6 +278,7 @@ export function InstanceToJSONTyped(value?: Instance | null, ignoreDiscriminator
|
|
|
246
278
|
'terminated_at': value['terminatedAt'] == null ? value['terminatedAt'] : value['terminatedAt'].toISOString(),
|
|
247
279
|
'last_reachable_at': value['lastReachableAt'] == null ? value['lastReachableAt'] : value['lastReachableAt'].toISOString(),
|
|
248
280
|
'unreachable_since': value['unreachableSince'] == null ? value['unreachableSince'] : value['unreachableSince'].toISOString(),
|
|
281
|
+
'boot_phase': value['bootPhase'],
|
|
249
282
|
};
|
|
250
283
|
}
|
|
251
284
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* GPU.ai Public Developer API
|
|
5
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@gpu.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* 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.
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface InstanceGpuMemory
|
|
21
|
+
*/
|
|
22
|
+
export interface InstanceGpuMemory {
|
|
23
|
+
/**
|
|
24
|
+
* Highest memory in use on the GPU, in MiB.
|
|
25
|
+
* @type {number}
|
|
26
|
+
* @memberof InstanceGpuMemory
|
|
27
|
+
*/
|
|
28
|
+
peakUsedMb: number;
|
|
29
|
+
/**
|
|
30
|
+
* The GPU's total memory, in MiB.
|
|
31
|
+
* @type {number}
|
|
32
|
+
* @memberof InstanceGpuMemory
|
|
33
|
+
*/
|
|
34
|
+
totalMb: number;
|
|
35
|
+
/**
|
|
36
|
+
* How many telemetry samples the peak is taken from.
|
|
37
|
+
* @type {number}
|
|
38
|
+
* @memberof InstanceGpuMemory
|
|
39
|
+
*/
|
|
40
|
+
samples: number;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @type {Date}
|
|
44
|
+
* @memberof InstanceGpuMemory
|
|
45
|
+
*/
|
|
46
|
+
lastSampleAt: Date;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Check if a given object implements the InstanceGpuMemory interface.
|
|
51
|
+
*/
|
|
52
|
+
export function instanceOfInstanceGpuMemory(value: object): value is InstanceGpuMemory {
|
|
53
|
+
if ((!('peakUsedMb' in (value as Record<string, any>)) && !('peak_used_mb' in (value as Record<string, any>))) || ((value as Record<string, any>)['peakUsedMb'] === undefined && (value as Record<string, any>)['peak_used_mb'] === undefined)) return false;
|
|
54
|
+
if ((!('totalMb' in (value as Record<string, any>)) && !('total_mb' in (value as Record<string, any>))) || ((value as Record<string, any>)['totalMb'] === undefined && (value as Record<string, any>)['total_mb'] === undefined)) return false;
|
|
55
|
+
if (!('samples' in value) || value['samples'] === undefined) return false;
|
|
56
|
+
if ((!('lastSampleAt' in (value as Record<string, any>)) && !('last_sample_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['lastSampleAt'] === undefined && (value as Record<string, any>)['last_sample_at'] === undefined)) return false;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function InstanceGpuMemoryFromJSON(json: any): InstanceGpuMemory {
|
|
61
|
+
return InstanceGpuMemoryFromJSONTyped(json, false);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function InstanceGpuMemoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): InstanceGpuMemory {
|
|
65
|
+
if (json == null) {
|
|
66
|
+
return json;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
|
|
70
|
+
'peakUsedMb': json['peak_used_mb'],
|
|
71
|
+
'totalMb': json['total_mb'],
|
|
72
|
+
'samples': json['samples'],
|
|
73
|
+
'lastSampleAt': (new Date(json['last_sample_at'])),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function InstanceGpuMemoryToJSON(json: any): InstanceGpuMemory {
|
|
78
|
+
return InstanceGpuMemoryToJSONTyped(json, false);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function InstanceGpuMemoryToJSONTyped(value?: InstanceGpuMemory | null, ignoreDiscriminator: boolean = false): any {
|
|
82
|
+
if (value == null) {
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
|
|
88
|
+
'peak_used_mb': value['peakUsedMb'],
|
|
89
|
+
'total_mb': value['totalMb'],
|
|
90
|
+
'samples': value['samples'],
|
|
91
|
+
'last_sample_at': value['lastSampleAt'].toISOString(),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
package/src/models/index.ts
CHANGED
|
@@ -55,6 +55,9 @@ export * from './FunctionVersion';
|
|
|
55
55
|
export * from './GPUType';
|
|
56
56
|
export * from './GPUTypePage';
|
|
57
57
|
export * from './GetHealth200Response';
|
|
58
|
+
export * from './GpuSuggestion';
|
|
59
|
+
export * from './GpuSuggestionCheaper';
|
|
60
|
+
export * from './GpuSuggestionGpu';
|
|
58
61
|
export * from './ImagesGenerationsRequest';
|
|
59
62
|
export * from './ImagesResponse';
|
|
60
63
|
export * from './ImagesResponseDataInner';
|
|
@@ -62,6 +65,7 @@ export * from './ImagesResponseUsage';
|
|
|
62
65
|
export * from './IncludeItem';
|
|
63
66
|
export * from './Instance';
|
|
64
67
|
export * from './InstanceConnection';
|
|
68
|
+
export * from './InstanceGpuMemory';
|
|
65
69
|
export * from './InstancePage';
|
|
66
70
|
export * from './Invoice';
|
|
67
71
|
export * from './InvoiceList';
|
package/src/runtime.ts
CHANGED
|
@@ -75,7 +75,7 @@ export class Configuration {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
get headers(): HTTPHeaders | undefined {
|
|
78
|
-
return { 'User-Agent': 'gpuai-sdk-ts/0.4.
|
|
78
|
+
return { 'User-Agent': 'gpuai-sdk-ts/0.4.2', ...this.configuration.headers };
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
get credentials(): RequestCredentials | undefined {
|