@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.
- package/.openapi-generator/FILES +36 -0
- package/README.md +38 -9
- package/dist/apis/AutolaunchApi.d.ts +109 -0
- package/dist/apis/AutolaunchApi.js +286 -0
- package/dist/apis/InferenceApi.d.ts +19 -0
- package/dist/apis/InferenceApi.js +51 -0
- package/dist/apis/MarketApi.d.ts +56 -0
- package/dist/apis/MarketApi.js +112 -0
- package/dist/apis/WatchApi.d.ts +109 -0
- package/dist/apis/WatchApi.js +286 -0
- package/dist/apis/index.d.ts +3 -0
- package/dist/apis/index.js +3 -0
- package/dist/esm/apis/AutolaunchApi.d.ts +109 -0
- package/dist/esm/apis/AutolaunchApi.js +282 -0
- package/dist/esm/apis/InferenceApi.d.ts +19 -0
- package/dist/esm/apis/InferenceApi.js +51 -0
- package/dist/esm/apis/MarketApi.d.ts +56 -0
- package/dist/esm/apis/MarketApi.js +108 -0
- package/dist/esm/apis/WatchApi.d.ts +109 -0
- package/dist/esm/apis/WatchApi.js +282 -0
- package/dist/esm/apis/index.d.ts +3 -0
- package/dist/esm/apis/index.js +3 -0
- package/dist/esm/models/AutolaunchRule.d.ts +181 -0
- package/dist/esm/models/AutolaunchRule.js +142 -0
- package/dist/esm/models/AutolaunchRuleCreate.d.ts +105 -0
- package/dist/esm/models/AutolaunchRuleCreate.js +84 -0
- package/dist/esm/models/AutolaunchRuleDisarm.d.ts +34 -0
- package/dist/esm/models/AutolaunchRuleDisarm.js +43 -0
- package/dist/esm/models/AutolaunchRulePage.d.ts +39 -0
- package/dist/esm/models/AutolaunchRulePage.js +48 -0
- package/dist/esm/models/Embedding.d.ts +51 -0
- package/dist/esm/models/Embedding.js +59 -0
- package/dist/esm/models/EmbeddingsRequest.d.ts +64 -0
- package/dist/esm/models/EmbeddingsRequest.js +60 -0
- package/dist/esm/models/EmbeddingsRequestInput.d.ts +21 -0
- package/dist/esm/models/EmbeddingsRequestInput.js +47 -0
- package/dist/esm/models/EmbeddingsResponse.d.ts +59 -0
- package/dist/esm/models/EmbeddingsResponse.js +65 -0
- package/dist/esm/models/EmbeddingsUsage.d.ts +38 -0
- package/dist/esm/models/EmbeddingsUsage.js +47 -0
- package/dist/esm/models/MarketHistoryPoint.d.ts +59 -0
- package/dist/esm/models/MarketHistoryPoint.js +55 -0
- package/dist/esm/models/MarketHistoryResponse.d.ts +60 -0
- package/dist/esm/models/MarketHistoryResponse.js +60 -0
- package/dist/esm/models/Problem.d.ts +1 -0
- package/dist/esm/models/Problem.js +1 -0
- package/dist/esm/models/WatchRule.d.ts +141 -0
- package/dist/esm/models/WatchRule.js +117 -0
- package/dist/esm/models/WatchRuleCreate.d.ts +87 -0
- package/dist/esm/models/WatchRuleCreate.js +72 -0
- package/dist/esm/models/WatchRulePage.d.ts +39 -0
- package/dist/esm/models/WatchRulePage.js +48 -0
- package/dist/esm/models/WatchRuleUpdate.d.ts +86 -0
- package/dist/esm/models/WatchRuleUpdate.js +68 -0
- package/dist/esm/models/index.d.ts +15 -0
- package/dist/esm/models/index.js +15 -0
- package/dist/models/AutolaunchRule.d.ts +181 -0
- package/dist/models/AutolaunchRule.js +150 -0
- package/dist/models/AutolaunchRuleCreate.d.ts +105 -0
- package/dist/models/AutolaunchRuleCreate.js +92 -0
- package/dist/models/AutolaunchRuleDisarm.d.ts +34 -0
- package/dist/models/AutolaunchRuleDisarm.js +50 -0
- package/dist/models/AutolaunchRulePage.d.ts +39 -0
- package/dist/models/AutolaunchRulePage.js +55 -0
- package/dist/models/Embedding.d.ts +51 -0
- package/dist/models/Embedding.js +67 -0
- package/dist/models/EmbeddingsRequest.d.ts +64 -0
- package/dist/models/EmbeddingsRequest.js +68 -0
- package/dist/models/EmbeddingsRequestInput.d.ts +21 -0
- package/dist/models/EmbeddingsRequestInput.js +53 -0
- package/dist/models/EmbeddingsResponse.d.ts +59 -0
- package/dist/models/EmbeddingsResponse.js +73 -0
- package/dist/models/EmbeddingsUsage.d.ts +38 -0
- package/dist/models/EmbeddingsUsage.js +54 -0
- package/dist/models/MarketHistoryPoint.d.ts +59 -0
- package/dist/models/MarketHistoryPoint.js +62 -0
- package/dist/models/MarketHistoryResponse.d.ts +60 -0
- package/dist/models/MarketHistoryResponse.js +67 -0
- package/dist/models/Problem.d.ts +1 -0
- package/dist/models/Problem.js +1 -0
- package/dist/models/WatchRule.d.ts +141 -0
- package/dist/models/WatchRule.js +125 -0
- package/dist/models/WatchRuleCreate.d.ts +87 -0
- package/dist/models/WatchRuleCreate.js +80 -0
- package/dist/models/WatchRulePage.d.ts +39 -0
- package/dist/models/WatchRulePage.js +55 -0
- package/dist/models/WatchRuleUpdate.d.ts +86 -0
- package/dist/models/WatchRuleUpdate.js +76 -0
- package/dist/models/index.d.ts +15 -0
- package/dist/models/index.js +15 -0
- package/docs/AutolaunchApi.md +390 -0
- package/docs/AutolaunchRule.md +69 -0
- package/docs/AutolaunchRuleCreate.md +50 -0
- package/docs/AutolaunchRuleDisarm.md +35 -0
- package/docs/AutolaunchRulePage.md +36 -0
- package/docs/Embedding.md +38 -0
- package/docs/EmbeddingsRequest.md +42 -0
- package/docs/EmbeddingsRequestInput.md +33 -0
- package/docs/EmbeddingsResponse.md +40 -0
- package/docs/EmbeddingsUsage.md +37 -0
- package/docs/InferenceApi.md +83 -0
- package/docs/MarketApi.md +98 -0
- package/docs/MarketHistoryPoint.md +43 -0
- package/docs/MarketHistoryResponse.md +43 -0
- package/docs/WatchApi.md +389 -0
- package/docs/WatchRule.md +61 -0
- package/docs/WatchRuleCreate.md +46 -0
- package/docs/WatchRulePage.md +36 -0
- package/docs/WatchRuleUpdate.md +47 -0
- package/package.json +1 -1
- package/src/apis/AutolaunchApi.ts +360 -0
- package/src/apis/InferenceApi.ts +71 -0
- package/src/apis/MarketApi.ts +136 -0
- package/src/apis/WatchApi.ts +360 -0
- package/src/apis/index.ts +3 -0
- package/src/models/AutolaunchRule.ts +270 -0
- package/src/models/AutolaunchRuleCreate.ts +162 -0
- package/src/models/AutolaunchRuleDisarm.ts +68 -0
- package/src/models/AutolaunchRulePage.ts +83 -0
- package/src/models/Embedding.ts +96 -0
- package/src/models/EmbeddingsRequest.ts +117 -0
- package/src/models/EmbeddingsRequestInput.ts +59 -0
- package/src/models/EmbeddingsResponse.ts +120 -0
- package/src/models/EmbeddingsUsage.ts +75 -0
- package/src/models/MarketHistoryPoint.ts +103 -0
- package/src/models/MarketHistoryResponse.ts +113 -0
- package/src/models/Problem.ts +1 -0
- package/src/models/WatchRule.ts +219 -0
- package/src/models/WatchRuleCreate.ts +138 -0
- package/src/models/WatchRulePage.ts +83 -0
- package/src/models/WatchRuleUpdate.ts +135 -0
- package/src/models/index.ts +15 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
# EmbeddingsResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`object` | string
|
|
10
|
+
`data` | [Array<Embedding>](Embedding.md)
|
|
11
|
+
`model` | string
|
|
12
|
+
`usage` | [EmbeddingsUsage](EmbeddingsUsage.md)
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { EmbeddingsResponse } from '@gpuai/sdk'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"object": null,
|
|
22
|
+
"data": null,
|
|
23
|
+
"model": null,
|
|
24
|
+
"usage": null,
|
|
25
|
+
} satisfies EmbeddingsResponse
|
|
26
|
+
|
|
27
|
+
console.log(example)
|
|
28
|
+
|
|
29
|
+
// Convert the instance to a JSON string
|
|
30
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
31
|
+
console.log(exampleJSON)
|
|
32
|
+
|
|
33
|
+
// Parse the JSON string back to an object
|
|
34
|
+
const exampleParsed = JSON.parse(exampleJSON) as EmbeddingsResponse
|
|
35
|
+
console.log(exampleParsed)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
39
|
+
|
|
40
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
# EmbeddingsUsage
|
|
3
|
+
|
|
4
|
+
Embeddings are billed on input tokens only, so this block carries no completion_tokens field — an embeddings call emits none, and total_tokens always equals prompt_tokens.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`promptTokens` | number
|
|
11
|
+
`totalTokens` | number
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { EmbeddingsUsage } from '@gpuai/sdk'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"promptTokens": null,
|
|
21
|
+
"totalTokens": null,
|
|
22
|
+
} satisfies EmbeddingsUsage
|
|
23
|
+
|
|
24
|
+
console.log(example)
|
|
25
|
+
|
|
26
|
+
// Convert the instance to a JSON string
|
|
27
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
28
|
+
console.log(exampleJSON)
|
|
29
|
+
|
|
30
|
+
// Parse the JSON string back to an object
|
|
31
|
+
const exampleParsed = JSON.parse(exampleJSON) as EmbeddingsUsage
|
|
32
|
+
console.log(exampleParsed)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
36
|
+
|
|
37
|
+
|
package/docs/InferenceApi.md
CHANGED
|
@@ -6,6 +6,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
7
|
| [**cancelVideo**](InferenceApi.md#cancelvideo) | **POST** /videos/{id}/cancel | Cancel a video generation job |
|
|
8
8
|
| [**createChatCompletion**](InferenceApi.md#createchatcompletion) | **POST** /chat/completions | Create a chat completion (OpenAI-compatible) |
|
|
9
|
+
| [**createEmbeddings**](InferenceApi.md#createembeddings) | **POST** /embeddings | Create embeddings (OpenAI-compatible) |
|
|
9
10
|
| [**createImage**](InferenceApi.md#createimage) | **POST** /images/generations | Create image (OpenAI-compatible) |
|
|
10
11
|
| [**createVideo**](InferenceApi.md#createvideo) | **POST** /videos | Create a video generation job (async) |
|
|
11
12
|
| [**getModel**](InferenceApi.md#getmodel) | **GET** /models/{id} | Get a specific model (OpenAI-compatible) |
|
|
@@ -168,6 +169,88 @@ example().catch(console.error);
|
|
|
168
169
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
169
170
|
|
|
170
171
|
|
|
172
|
+
## createEmbeddings
|
|
173
|
+
|
|
174
|
+
> EmbeddingsResponse createEmbeddings(embeddingsRequest)
|
|
175
|
+
|
|
176
|
+
Create embeddings (OpenAI-compatible)
|
|
177
|
+
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
### Example
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
import {
|
|
184
|
+
Configuration,
|
|
185
|
+
InferenceApi,
|
|
186
|
+
} from '@gpuai/sdk';
|
|
187
|
+
import type { CreateEmbeddingsRequest } from '@gpuai/sdk';
|
|
188
|
+
|
|
189
|
+
async function example() {
|
|
190
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
191
|
+
const config = new Configuration({
|
|
192
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
193
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
194
|
+
});
|
|
195
|
+
const api = new InferenceApi(config);
|
|
196
|
+
|
|
197
|
+
const body = {
|
|
198
|
+
// EmbeddingsRequest
|
|
199
|
+
embeddingsRequest: ...,
|
|
200
|
+
} satisfies CreateEmbeddingsRequest;
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
const data = await api.createEmbeddings(body);
|
|
204
|
+
console.log(data);
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error(error);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Run the test
|
|
211
|
+
example().catch(console.error);
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Parameters
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
| Name | Type | Description | Notes |
|
|
218
|
+
|------------- | ------------- | ------------- | -------------|
|
|
219
|
+
| **embeddingsRequest** | [EmbeddingsRequest](EmbeddingsRequest.md) | | |
|
|
220
|
+
|
|
221
|
+
### Return type
|
|
222
|
+
|
|
223
|
+
[**EmbeddingsResponse**](EmbeddingsResponse.md)
|
|
224
|
+
|
|
225
|
+
### Authorization
|
|
226
|
+
|
|
227
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
228
|
+
|
|
229
|
+
### HTTP request headers
|
|
230
|
+
|
|
231
|
+
- **Content-Type**: `application/json`
|
|
232
|
+
- **Accept**: `application/json`
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
### HTTP response details
|
|
236
|
+
| Status code | Description | Response headers |
|
|
237
|
+
|-------------|-------------|------------------|
|
|
238
|
+
| **200** | One embedding vector per input, in request order. | - |
|
|
239
|
+
| **400** | Invalid request (OpenAI error envelope). | - |
|
|
240
|
+
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
241
|
+
| **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
|
|
242
|
+
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
243
|
+
| **404** | Model or resource not found (OpenAI error envelope). | - |
|
|
244
|
+
| **413** | Request body too large (OpenAI error envelope, code request_too_large). | - |
|
|
245
|
+
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
246
|
+
| **500** | Internal server error (OpenAI error envelope). | - |
|
|
247
|
+
| **502** | The upstream answered but its response could not be used (OpenAI error envelope): code upstream_response_too_large when the vector payload exceeded the per-request size limit, or upstream_error for a malformed / misaligned response. Not retryable as-is for upstream_response_too_large — send fewer inputs. | - |
|
|
248
|
+
| **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
249
|
+
| **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | - |
|
|
250
|
+
|
|
251
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
252
|
+
|
|
253
|
+
|
|
171
254
|
## createImage
|
|
172
255
|
|
|
173
256
|
> ImagesResponse createImage(imagesGenerationsRequest, idempotencyKey)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# MarketApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.gpu.ai/v1*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
|------------- | ------------- | -------------|
|
|
7
|
+
| [**getMarketHistory**](MarketApi.md#getmarkethistory) | **GET** /market-history | Get a GPU\'s price and availability over time |
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## getMarketHistory
|
|
12
|
+
|
|
13
|
+
> MarketHistoryResponse getMarketHistory(gpuModel, region, capacityClass, bucket, from, to)
|
|
14
|
+
|
|
15
|
+
Get a GPU\'s price and availability over time
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
### Example
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
Configuration,
|
|
24
|
+
MarketApi,
|
|
25
|
+
} from '@gpuai/sdk';
|
|
26
|
+
import type { GetMarketHistoryRequest } from '@gpuai/sdk';
|
|
27
|
+
|
|
28
|
+
async function example() {
|
|
29
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
30
|
+
const config = new Configuration({
|
|
31
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
32
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
33
|
+
});
|
|
34
|
+
const api = new MarketApi(config);
|
|
35
|
+
|
|
36
|
+
const body = {
|
|
37
|
+
// string | GPU model to chart, e.g. \"H100\". Required — it is the leading column of the lookup index.
|
|
38
|
+
gpuModel: gpuModel_example,
|
|
39
|
+
// string | Canonical region to narrow the series to. Omit to MERGE every region rather than to filter on the empty string. (optional)
|
|
40
|
+
region: region_example,
|
|
41
|
+
// 'secure' | 'community' | Capacity class to narrow the series to. Omit to merge both. (optional)
|
|
42
|
+
capacityClass: capacityClass_example,
|
|
43
|
+
// '15m' | '1d' | Resolution. Only these two values are accepted: the series cannot be returned finer than it was stored. (optional)
|
|
44
|
+
bucket: bucket_example,
|
|
45
|
+
// Date | Start of the window (RFC3339). Defaults to 7 days before `to`. (optional)
|
|
46
|
+
from: 2013-10-20T19:20:30+01:00,
|
|
47
|
+
// Date | End of the window (RFC3339). Defaults to now; a future value is clamped to now, since no bucket can exist for a time that has not happened. (optional)
|
|
48
|
+
to: 2013-10-20T19:20:30+01:00,
|
|
49
|
+
} satisfies GetMarketHistoryRequest;
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const data = await api.getMarketHistory(body);
|
|
53
|
+
console.log(data);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Run the test
|
|
60
|
+
example().catch(console.error);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Parameters
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
| Name | Type | Description | Notes |
|
|
67
|
+
|------------- | ------------- | ------------- | -------------|
|
|
68
|
+
| **gpuModel** | `string` | GPU model to chart, e.g. \"H100\". Required — it is the leading column of the lookup index. | [Defaults to `undefined`] |
|
|
69
|
+
| **region** | `string` | Canonical region to narrow the series to. Omit to MERGE every region rather than to filter on the empty string. | [Optional] [Defaults to `undefined`] |
|
|
70
|
+
| **capacityClass** | `secure`, `community` | Capacity class to narrow the series to. Omit to merge both. | [Optional] [Defaults to `undefined`] [Enum: secure, community] |
|
|
71
|
+
| **bucket** | `15m`, `1d` | Resolution. Only these two values are accepted: the series cannot be returned finer than it was stored. | [Optional] [Defaults to `'15m'`] [Enum: 15m, 1d] |
|
|
72
|
+
| **from** | `Date` | Start of the window (RFC3339). Defaults to 7 days before `to`. | [Optional] [Defaults to `undefined`] |
|
|
73
|
+
| **to** | `Date` | End of the window (RFC3339). Defaults to now; a future value is clamped to now, since no bucket can exist for a time that has not happened. | [Optional] [Defaults to `undefined`] |
|
|
74
|
+
|
|
75
|
+
### Return type
|
|
76
|
+
|
|
77
|
+
[**MarketHistoryResponse**](MarketHistoryResponse.md)
|
|
78
|
+
|
|
79
|
+
### Authorization
|
|
80
|
+
|
|
81
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
82
|
+
|
|
83
|
+
### HTTP request headers
|
|
84
|
+
|
|
85
|
+
- **Content-Type**: Not defined
|
|
86
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### HTTP response details
|
|
90
|
+
| Status code | Description | Response headers |
|
|
91
|
+
|-------------|-------------|------------------|
|
|
92
|
+
| **200** | OK | - |
|
|
93
|
+
| **400** | Validation failed — a missing `gpu_model`, a non-canonical region, an unknown `capacity_class` or `bucket`, a non-RFC3339 timestamp, a `from` that is not before `to`, or a window wider than the cap for the requested resolution and scope. The detail names the cap and both ways to stay under it. | - |
|
|
94
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
95
|
+
| **0** | Error response (RFC 7807) | - |
|
|
96
|
+
|
|
97
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
98
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
# MarketHistoryPoint
|
|
3
|
+
|
|
4
|
+
One bucket of a price/stock series. The nullability of `price_per_gpu_hour` and `available_count` is the contract, not a convenience: a real 0 is a bucket we sampled and found sold out, and null is a bucket we never successfully sampled. A client that coerces null to 0 will report GPU.ai\'s own polling outages as supplier stockouts, and must not interpolate across a null.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`bucketTs` | Date
|
|
11
|
+
`pricePerGpuHour` | number
|
|
12
|
+
`availableCount` | number
|
|
13
|
+
`nodePricePerHour` | number
|
|
14
|
+
`gpuCount` | number
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import type { MarketHistoryPoint } from '@gpuai/sdk'
|
|
20
|
+
|
|
21
|
+
// TODO: Update the object below with actual values
|
|
22
|
+
const example = {
|
|
23
|
+
"bucketTs": null,
|
|
24
|
+
"pricePerGpuHour": null,
|
|
25
|
+
"availableCount": null,
|
|
26
|
+
"nodePricePerHour": null,
|
|
27
|
+
"gpuCount": null,
|
|
28
|
+
} satisfies MarketHistoryPoint
|
|
29
|
+
|
|
30
|
+
console.log(example)
|
|
31
|
+
|
|
32
|
+
// Convert the instance to a JSON string
|
|
33
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
34
|
+
console.log(exampleJSON)
|
|
35
|
+
|
|
36
|
+
// Parse the JSON string back to an object
|
|
37
|
+
const exampleParsed = JSON.parse(exampleJSON) as MarketHistoryPoint
|
|
38
|
+
console.log(exampleParsed)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
42
|
+
|
|
43
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
# MarketHistoryResponse
|
|
3
|
+
|
|
4
|
+
A price/stock series for one (gpu_model, region, capacity_class) key. Points cover the FULL bucket grid across the requested window, including the buckets we did not sample — a gap therefore has visible width rather than disappearing between two adjacent points.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`gpuModel` | string
|
|
11
|
+
`region` | string
|
|
12
|
+
`capacityClass` | string
|
|
13
|
+
`bucketSeconds` | number
|
|
14
|
+
`points` | [Array<MarketHistoryPoint>](MarketHistoryPoint.md)
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import type { MarketHistoryResponse } from '@gpuai/sdk'
|
|
20
|
+
|
|
21
|
+
// TODO: Update the object below with actual values
|
|
22
|
+
const example = {
|
|
23
|
+
"gpuModel": null,
|
|
24
|
+
"region": null,
|
|
25
|
+
"capacityClass": null,
|
|
26
|
+
"bucketSeconds": null,
|
|
27
|
+
"points": null,
|
|
28
|
+
} satisfies MarketHistoryResponse
|
|
29
|
+
|
|
30
|
+
console.log(example)
|
|
31
|
+
|
|
32
|
+
// Convert the instance to a JSON string
|
|
33
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
34
|
+
console.log(exampleJSON)
|
|
35
|
+
|
|
36
|
+
// Parse the JSON string back to an object
|
|
37
|
+
const exampleParsed = JSON.parse(exampleJSON) as MarketHistoryResponse
|
|
38
|
+
console.log(exampleParsed)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
42
|
+
|
|
43
|
+
|