@gpuai/sdk 0.3.12 → 0.3.14

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 (132) hide show
  1. package/.openapi-generator/FILES +36 -0
  2. package/README.md +38 -9
  3. package/dist/apis/AutolaunchApi.d.ts +109 -0
  4. package/dist/apis/AutolaunchApi.js +286 -0
  5. package/dist/apis/InferenceApi.d.ts +19 -0
  6. package/dist/apis/InferenceApi.js +51 -0
  7. package/dist/apis/MarketApi.d.ts +56 -0
  8. package/dist/apis/MarketApi.js +112 -0
  9. package/dist/apis/WatchApi.d.ts +109 -0
  10. package/dist/apis/WatchApi.js +286 -0
  11. package/dist/apis/index.d.ts +3 -0
  12. package/dist/apis/index.js +3 -0
  13. package/dist/esm/apis/AutolaunchApi.d.ts +109 -0
  14. package/dist/esm/apis/AutolaunchApi.js +282 -0
  15. package/dist/esm/apis/InferenceApi.d.ts +19 -0
  16. package/dist/esm/apis/InferenceApi.js +51 -0
  17. package/dist/esm/apis/MarketApi.d.ts +56 -0
  18. package/dist/esm/apis/MarketApi.js +108 -0
  19. package/dist/esm/apis/WatchApi.d.ts +109 -0
  20. package/dist/esm/apis/WatchApi.js +282 -0
  21. package/dist/esm/apis/index.d.ts +3 -0
  22. package/dist/esm/apis/index.js +3 -0
  23. package/dist/esm/models/AutolaunchRule.d.ts +181 -0
  24. package/dist/esm/models/AutolaunchRule.js +142 -0
  25. package/dist/esm/models/AutolaunchRuleCreate.d.ts +105 -0
  26. package/dist/esm/models/AutolaunchRuleCreate.js +84 -0
  27. package/dist/esm/models/AutolaunchRuleDisarm.d.ts +34 -0
  28. package/dist/esm/models/AutolaunchRuleDisarm.js +43 -0
  29. package/dist/esm/models/AutolaunchRulePage.d.ts +39 -0
  30. package/dist/esm/models/AutolaunchRulePage.js +48 -0
  31. package/dist/esm/models/Embedding.d.ts +51 -0
  32. package/dist/esm/models/Embedding.js +59 -0
  33. package/dist/esm/models/EmbeddingsRequest.d.ts +64 -0
  34. package/dist/esm/models/EmbeddingsRequest.js +60 -0
  35. package/dist/esm/models/EmbeddingsRequestInput.d.ts +21 -0
  36. package/dist/esm/models/EmbeddingsRequestInput.js +47 -0
  37. package/dist/esm/models/EmbeddingsResponse.d.ts +59 -0
  38. package/dist/esm/models/EmbeddingsResponse.js +65 -0
  39. package/dist/esm/models/EmbeddingsUsage.d.ts +38 -0
  40. package/dist/esm/models/EmbeddingsUsage.js +47 -0
  41. package/dist/esm/models/MarketHistoryPoint.d.ts +59 -0
  42. package/dist/esm/models/MarketHistoryPoint.js +55 -0
  43. package/dist/esm/models/MarketHistoryResponse.d.ts +60 -0
  44. package/dist/esm/models/MarketHistoryResponse.js +60 -0
  45. package/dist/esm/models/Problem.d.ts +1 -0
  46. package/dist/esm/models/Problem.js +1 -0
  47. package/dist/esm/models/WatchRule.d.ts +141 -0
  48. package/dist/esm/models/WatchRule.js +117 -0
  49. package/dist/esm/models/WatchRuleCreate.d.ts +87 -0
  50. package/dist/esm/models/WatchRuleCreate.js +72 -0
  51. package/dist/esm/models/WatchRulePage.d.ts +39 -0
  52. package/dist/esm/models/WatchRulePage.js +48 -0
  53. package/dist/esm/models/WatchRuleUpdate.d.ts +86 -0
  54. package/dist/esm/models/WatchRuleUpdate.js +68 -0
  55. package/dist/esm/models/index.d.ts +15 -0
  56. package/dist/esm/models/index.js +15 -0
  57. package/dist/models/AutolaunchRule.d.ts +181 -0
  58. package/dist/models/AutolaunchRule.js +150 -0
  59. package/dist/models/AutolaunchRuleCreate.d.ts +105 -0
  60. package/dist/models/AutolaunchRuleCreate.js +92 -0
  61. package/dist/models/AutolaunchRuleDisarm.d.ts +34 -0
  62. package/dist/models/AutolaunchRuleDisarm.js +50 -0
  63. package/dist/models/AutolaunchRulePage.d.ts +39 -0
  64. package/dist/models/AutolaunchRulePage.js +55 -0
  65. package/dist/models/Embedding.d.ts +51 -0
  66. package/dist/models/Embedding.js +67 -0
  67. package/dist/models/EmbeddingsRequest.d.ts +64 -0
  68. package/dist/models/EmbeddingsRequest.js +68 -0
  69. package/dist/models/EmbeddingsRequestInput.d.ts +21 -0
  70. package/dist/models/EmbeddingsRequestInput.js +53 -0
  71. package/dist/models/EmbeddingsResponse.d.ts +59 -0
  72. package/dist/models/EmbeddingsResponse.js +73 -0
  73. package/dist/models/EmbeddingsUsage.d.ts +38 -0
  74. package/dist/models/EmbeddingsUsage.js +54 -0
  75. package/dist/models/MarketHistoryPoint.d.ts +59 -0
  76. package/dist/models/MarketHistoryPoint.js +62 -0
  77. package/dist/models/MarketHistoryResponse.d.ts +60 -0
  78. package/dist/models/MarketHistoryResponse.js +67 -0
  79. package/dist/models/Problem.d.ts +1 -0
  80. package/dist/models/Problem.js +1 -0
  81. package/dist/models/WatchRule.d.ts +141 -0
  82. package/dist/models/WatchRule.js +125 -0
  83. package/dist/models/WatchRuleCreate.d.ts +87 -0
  84. package/dist/models/WatchRuleCreate.js +80 -0
  85. package/dist/models/WatchRulePage.d.ts +39 -0
  86. package/dist/models/WatchRulePage.js +55 -0
  87. package/dist/models/WatchRuleUpdate.d.ts +86 -0
  88. package/dist/models/WatchRuleUpdate.js +76 -0
  89. package/dist/models/index.d.ts +15 -0
  90. package/dist/models/index.js +15 -0
  91. package/docs/AutolaunchApi.md +390 -0
  92. package/docs/AutolaunchRule.md +69 -0
  93. package/docs/AutolaunchRuleCreate.md +50 -0
  94. package/docs/AutolaunchRuleDisarm.md +35 -0
  95. package/docs/AutolaunchRulePage.md +36 -0
  96. package/docs/Embedding.md +38 -0
  97. package/docs/EmbeddingsRequest.md +42 -0
  98. package/docs/EmbeddingsRequestInput.md +33 -0
  99. package/docs/EmbeddingsResponse.md +40 -0
  100. package/docs/EmbeddingsUsage.md +37 -0
  101. package/docs/InferenceApi.md +83 -0
  102. package/docs/MarketApi.md +98 -0
  103. package/docs/MarketHistoryPoint.md +43 -0
  104. package/docs/MarketHistoryResponse.md +43 -0
  105. package/docs/WatchApi.md +389 -0
  106. package/docs/WatchRule.md +61 -0
  107. package/docs/WatchRuleCreate.md +46 -0
  108. package/docs/WatchRulePage.md +36 -0
  109. package/docs/WatchRuleUpdate.md +47 -0
  110. package/package.json +1 -1
  111. package/src/apis/AutolaunchApi.ts +360 -0
  112. package/src/apis/InferenceApi.ts +71 -0
  113. package/src/apis/MarketApi.ts +136 -0
  114. package/src/apis/WatchApi.ts +360 -0
  115. package/src/apis/index.ts +3 -0
  116. package/src/models/AutolaunchRule.ts +270 -0
  117. package/src/models/AutolaunchRuleCreate.ts +162 -0
  118. package/src/models/AutolaunchRuleDisarm.ts +68 -0
  119. package/src/models/AutolaunchRulePage.ts +83 -0
  120. package/src/models/Embedding.ts +96 -0
  121. package/src/models/EmbeddingsRequest.ts +117 -0
  122. package/src/models/EmbeddingsRequestInput.ts +59 -0
  123. package/src/models/EmbeddingsResponse.ts +120 -0
  124. package/src/models/EmbeddingsUsage.ts +75 -0
  125. package/src/models/MarketHistoryPoint.ts +103 -0
  126. package/src/models/MarketHistoryResponse.ts +113 -0
  127. package/src/models/Problem.ts +1 -0
  128. package/src/models/WatchRule.ts +219 -0
  129. package/src/models/WatchRuleCreate.ts +138 -0
  130. package/src/models/WatchRulePage.ts +83 -0
  131. package/src/models/WatchRuleUpdate.ts +135 -0
  132. package/src/models/index.ts +15 -0
