@gpuai/sdk 0.3.13 → 0.3.15
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 +28 -0
- package/README.md +34 -9
- package/dist/apis/AutolaunchApi.d.ts +109 -0
- package/dist/apis/AutolaunchApi.js +286 -0
- package/dist/apis/BillingApi.d.ts +15 -0
- package/dist/apis/BillingApi.js +45 -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/BillingApi.d.ts +15 -0
- package/dist/esm/apis/BillingApi.js +45 -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/Balance.d.ts +65 -0
- package/dist/esm/models/Balance.js +63 -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 +11 -0
- package/dist/esm/models/index.js +11 -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/Balance.d.ts +65 -0
- package/dist/models/Balance.js +70 -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 +11 -0
- package/dist/models/index.js +11 -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/Balance.md +45 -0
- package/docs/BillingApi.md +66 -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/BillingApi.ts +52 -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/Balance.ts +114 -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 +11 -0
package/docs/BillingApi.md
CHANGED
|
@@ -5,6 +5,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
5
5
|
| Method | HTTP request | Description |
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
7
|
| [**createCryptoDeposit**](BillingApi.md#createcryptodepositoperation) | **POST** /billing/deposits/crypto | Create a stablecoin deposit |
|
|
8
|
+
| [**getBalance**](BillingApi.md#getbalance) | **GET** /billing/balance | Get the org credit balance |
|
|
8
9
|
| [**getDeposit**](BillingApi.md#getdeposit) | **GET** /billing/deposits/{id} | Get one stablecoin deposit |
|
|
9
10
|
| [**getSpendingLimit**](BillingApi.md#getspendinglimit) | **GET** /billing/spending-limit | Get the org spending limit |
|
|
10
11
|
| [**listDeposits**](BillingApi.md#listdeposits) | **GET** /billing/deposits | List stablecoin deposits |
|
|
@@ -89,6 +90,71 @@ example().catch(console.error);
|
|
|
89
90
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
90
91
|
|
|
91
92
|
|
|
93
|
+
## getBalance
|
|
94
|
+
|
|
95
|
+
> Balance getBalance()
|
|
96
|
+
|
|
97
|
+
Get the org credit balance
|
|
98
|
+
|
|
99
|
+
Returns the organization\'s credit balance, its auto-pay configuration, and the live burn rate. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. Divide `balance_cents` by `burn_cents_per_hour` for the remaining runway in hours. The quotient is undefined in three cases a caller must keep apart: `burn_cents_per_hour` is 0 (nothing running, so the balance funds unbounded idle time), it is `null` (the burn rate could not be determined — NOT the same as idle), or the balance is already at or below zero. This is the balance itself — for spend against a configured cap see `/billing/spending-limit`, and for past consumption see `/usage`.
|
|
100
|
+
|
|
101
|
+
### Example
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import {
|
|
105
|
+
Configuration,
|
|
106
|
+
BillingApi,
|
|
107
|
+
} from '@gpuai/sdk';
|
|
108
|
+
import type { GetBalanceRequest } from '@gpuai/sdk';
|
|
109
|
+
|
|
110
|
+
async function example() {
|
|
111
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
112
|
+
const config = new Configuration({
|
|
113
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
114
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
115
|
+
});
|
|
116
|
+
const api = new BillingApi(config);
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
const data = await api.getBalance();
|
|
120
|
+
console.log(data);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(error);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Run the test
|
|
127
|
+
example().catch(console.error);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Parameters
|
|
131
|
+
|
|
132
|
+
This endpoint does not need any parameter.
|
|
133
|
+
|
|
134
|
+
### Return type
|
|
135
|
+
|
|
136
|
+
[**Balance**](Balance.md)
|
|
137
|
+
|
|
138
|
+
### Authorization
|
|
139
|
+
|
|
140
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
141
|
+
|
|
142
|
+
### HTTP request headers
|
|
143
|
+
|
|
144
|
+
- **Content-Type**: Not defined
|
|
145
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### HTTP response details
|
|
149
|
+
| Status code | Description | Response headers |
|
|
150
|
+
|-------------|-------------|------------------|
|
|
151
|
+
| **200** | OK | - |
|
|
152
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
153
|
+
| **0** | Error response (RFC 7807) | - |
|
|
154
|
+
|
|
155
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
156
|
+
|
|
157
|
+
|
|
92
158
|
## getDeposit
|
|
93
159
|
|
|
94
160
|
> CryptoDeposit getDeposit(id)
|
|
@@ -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
|
+
|
package/docs/WatchApi.md
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# WatchApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *https://api.gpu.ai/v1*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
|------------- | ------------- | -------------|
|
|
7
|
+
| [**createWatchRule**](WatchApi.md#createwatchrule) | **POST** /watch-rules | Create a watch rule |
|
|
8
|
+
| [**deleteWatchRule**](WatchApi.md#deletewatchrule) | **DELETE** /watch-rules/{id} | Delete a watch rule |
|
|
9
|
+
| [**getWatchRule**](WatchApi.md#getwatchrule) | **GET** /watch-rules/{id} | Get a watch rule |
|
|
10
|
+
| [**listWatchRules**](WatchApi.md#listwatchrules) | **GET** /watch-rules | List watch rules |
|
|
11
|
+
| [**updateWatchRule**](WatchApi.md#updatewatchrule) | **PATCH** /watch-rules/{id} | Update a watch rule |
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## createWatchRule
|
|
16
|
+
|
|
17
|
+
> WatchRule createWatchRule(watchRuleCreate, idempotencyKey)
|
|
18
|
+
|
|
19
|
+
Create a watch rule
|
|
20
|
+
|
|
21
|
+
Creates a rule that notifies you when the market moves on a GPU model. Requires the `watch:write` scope (or `full_access`). A watch rule ONLY notifies. It cannot launch capacity and cannot spend money: there is no field on this resource that provisions anything. Automatic launching is a separate resource with its own spend-consent gate. Targeting is dimensional — a GPU model plus optional canonical region and capacity class. It is deliberately NOT possible to pin a rule to a specific catalog listing: listing identity is unstable, so a pinned rule can silently match nothing and never fire. Delivery is to the organization\'s registered webhook endpoints, plus an email to the rule\'s creator. `webhook_endpoint_override_id` routes one rule to one specific endpoint and is the id of an endpoint already registered via `/webhook-endpoints` — the resource accepts no URL of any kind. Organizations are limited to 50 ENABLED rules; the 422 names the limit.
|
|
22
|
+
|
|
23
|
+
### Example
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import {
|
|
27
|
+
Configuration,
|
|
28
|
+
WatchApi,
|
|
29
|
+
} from '@gpuai/sdk';
|
|
30
|
+
import type { CreateWatchRuleRequest } from '@gpuai/sdk';
|
|
31
|
+
|
|
32
|
+
async function example() {
|
|
33
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
34
|
+
const config = new Configuration({
|
|
35
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
36
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
37
|
+
});
|
|
38
|
+
const api = new WatchApi(config);
|
|
39
|
+
|
|
40
|
+
const body = {
|
|
41
|
+
// WatchRuleCreate
|
|
42
|
+
watchRuleCreate: ...,
|
|
43
|
+
// string (optional)
|
|
44
|
+
idempotencyKey: idempotencyKey_example,
|
|
45
|
+
} satisfies CreateWatchRuleRequest;
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const data = await api.createWatchRule(body);
|
|
49
|
+
console.log(data);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.error(error);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Run the test
|
|
56
|
+
example().catch(console.error);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Parameters
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
| Name | Type | Description | Notes |
|
|
63
|
+
|------------- | ------------- | ------------- | -------------|
|
|
64
|
+
| **watchRuleCreate** | [WatchRuleCreate](WatchRuleCreate.md) | | |
|
|
65
|
+
| **idempotencyKey** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
66
|
+
|
|
67
|
+
### Return type
|
|
68
|
+
|
|
69
|
+
[**WatchRule**](WatchRule.md)
|
|
70
|
+
|
|
71
|
+
### Authorization
|
|
72
|
+
|
|
73
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
74
|
+
|
|
75
|
+
### HTTP request headers
|
|
76
|
+
|
|
77
|
+
- **Content-Type**: `application/json`
|
|
78
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### HTTP response details
|
|
82
|
+
| Status code | Description | Response headers |
|
|
83
|
+
|-------------|-------------|------------------|
|
|
84
|
+
| **201** | Created | - |
|
|
85
|
+
| **422** | Validation failed — an unknown condition kind, a non-canonical region, a missing threshold on a threshold condition, an override id that is not an endpoint registered by this organization, a field naming a catalog listing or a delivery address, or the enabled-rule limit already reached. | - |
|
|
86
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
87
|
+
| **0** | Error response (RFC 7807) | - |
|
|
88
|
+
|
|
89
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## deleteWatchRule
|
|
93
|
+
|
|
94
|
+
> deleteWatchRule(id)
|
|
95
|
+
|
|
96
|
+
Delete a watch rule
|
|
97
|
+
|
|
98
|
+
Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
|
|
99
|
+
|
|
100
|
+
### Example
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import {
|
|
104
|
+
Configuration,
|
|
105
|
+
WatchApi,
|
|
106
|
+
} from '@gpuai/sdk';
|
|
107
|
+
import type { DeleteWatchRuleRequest } from '@gpuai/sdk';
|
|
108
|
+
|
|
109
|
+
async function example() {
|
|
110
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
111
|
+
const config = new Configuration({
|
|
112
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
113
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
114
|
+
});
|
|
115
|
+
const api = new WatchApi(config);
|
|
116
|
+
|
|
117
|
+
const body = {
|
|
118
|
+
// string
|
|
119
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
120
|
+
} satisfies DeleteWatchRuleRequest;
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
const data = await api.deleteWatchRule(body);
|
|
124
|
+
console.log(data);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Run the test
|
|
131
|
+
example().catch(console.error);
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Parameters
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
| Name | Type | Description | Notes |
|
|
138
|
+
|------------- | ------------- | ------------- | -------------|
|
|
139
|
+
| **id** | `string` | | [Defaults to `undefined`] |
|
|
140
|
+
|
|
141
|
+
### Return type
|
|
142
|
+
|
|
143
|
+
`void` (Empty response body)
|
|
144
|
+
|
|
145
|
+
### Authorization
|
|
146
|
+
|
|
147
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
148
|
+
|
|
149
|
+
### HTTP request headers
|
|
150
|
+
|
|
151
|
+
- **Content-Type**: Not defined
|
|
152
|
+
- **Accept**: `application/problem+json`
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
### HTTP response details
|
|
156
|
+
| Status code | Description | Response headers |
|
|
157
|
+
|-------------|-------------|------------------|
|
|
158
|
+
| **204** | Deleted | - |
|
|
159
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
160
|
+
| **0** | Error response (RFC 7807) | - |
|
|
161
|
+
|
|
162
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
## getWatchRule
|
|
166
|
+
|
|
167
|
+
> WatchRule getWatchRule(id)
|
|
168
|
+
|
|
169
|
+
Get a watch rule
|
|
170
|
+
|
|
171
|
+
Fetches one watch rule. Requires the `watch:read` scope (or `full_access`). A rule belonging to another organization returns 404 — the same answer as an id that does not exist.
|
|
172
|
+
|
|
173
|
+
### Example
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
import {
|
|
177
|
+
Configuration,
|
|
178
|
+
WatchApi,
|
|
179
|
+
} from '@gpuai/sdk';
|
|
180
|
+
import type { GetWatchRuleRequest } from '@gpuai/sdk';
|
|
181
|
+
|
|
182
|
+
async function example() {
|
|
183
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
184
|
+
const config = new Configuration({
|
|
185
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
186
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
187
|
+
});
|
|
188
|
+
const api = new WatchApi(config);
|
|
189
|
+
|
|
190
|
+
const body = {
|
|
191
|
+
// string
|
|
192
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
193
|
+
} satisfies GetWatchRuleRequest;
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
const data = await api.getWatchRule(body);
|
|
197
|
+
console.log(data);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error(error);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Run the test
|
|
204
|
+
example().catch(console.error);
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Parameters
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
| Name | Type | Description | Notes |
|
|
211
|
+
|------------- | ------------- | ------------- | -------------|
|
|
212
|
+
| **id** | `string` | | [Defaults to `undefined`] |
|
|
213
|
+
|
|
214
|
+
### Return type
|
|
215
|
+
|
|
216
|
+
[**WatchRule**](WatchRule.md)
|
|
217
|
+
|
|
218
|
+
### Authorization
|
|
219
|
+
|
|
220
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
221
|
+
|
|
222
|
+
### HTTP request headers
|
|
223
|
+
|
|
224
|
+
- **Content-Type**: Not defined
|
|
225
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
### HTTP response details
|
|
229
|
+
| Status code | Description | Response headers |
|
|
230
|
+
|-------------|-------------|------------------|
|
|
231
|
+
| **200** | OK | - |
|
|
232
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
233
|
+
| **0** | Error response (RFC 7807) | - |
|
|
234
|
+
|
|
235
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## listWatchRules
|
|
239
|
+
|
|
240
|
+
> WatchRulePage listWatchRules(cursor, limit)
|
|
241
|
+
|
|
242
|
+
List watch rules
|
|
243
|
+
|
|
244
|
+
Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
|
|
245
|
+
|
|
246
|
+
### Example
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
import {
|
|
250
|
+
Configuration,
|
|
251
|
+
WatchApi,
|
|
252
|
+
} from '@gpuai/sdk';
|
|
253
|
+
import type { ListWatchRulesRequest } from '@gpuai/sdk';
|
|
254
|
+
|
|
255
|
+
async function example() {
|
|
256
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
257
|
+
const config = new Configuration({
|
|
258
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
259
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
260
|
+
});
|
|
261
|
+
const api = new WatchApi(config);
|
|
262
|
+
|
|
263
|
+
const body = {
|
|
264
|
+
// string (optional)
|
|
265
|
+
cursor: cursor_example,
|
|
266
|
+
// number (optional)
|
|
267
|
+
limit: 56,
|
|
268
|
+
} satisfies ListWatchRulesRequest;
|
|
269
|
+
|
|
270
|
+
try {
|
|
271
|
+
const data = await api.listWatchRules(body);
|
|
272
|
+
console.log(data);
|
|
273
|
+
} catch (error) {
|
|
274
|
+
console.error(error);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Run the test
|
|
279
|
+
example().catch(console.error);
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Parameters
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
| Name | Type | Description | Notes |
|
|
286
|
+
|------------- | ------------- | ------------- | -------------|
|
|
287
|
+
| **cursor** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
288
|
+
| **limit** | `number` | | [Optional] [Defaults to `50`] |
|
|
289
|
+
|
|
290
|
+
### Return type
|
|
291
|
+
|
|
292
|
+
[**WatchRulePage**](WatchRulePage.md)
|
|
293
|
+
|
|
294
|
+
### Authorization
|
|
295
|
+
|
|
296
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
297
|
+
|
|
298
|
+
### HTTP request headers
|
|
299
|
+
|
|
300
|
+
- **Content-Type**: Not defined
|
|
301
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
### HTTP response details
|
|
305
|
+
| Status code | Description | Response headers |
|
|
306
|
+
|-------------|-------------|------------------|
|
|
307
|
+
| **200** | OK | - |
|
|
308
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
309
|
+
| **0** | Error response (RFC 7807) | - |
|
|
310
|
+
|
|
311
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
## updateWatchRule
|
|
315
|
+
|
|
316
|
+
> WatchRule updateWatchRule(id, watchRuleUpdate)
|
|
317
|
+
|
|
318
|
+
Update a watch rule
|
|
319
|
+
|
|
320
|
+
Partially updates a watch rule. Requires the `watch:write` scope (or `full_access`). An ABSENT key keeps the stored value; an explicit `null` on `region`, `capacity_class` or `webhook_endpoint_override_id` CLEARS it back to \"any\" / \"organization default\". The two are distinguished by which keys the body carries, so send only the keys you mean to change. Editing a rule RE-ARMS it: the fired latch describes the condition that was replaced, so carrying it across an edit would suppress the first alert on the new one.
|
|
321
|
+
|
|
322
|
+
### Example
|
|
323
|
+
|
|
324
|
+
```ts
|
|
325
|
+
import {
|
|
326
|
+
Configuration,
|
|
327
|
+
WatchApi,
|
|
328
|
+
} from '@gpuai/sdk';
|
|
329
|
+
import type { UpdateWatchRuleRequest } from '@gpuai/sdk';
|
|
330
|
+
|
|
331
|
+
async function example() {
|
|
332
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
333
|
+
const config = new Configuration({
|
|
334
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
335
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
336
|
+
});
|
|
337
|
+
const api = new WatchApi(config);
|
|
338
|
+
|
|
339
|
+
const body = {
|
|
340
|
+
// string
|
|
341
|
+
id: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
342
|
+
// WatchRuleUpdate
|
|
343
|
+
watchRuleUpdate: ...,
|
|
344
|
+
} satisfies UpdateWatchRuleRequest;
|
|
345
|
+
|
|
346
|
+
try {
|
|
347
|
+
const data = await api.updateWatchRule(body);
|
|
348
|
+
console.log(data);
|
|
349
|
+
} catch (error) {
|
|
350
|
+
console.error(error);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Run the test
|
|
355
|
+
example().catch(console.error);
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Parameters
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
| Name | Type | Description | Notes |
|
|
362
|
+
|------------- | ------------- | ------------- | -------------|
|
|
363
|
+
| **id** | `string` | | [Defaults to `undefined`] |
|
|
364
|
+
| **watchRuleUpdate** | [WatchRuleUpdate](WatchRuleUpdate.md) | | |
|
|
365
|
+
|
|
366
|
+
### Return type
|
|
367
|
+
|
|
368
|
+
[**WatchRule**](WatchRule.md)
|
|
369
|
+
|
|
370
|
+
### Authorization
|
|
371
|
+
|
|
372
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
373
|
+
|
|
374
|
+
### HTTP request headers
|
|
375
|
+
|
|
376
|
+
- **Content-Type**: `application/json`
|
|
377
|
+
- **Accept**: `application/json`, `application/problem+json`
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
### HTTP response details
|
|
381
|
+
| Status code | Description | Response headers |
|
|
382
|
+
|-------------|-------------|------------------|
|
|
383
|
+
| **200** | OK | - |
|
|
384
|
+
| **422** | Validation failed against the MERGED rule — for example switching to a threshold condition on a rule that has no stored threshold. | - |
|
|
385
|
+
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
386
|
+
| **0** | Error response (RFC 7807) | - |
|
|
387
|
+
|
|
388
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
389
|
+
|