@@ -0,0 +1,360 @@
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 * as runtime from '../runtime';
16
+ import {
17
+ type AutolaunchRule,
18
+ AutolaunchRuleFromJSON,
19
+ AutolaunchRuleToJSON,
20
+ } from '../models/AutolaunchRule';
21
+ import {
22
+ type AutolaunchRuleCreate,
23
+ AutolaunchRuleCreateFromJSON,
24
+ AutolaunchRuleCreateToJSON,
25
+ } from '../models/AutolaunchRuleCreate';
26
+ import {
27
+ type AutolaunchRuleDisarm,
28
+ AutolaunchRuleDisarmFromJSON,
29
+ AutolaunchRuleDisarmToJSON,
30
+ } from '../models/AutolaunchRuleDisarm';
31
+ import {
32
+ type AutolaunchRulePage,
33
+ AutolaunchRulePageFromJSON,
34
+ AutolaunchRulePageToJSON,
35
+ } from '../models/AutolaunchRulePage';
36
+ import {
37
+ type Problem,
38
+ ProblemFromJSON,
39
+ ProblemToJSON,
40
+ } from '../models/Problem';
41
+
42
+ export interface CreateAutolaunchRuleRequest {
43
+ autolaunchRuleCreate: AutolaunchRuleCreate;
44
+ idempotencyKey?: string;
45
+ }
46
+
47
+ export interface DeleteAutolaunchRuleRequest {
48
+ id: string;
49
+ }
50
+
51
+ export interface DisarmAutolaunchRuleRequest {
52
+ id: string;
53
+ autolaunchRuleDisarm: AutolaunchRuleDisarm;
54
+ }
55
+
56
+ export interface GetAutolaunchRuleRequest {
57
+ id: string;
58
+ }
59
+
60
+ export interface ListAutolaunchRulesRequest {
61
+ cursor?: string;
62
+ limit?: number;
63
+ }
64
+
65
+ /**
66
+ *
67
+ */
68
+ export class AutolaunchApi extends runtime.BaseAPI {
69
+
70
+ /**
71
+ * Creates request options for createAutolaunchRule without sending the request
72
+ */
73
+ async createAutolaunchRuleRequestOpts(requestParameters: CreateAutolaunchRuleRequest): Promise<runtime.RequestOpts> {
74
+ if (requestParameters['autolaunchRuleCreate'] == null) {
75
+ throw new runtime.RequiredError(
76
+ 'autolaunchRuleCreate',
77
+ 'Required parameter "autolaunchRuleCreate" was null or undefined when calling createAutolaunchRule().'
78
+ );
79
+ }
80
+
81
+ const queryParameters: any = {};
82
+
83
+ const headerParameters: runtime.HTTPHeaders = {};
84
+
85
+ headerParameters['Content-Type'] = 'application/json';
86
+
87
+ if (requestParameters['idempotencyKey'] != null) {
88
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
89
+ }
90
+
91
+ if (this.configuration && this.configuration.accessToken) {
92
+ const token = this.configuration.accessToken;
93
+ const tokenString = await token("bearerAuth", []);
94
+
95
+ if (tokenString) {
96
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
97
+ }
98
+ }
99
+
100
+ let urlPath = `/autolaunch-rules`;
101
+
102
+ return {
103
+ path: urlPath,
104
+ method: 'POST',
105
+ headers: headerParameters,
106
+ query: queryParameters,
107
+ body: AutolaunchRuleCreateToJSON(requestParameters['autolaunchRuleCreate']),
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Creates a standing, pre-approved purchase order. When the condition holds and the live price is at or under `max_price_per_hour`, the platform launches the frozen `spec` with no further confirmation from anyone — the customer is approving NOW for a purchase that happens LATER, while nobody is watching. SCOPE. Requires the `autolaunch:write` scope, which is granted only EXPLICITLY. It is deliberately NOT covered by `full_access`, `standard` or `read_only`: `instances:write` is real-time authority, exercised with someone present, whereas this is a standing, frozen authorization that fires days later unattended. Treating them as the same authority class would have handed unattended spend authority to every key ever issued, including keys minted long before this resource existed. Most existing keys therefore receive 403 here; the correct response is to mint a key whose scopes map includes `{\"autolaunch\": \"write\"}`, never to retry, to substitute a key, or to fall back to a watch rule. CONSENT. `acknowledged_max_total_usd` is REQUIRED and must equal `max_price_per_hour × max_runtime_hours` to within one cent. It is the API-level expression of \"a valid confirmation must come AFTER the price\": a caller that never computed the number cannot have shown it to anyone, and a caller that displayed a different number disagrees with what is about to be stored. Show the figure to the person approving the rule, then send it back. TWO PRICES, TWO UNITS. `threshold` is the TRIGGER, in dollars per GPU-hour — the same unit the market chart and watch rules speak in. `max_price_per_hour` is the CEILING, in dollars per hour for the WHOLE instance. A 4-GPU rule triggering under $4.00/GPU-hr typically carries a $16.00/hr ceiling. Conflating them scales the customer\'s spend authorization by their GPU count. FROZEN SPEC. `spec` is the full create-instance body the rule replays, validated at creation with the same validation a live create runs, so a spec that could never launch is refused while a human is present rather than at 3 a.m. `spec.offering_id` is REJECTED — offering identity churns between catalog polls, so a pin produces a rule that can never fire, which is the worst outcome here because the customer believes a purchase is armed. `spec.auto_terminate_hours` is overwritten from `max_runtime_hours` and must not be used to widen the bound. Organizations are limited to 10 active rules; the 422 names the limit. The organization spending limit still applies as a backstop at fire time — a launch must fit both its own ceiling and the org cap.
113
+ * Create an auto-launch rule (pre-approves a bounded, unattended spend)
114
+ */
115
+ async createAutolaunchRuleRaw(requestParameters: CreateAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AutolaunchRule>> {
116
+ const requestOptions = await this.createAutolaunchRuleRequestOpts(requestParameters);
117
+ const response = await this.request(requestOptions, initOverrides);
118
+
119
+ return new runtime.JSONApiResponse(response, (jsonValue) => AutolaunchRuleFromJSON(jsonValue));
120
+ }
121
+
122
+ /**
123
+ * Creates a standing, pre-approved purchase order. When the condition holds and the live price is at or under `max_price_per_hour`, the platform launches the frozen `spec` with no further confirmation from anyone — the customer is approving NOW for a purchase that happens LATER, while nobody is watching. SCOPE. Requires the `autolaunch:write` scope, which is granted only EXPLICITLY. It is deliberately NOT covered by `full_access`, `standard` or `read_only`: `instances:write` is real-time authority, exercised with someone present, whereas this is a standing, frozen authorization that fires days later unattended. Treating them as the same authority class would have handed unattended spend authority to every key ever issued, including keys minted long before this resource existed. Most existing keys therefore receive 403 here; the correct response is to mint a key whose scopes map includes `{\"autolaunch\": \"write\"}`, never to retry, to substitute a key, or to fall back to a watch rule. CONSENT. `acknowledged_max_total_usd` is REQUIRED and must equal `max_price_per_hour × max_runtime_hours` to within one cent. It is the API-level expression of \"a valid confirmation must come AFTER the price\": a caller that never computed the number cannot have shown it to anyone, and a caller that displayed a different number disagrees with what is about to be stored. Show the figure to the person approving the rule, then send it back. TWO PRICES, TWO UNITS. `threshold` is the TRIGGER, in dollars per GPU-hour — the same unit the market chart and watch rules speak in. `max_price_per_hour` is the CEILING, in dollars per hour for the WHOLE instance. A 4-GPU rule triggering under $4.00/GPU-hr typically carries a $16.00/hr ceiling. Conflating them scales the customer\'s spend authorization by their GPU count. FROZEN SPEC. `spec` is the full create-instance body the rule replays, validated at creation with the same validation a live create runs, so a spec that could never launch is refused while a human is present rather than at 3 a.m. `spec.offering_id` is REJECTED — offering identity churns between catalog polls, so a pin produces a rule that can never fire, which is the worst outcome here because the customer believes a purchase is armed. `spec.auto_terminate_hours` is overwritten from `max_runtime_hours` and must not be used to widen the bound. Organizations are limited to 10 active rules; the 422 names the limit. The organization spending limit still applies as a backstop at fire time — a launch must fit both its own ceiling and the org cap.
124
+ * Create an auto-launch rule (pre-approves a bounded, unattended spend)
125
+ */
126
+ async createAutolaunchRule(requestParameters: CreateAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AutolaunchRule> {
127
+ const response = await this.createAutolaunchRuleRaw(requestParameters, initOverrides);
128
+ return await response.value();
129
+ }
130
+
131
+ /**
132
+ * Creates request options for deleteAutolaunchRule without sending the request
133
+ */
134
+ async deleteAutolaunchRuleRequestOpts(requestParameters: DeleteAutolaunchRuleRequest): Promise<runtime.RequestOpts> {
135
+ if (requestParameters['id'] == null) {
136
+ throw new runtime.RequiredError(
137
+ 'id',
138
+ 'Required parameter "id" was null or undefined when calling deleteAutolaunchRule().'
139
+ );
140
+ }
141
+
142
+ const queryParameters: any = {};
143
+
144
+ const headerParameters: runtime.HTTPHeaders = {};
145
+
146
+ if (this.configuration && this.configuration.accessToken) {
147
+ const token = this.configuration.accessToken;
148
+ const tokenString = await token("bearerAuth", []);
149
+
150
+ if (tokenString) {
151
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
152
+ }
153
+ }
154
+
155
+ let urlPath = `/autolaunch-rules/{id}`;
156
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
157
+
158
+ return {
159
+ path: urlPath,
160
+ method: 'DELETE',
161
+ headers: headerParameters,
162
+ query: queryParameters,
163
+ };
164
+ }
165
+
166
+ /**
167
+ * Deletes the rule and withdraws its pre-approved spend cap immediately. Requires only the `autolaunch:read` scope, for the same reason the disarm PATCH does. Deleting an already-deleted rule returns 404.
168
+ * Cancel an auto-launch rule
169
+ */
170
+ async deleteAutolaunchRuleRaw(requestParameters: DeleteAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
171
+ const requestOptions = await this.deleteAutolaunchRuleRequestOpts(requestParameters);
172
+ const response = await this.request(requestOptions, initOverrides);
173
+
174
+ return new runtime.VoidApiResponse(response);
175
+ }
176
+
177
+ /**
178
+ * Deletes the rule and withdraws its pre-approved spend cap immediately. Requires only the `autolaunch:read` scope, for the same reason the disarm PATCH does. Deleting an already-deleted rule returns 404.
179
+ * Cancel an auto-launch rule
180
+ */
181
+ async deleteAutolaunchRule(requestParameters: DeleteAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
182
+ await this.deleteAutolaunchRuleRaw(requestParameters, initOverrides);
183
+ }
184
+
185
+ /**
186
+ * Creates request options for disarmAutolaunchRule without sending the request
187
+ */
188
+ async disarmAutolaunchRuleRequestOpts(requestParameters: DisarmAutolaunchRuleRequest): Promise<runtime.RequestOpts> {
189
+ if (requestParameters['id'] == null) {
190
+ throw new runtime.RequiredError(
191
+ 'id',
192
+ 'Required parameter "id" was null or undefined when calling disarmAutolaunchRule().'
193
+ );
194
+ }
195
+
196
+ if (requestParameters['autolaunchRuleDisarm'] == null) {
197
+ throw new runtime.RequiredError(
198
+ 'autolaunchRuleDisarm',
199
+ 'Required parameter "autolaunchRuleDisarm" was null or undefined when calling disarmAutolaunchRule().'
200
+ );
201
+ }
202
+
203
+ const queryParameters: any = {};
204
+
205
+ const headerParameters: runtime.HTTPHeaders = {};
206
+
207
+ headerParameters['Content-Type'] = 'application/json';
208
+
209
+ if (this.configuration && this.configuration.accessToken) {
210
+ const token = this.configuration.accessToken;
211
+ const tokenString = await token("bearerAuth", []);
212
+
213
+ if (tokenString) {
214
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
215
+ }
216
+ }
217
+
218
+ let urlPath = `/autolaunch-rules/{id}`;
219
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
220
+
221
+ return {
222
+ path: urlPath,
223
+ method: 'PATCH',
224
+ headers: headerParameters,
225
+ query: queryParameters,
226
+ body: AutolaunchRuleDisarmToJSON(requestParameters['autolaunchRuleDisarm']),
227
+ };
228
+ }
229
+
230
+ /**
231
+ * Disarms a rule. The body must be exactly `{\"enabled\": false}` and nothing else. Requires only the `autolaunch:read` scope — cancelling a standing spend authorization is deliberately never harder than holding one, so a key narrowed since it created a rule can still stop that rule. This is the entire update surface, and the absence is the design. Changing a ceiling, a runtime bound, the targeting or the frozen spec is a DIFFERENT bounded purchase, so it requires deleting the rule and creating a new one through the consent gate. Re-arming is refused too: a fired rule consumed its one shot, so `{\"enabled\": true}` would resurrect a purchase order that was already consented to and spent.
232
+ * Disarm an auto-launch rule
233
+ */
234
+ async disarmAutolaunchRuleRaw(requestParameters: DisarmAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AutolaunchRule>> {
235
+ const requestOptions = await this.disarmAutolaunchRuleRequestOpts(requestParameters);
236
+ const response = await this.request(requestOptions, initOverrides);
237
+
238
+ return new runtime.JSONApiResponse(response, (jsonValue) => AutolaunchRuleFromJSON(jsonValue));
239
+ }
240
+
241
+ /**
242
+ * Disarms a rule. The body must be exactly `{\"enabled\": false}` and nothing else. Requires only the `autolaunch:read` scope — cancelling a standing spend authorization is deliberately never harder than holding one, so a key narrowed since it created a rule can still stop that rule. This is the entire update surface, and the absence is the design. Changing a ceiling, a runtime bound, the targeting or the frozen spec is a DIFFERENT bounded purchase, so it requires deleting the rule and creating a new one through the consent gate. Re-arming is refused too: a fired rule consumed its one shot, so `{\"enabled\": true}` would resurrect a purchase order that was already consented to and spent.
243
+ * Disarm an auto-launch rule
244
+ */
245
+ async disarmAutolaunchRule(requestParameters: DisarmAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AutolaunchRule> {
246
+ const response = await this.disarmAutolaunchRuleRaw(requestParameters, initOverrides);
247
+ return await response.value();
248
+ }
249
+
250
+ /**
251
+ * Creates request options for getAutolaunchRule without sending the request
252
+ */
253
+ async getAutolaunchRuleRequestOpts(requestParameters: GetAutolaunchRuleRequest): Promise<runtime.RequestOpts> {
254
+ if (requestParameters['id'] == null) {
255
+ throw new runtime.RequiredError(
256
+ 'id',
257
+ 'Required parameter "id" was null or undefined when calling getAutolaunchRule().'
258
+ );
259
+ }
260
+
261
+ const queryParameters: any = {};
262
+
263
+ const headerParameters: runtime.HTTPHeaders = {};
264
+
265
+ if (this.configuration && this.configuration.accessToken) {
266
+ const token = this.configuration.accessToken;
267
+ const tokenString = await token("bearerAuth", []);
268
+
269
+ if (tokenString) {
270
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
271
+ }
272
+ }
273
+
274
+ let urlPath = `/autolaunch-rules/{id}`;
275
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
276
+
277
+ return {
278
+ path: urlPath,
279
+ method: 'GET',
280
+ headers: headerParameters,
281
+ query: queryParameters,
282
+ };
283
+ }
284
+
285
+ /**
286
+ * Fetches one auto-launch rule, including the frozen launch spec. Requires the `autolaunch:read` scope. A rule belonging to another organization returns 404 — the same answer as an id that does not exist.
287
+ * Get an auto-launch rule
288
+ */
289
+ async getAutolaunchRuleRaw(requestParameters: GetAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AutolaunchRule>> {
290
+ const requestOptions = await this.getAutolaunchRuleRequestOpts(requestParameters);
291
+ const response = await this.request(requestOptions, initOverrides);
292
+
293
+ return new runtime.JSONApiResponse(response, (jsonValue) => AutolaunchRuleFromJSON(jsonValue));
294
+ }
295
+
296
+ /**
297
+ * Fetches one auto-launch rule, including the frozen launch spec. Requires the `autolaunch:read` scope. A rule belonging to another organization returns 404 — the same answer as an id that does not exist.
298
+ * Get an auto-launch rule
299
+ */
300
+ async getAutolaunchRule(requestParameters: GetAutolaunchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AutolaunchRule> {
301
+ const response = await this.getAutolaunchRuleRaw(requestParameters, initOverrides);
302
+ return await response.value();
303
+ }
304
+
305
+ /**
306
+ * Creates request options for listAutolaunchRules without sending the request
307
+ */
308
+ async listAutolaunchRulesRequestOpts(requestParameters: ListAutolaunchRulesRequest): Promise<runtime.RequestOpts> {
309
+ const queryParameters: any = {};
310
+
311
+ if (requestParameters['cursor'] != null) {
312
+ queryParameters['cursor'] = requestParameters['cursor'];
313
+ }
314
+
315
+ if (requestParameters['limit'] != null) {
316
+ queryParameters['limit'] = requestParameters['limit'];
317
+ }
318
+
319
+ const headerParameters: runtime.HTTPHeaders = {};
320
+
321
+ if (this.configuration && this.configuration.accessToken) {
322
+ const token = this.configuration.accessToken;
323
+ const tokenString = await token("bearerAuth", []);
324
+
325
+ if (tokenString) {
326
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
327
+ }
328
+ }
329
+
330
+ let urlPath = `/autolaunch-rules`;
331
+
332
+ return {
333
+ path: urlPath,
334
+ method: 'GET',
335
+ headers: headerParameters,
336
+ query: queryParameters,
337
+ };
338
+ }
339
+
340
+ /**
341
+ * Lists this organization\'s auto-launch rules. Requires the `autolaunch:read` scope, which `standard` and `full_access` keys carry. Rules belonging to other organizations are never returned, and rules created through the dashboard are included — the list is the organization\'s, not the key\'s.
342
+ * List auto-launch rules
343
+ */
344
+ async listAutolaunchRulesRaw(requestParameters: ListAutolaunchRulesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AutolaunchRulePage>> {
345
+ const requestOptions = await this.listAutolaunchRulesRequestOpts(requestParameters);
346
+ const response = await this.request(requestOptions, initOverrides);
347
+
348
+ return new runtime.JSONApiResponse(response, (jsonValue) => AutolaunchRulePageFromJSON(jsonValue));
349
+ }
350
+
351
+ /**
352
+ * Lists this organization\'s auto-launch rules. Requires the `autolaunch:read` scope, which `standard` and `full_access` keys carry. Rules belonging to other organizations are never returned, and rules created through the dashboard are included — the list is the organization\'s, not the key\'s.
353
+ * List auto-launch rules
354
+ */
355
+ async listAutolaunchRules(requestParameters: ListAutolaunchRulesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AutolaunchRulePage> {
356
+ const response = await this.listAutolaunchRulesRaw(requestParameters, initOverrides);
357
+ return await response.value();
358
+ }
359
+
360
+ }
@@ -23,6 +23,16 @@ import {
23
23
  ChatCompletionResponseFromJSON,
24
24
  ChatCompletionResponseToJSON,
25
25
  } from '../models/ChatCompletionResponse';
26
+ import {
27
+ type EmbeddingsRequest,
28
+ EmbeddingsRequestFromJSON,
29
+ EmbeddingsRequestToJSON,
30
+ } from '../models/EmbeddingsRequest';
31
+ import {
32
+ type EmbeddingsResponse,
33
+ EmbeddingsResponseFromJSON,
34
+ EmbeddingsResponseToJSON,
35
+ } from '../models/EmbeddingsResponse';
26
36
  import {
27
37
  type ImagesGenerationsRequest,
28
38
  ImagesGenerationsRequestFromJSON,
@@ -72,6 +82,10 @@ export interface CreateChatCompletionRequest {
72
82
  chatCompletionRequest: ChatCompletionRequest;
73
83
  }
74
84
 
85
+ export interface CreateEmbeddingsRequest {
86
+ embeddingsRequest: EmbeddingsRequest;
87
+ }
88
+
75
89
  export interface CreateImageRequest {
76
90
  imagesGenerationsRequest: ImagesGenerationsRequest;
77
91
  idempotencyKey?: string;
@@ -216,6 +230,63 @@ export class InferenceApi extends runtime.BaseAPI {
216
230
  return await response.value();
217
231
  }
218
232
 
233
+ /**
234
+ * Creates request options for createEmbeddings without sending the request
235
+ */
236
+ async createEmbeddingsRequestOpts(requestParameters: CreateEmbeddingsRequest): Promise<runtime.RequestOpts> {
237
+ if (requestParameters['embeddingsRequest'] == null) {
238
+ throw new runtime.RequiredError(
239
+ 'embeddingsRequest',
240
+ 'Required parameter "embeddingsRequest" was null or undefined when calling createEmbeddings().'
241
+ );
242
+ }
243
+
244
+ const queryParameters: any = {};
245
+
246
+ const headerParameters: runtime.HTTPHeaders = {};
247
+
248
+ headerParameters['Content-Type'] = 'application/json';
249
+
250
+ if (this.configuration && this.configuration.accessToken) {
251
+ const token = this.configuration.accessToken;
252
+ const tokenString = await token("bearerAuth", []);
253
+
254
+ if (tokenString) {
255
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
256
+ }
257
+ }
258
+
259
+ let urlPath = `/embeddings`;
260
+
261
+ return {
262
+ path: urlPath,
263
+ method: 'POST',
264
+ headers: headerParameters,
265
+ query: queryParameters,
266
+ body: EmbeddingsRequestToJSON(requestParameters['embeddingsRequest']),
267
+ };
268
+ }
269
+
270
+ /**
271
+ * Synchronous text embeddings. Accepts a single string or an array of up to 2048 strings, bounded so the response stays under 64 MiB (about 680 inputs at 4096 dimensions; fewer at a larger `dimensions` value) — over-limit requests are rejected with 400 before any processing. Returns one float vector per input, in request order. Billed on the upstream\'s reported prompt tokens at the model\'s listed input rate, rounded up to the next whole cent per request; an embeddings call emits no completion tokens, so `usage` carries `prompt_tokens` and `total_tokens` only. `encoding_format` accepts only `float` — a value of `base64` is rejected with `unsupported_parameter`. A chat model id on this route returns 404 `model_not_found`: the id is valid, but not on this surface.
272
+ * Create embeddings (OpenAI-compatible)
273
+ */
274
+ async createEmbeddingsRaw(requestParameters: CreateEmbeddingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmbeddingsResponse>> {
275
+ const requestOptions = await this.createEmbeddingsRequestOpts(requestParameters);
276
+ const response = await this.request(requestOptions, initOverrides);
277
+
278
+ return new runtime.JSONApiResponse(response, (jsonValue) => EmbeddingsResponseFromJSON(jsonValue));
279
+ }
280
+
281
+ /**
282
+ * Synchronous text embeddings. Accepts a single string or an array of up to 2048 strings, bounded so the response stays under 64 MiB (about 680 inputs at 4096 dimensions; fewer at a larger `dimensions` value) — over-limit requests are rejected with 400 before any processing. Returns one float vector per input, in request order. Billed on the upstream\'s reported prompt tokens at the model\'s listed input rate, rounded up to the next whole cent per request; an embeddings call emits no completion tokens, so `usage` carries `prompt_tokens` and `total_tokens` only. `encoding_format` accepts only `float` — a value of `base64` is rejected with `unsupported_parameter`. A chat model id on this route returns 404 `model_not_found`: the id is valid, but not on this surface.
283
+ * Create embeddings (OpenAI-compatible)
284
+ */
285
+ async createEmbeddings(requestParameters: CreateEmbeddingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmbeddingsResponse> {
286
+ const response = await this.createEmbeddingsRaw(requestParameters, initOverrides);
287
+ return await response.value();
288
+ }
289
+
219
290
  /**
220
291
  * Creates request options for createImage without sending the request
221
292
  */
@@ -0,0 +1,136 @@
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 * as runtime from '../runtime';
16
+ import {
17
+ type MarketHistoryResponse,
18
+ MarketHistoryResponseFromJSON,
19
+ MarketHistoryResponseToJSON,
20
+ } from '../models/MarketHistoryResponse';
21
+ import {
22
+ type Problem,
23
+ ProblemFromJSON,
24
+ ProblemToJSON,
25
+ } from '../models/Problem';
26
+
27
+ export interface GetMarketHistoryRequest {
28
+ gpuModel: string;
29
+ region?: string;
30
+ capacityClass?: GetMarketHistoryCapacityClassEnum;
31
+ bucket?: GetMarketHistoryBucketEnum;
32
+ from?: Date;
33
+ to?: Date;
34
+ }
35
+
36
+ /**
37
+ *
38
+ */
39
+ export class MarketApi extends runtime.BaseAPI {
40
+
41
+ /**
42
+ * Creates request options for getMarketHistory without sending the request
43
+ */
44
+ async getMarketHistoryRequestOpts(requestParameters: GetMarketHistoryRequest): Promise<runtime.RequestOpts> {
45
+ if (requestParameters['gpuModel'] == null) {
46
+ throw new runtime.RequiredError(
47
+ 'gpuModel',
48
+ 'Required parameter "gpuModel" was null or undefined when calling getMarketHistory().'
49
+ );
50
+ }
51
+
52
+ const queryParameters: any = {};
53
+
54
+ if (requestParameters['gpuModel'] != null) {
55
+ queryParameters['gpu_model'] = requestParameters['gpuModel'];
56
+ }
57
+
58
+ if (requestParameters['region'] != null) {
59
+ queryParameters['region'] = requestParameters['region'];
60
+ }
61
+
62
+ if (requestParameters['capacityClass'] != null) {
63
+ queryParameters['capacity_class'] = requestParameters['capacityClass'];
64
+ }
65
+
66
+ if (requestParameters['bucket'] != null) {
67
+ queryParameters['bucket'] = requestParameters['bucket'];
68
+ }
69
+
70
+ if (requestParameters['from'] != null) {
71
+ queryParameters['from'] = (requestParameters['from'] as any).toISOString();
72
+ }
73
+
74
+ if (requestParameters['to'] != null) {
75
+ queryParameters['to'] = (requestParameters['to'] as any).toISOString();
76
+ }
77
+
78
+ const headerParameters: runtime.HTTPHeaders = {};
79
+
80
+ if (this.configuration && this.configuration.accessToken) {
81
+ const token = this.configuration.accessToken;
82
+ const tokenString = await token("bearerAuth", []);
83
+
84
+ if (tokenString) {
85
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
86
+ }
87
+ }
88
+
89
+ let urlPath = `/market-history`;
90
+
91
+ return {
92
+ path: urlPath,
93
+ method: 'GET',
94
+ headers: headerParameters,
95
+ query: queryParameters,
96
+ };
97
+ }
98
+
99
+ /**
100
+ * Returns GPU.ai\'s own price and obtainable capacity for one GPU model over a window, at 15-minute or daily resolution. Requires the `market:read` scope (or `full_access`). THE NULL CONTRACT. `price_per_gpu_hour` and `available_count` are nullable, and the two states are different facts that must not be collapsed: * a real `0` means we sampled that bucket and the market was sold out; * `null` means we did NOT sample that bucket — a failed poll, a skipped cycle, an incident on our side. It says nothing about supply. The response materializes the full bucket grid across the window, so a gap has visible width. Do not interpolate across a null: that asserts a continuity the data does not have, and reading one as a zero reports our own outages as supplier stockouts. PER-GPU NORMALIZATION. `price_per_gpu_hour` is always a per-GPU rate. When it was divided out of a whole-node price, `node_price_per_hour` and `gpu_count` are present and describe that derivation; they are absent for single-GPU capacity. A per-GPU figure presented without that context implies single-GPU rentability that whole-node capacity does not offer. WINDOW CAPS. `bucket=1d` is capped at 365 days (the retention window). `bucket=15m` is capped at 90 days when BOTH `region` and `capacity_class` are supplied, and at 31 days when either is omitted, because an unscoped 15-minute series scans every region and class in every bucket. An over-wide window is a 400 naming the cap and both escapes, never a silent truncation. This series carries no upstream supplier identity of any kind: the price is GPU.ai\'s own floor and the count is an aggregate.
101
+ * Get a GPU\'s price and availability over time
102
+ */
103
+ async getMarketHistoryRaw(requestParameters: GetMarketHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MarketHistoryResponse>> {
104
+ const requestOptions = await this.getMarketHistoryRequestOpts(requestParameters);
105
+ const response = await this.request(requestOptions, initOverrides);
106
+
107
+ return new runtime.JSONApiResponse(response, (jsonValue) => MarketHistoryResponseFromJSON(jsonValue));
108
+ }
109
+
110
+ /**
111
+ * Returns GPU.ai\'s own price and obtainable capacity for one GPU model over a window, at 15-minute or daily resolution. Requires the `market:read` scope (or `full_access`). THE NULL CONTRACT. `price_per_gpu_hour` and `available_count` are nullable, and the two states are different facts that must not be collapsed: * a real `0` means we sampled that bucket and the market was sold out; * `null` means we did NOT sample that bucket — a failed poll, a skipped cycle, an incident on our side. It says nothing about supply. The response materializes the full bucket grid across the window, so a gap has visible width. Do not interpolate across a null: that asserts a continuity the data does not have, and reading one as a zero reports our own outages as supplier stockouts. PER-GPU NORMALIZATION. `price_per_gpu_hour` is always a per-GPU rate. When it was divided out of a whole-node price, `node_price_per_hour` and `gpu_count` are present and describe that derivation; they are absent for single-GPU capacity. A per-GPU figure presented without that context implies single-GPU rentability that whole-node capacity does not offer. WINDOW CAPS. `bucket=1d` is capped at 365 days (the retention window). `bucket=15m` is capped at 90 days when BOTH `region` and `capacity_class` are supplied, and at 31 days when either is omitted, because an unscoped 15-minute series scans every region and class in every bucket. An over-wide window is a 400 naming the cap and both escapes, never a silent truncation. This series carries no upstream supplier identity of any kind: the price is GPU.ai\'s own floor and the count is an aggregate.
112
+ * Get a GPU\'s price and availability over time
113
+ */
114
+ async getMarketHistory(requestParameters: GetMarketHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MarketHistoryResponse> {
115
+ const response = await this.getMarketHistoryRaw(requestParameters, initOverrides);
116
+ return await response.value();
117
+ }
118
+
119
+ }
120
+
121
+ /**
122
+ * @export
123
+ */
124
+ export const GetMarketHistoryCapacityClassEnum = {
125
+ Secure: 'secure',
126
+ Community: 'community'
127
+ } as const;
128
+ export type GetMarketHistoryCapacityClassEnum = typeof GetMarketHistoryCapacityClassEnum[keyof typeof GetMarketHistoryCapacityClassEnum];
129
+ /**
130
+ * @export
131
+ */
132
+ export const GetMarketHistoryBucketEnum = {
133
+ _15m: '15m',
134
+ _1d: '1d'
135
+ } as const;
136
+ export type GetMarketHistoryBucketEnum = typeof GetMarketHistoryBucketEnum[keyof typeof GetMarketHistoryBucketEnum];