@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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
# WatchRule
|
|
3
|
+
|
|
4
|
+
A rule that notifies when the market moves on a GPU model. It carries no upstream supplier identity of any kind, and no delivery address — those are properties of the resource, not of a particular response.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`id` | string
|
|
11
|
+
`gpuModel` | string
|
|
12
|
+
`region` | string
|
|
13
|
+
`capacityClass` | string
|
|
14
|
+
`conditionKind` | string
|
|
15
|
+
`threshold` | number
|
|
16
|
+
`state` | string
|
|
17
|
+
`lastFiredAt` | Date
|
|
18
|
+
`quietUntil` | Date
|
|
19
|
+
`webhookEndpointOverrideId` | string
|
|
20
|
+
`enabled` | boolean
|
|
21
|
+
`deactivatedReason` | string
|
|
22
|
+
`createdAt` | Date
|
|
23
|
+
`updatedAt` | Date
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import type { WatchRule } from '@gpuai/sdk'
|
|
29
|
+
|
|
30
|
+
// TODO: Update the object below with actual values
|
|
31
|
+
const example = {
|
|
32
|
+
"id": null,
|
|
33
|
+
"gpuModel": null,
|
|
34
|
+
"region": null,
|
|
35
|
+
"capacityClass": null,
|
|
36
|
+
"conditionKind": null,
|
|
37
|
+
"threshold": null,
|
|
38
|
+
"state": null,
|
|
39
|
+
"lastFiredAt": null,
|
|
40
|
+
"quietUntil": null,
|
|
41
|
+
"webhookEndpointOverrideId": null,
|
|
42
|
+
"enabled": null,
|
|
43
|
+
"deactivatedReason": null,
|
|
44
|
+
"createdAt": null,
|
|
45
|
+
"updatedAt": null,
|
|
46
|
+
} satisfies WatchRule
|
|
47
|
+
|
|
48
|
+
console.log(example)
|
|
49
|
+
|
|
50
|
+
// Convert the instance to a JSON string
|
|
51
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
52
|
+
console.log(exampleJSON)
|
|
53
|
+
|
|
54
|
+
// Parse the JSON string back to an object
|
|
55
|
+
const exampleParsed = JSON.parse(exampleJSON) as WatchRule
|
|
56
|
+
console.log(exampleParsed)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
60
|
+
|
|
61
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
# WatchRuleCreate
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`gpuModel` | string
|
|
10
|
+
`region` | string
|
|
11
|
+
`capacityClass` | string
|
|
12
|
+
`conditionKind` | string
|
|
13
|
+
`threshold` | number
|
|
14
|
+
`webhookEndpointOverrideId` | string
|
|
15
|
+
`enabled` | boolean
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type { WatchRuleCreate } from '@gpuai/sdk'
|
|
21
|
+
|
|
22
|
+
// TODO: Update the object below with actual values
|
|
23
|
+
const example = {
|
|
24
|
+
"gpuModel": null,
|
|
25
|
+
"region": null,
|
|
26
|
+
"capacityClass": null,
|
|
27
|
+
"conditionKind": null,
|
|
28
|
+
"threshold": null,
|
|
29
|
+
"webhookEndpointOverrideId": null,
|
|
30
|
+
"enabled": null,
|
|
31
|
+
} satisfies WatchRuleCreate
|
|
32
|
+
|
|
33
|
+
console.log(example)
|
|
34
|
+
|
|
35
|
+
// Convert the instance to a JSON string
|
|
36
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
37
|
+
console.log(exampleJSON)
|
|
38
|
+
|
|
39
|
+
// Parse the JSON string back to an object
|
|
40
|
+
const exampleParsed = JSON.parse(exampleJSON) as WatchRuleCreate
|
|
41
|
+
console.log(exampleParsed)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# WatchRulePage
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`data` | [Array<WatchRule>](WatchRule.md)
|
|
10
|
+
`nextCursor` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { WatchRulePage } from '@gpuai/sdk'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"data": null,
|
|
20
|
+
"nextCursor": null,
|
|
21
|
+
} satisfies WatchRulePage
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as WatchRulePage
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
# WatchRuleUpdate
|
|
3
|
+
|
|
4
|
+
Partial update. An absent key keeps the stored value; an explicit null on region, capacity_class or webhook_endpoint_override_id clears it. The merged rule is re-validated as a whole.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`gpuModel` | string
|
|
11
|
+
`region` | string
|
|
12
|
+
`capacityClass` | string
|
|
13
|
+
`conditionKind` | string
|
|
14
|
+
`threshold` | number
|
|
15
|
+
`webhookEndpointOverrideId` | string
|
|
16
|
+
`enabled` | boolean
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import type { WatchRuleUpdate } from '@gpuai/sdk'
|
|
22
|
+
|
|
23
|
+
// TODO: Update the object below with actual values
|
|
24
|
+
const example = {
|
|
25
|
+
"gpuModel": null,
|
|
26
|
+
"region": null,
|
|
27
|
+
"capacityClass": null,
|
|
28
|
+
"conditionKind": null,
|
|
29
|
+
"threshold": null,
|
|
30
|
+
"webhookEndpointOverrideId": null,
|
|
31
|
+
"enabled": null,
|
|
32
|
+
} satisfies WatchRuleUpdate
|
|
33
|
+
|
|
34
|
+
console.log(example)
|
|
35
|
+
|
|
36
|
+
// Convert the instance to a JSON string
|
|
37
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
38
|
+
console.log(exampleJSON)
|
|
39
|
+
|
|
40
|
+
// Parse the JSON string back to an object
|
|
41
|
+
const exampleParsed = JSON.parse(exampleJSON) as WatchRuleUpdate
|
|
42
|
+
console.log(exampleParsed)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
46
|
+
|
|
47
|
+
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|
package/src/apis/BillingApi.ts
CHANGED
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import * as runtime from '../runtime';
|
|
16
|
+
import {
|
|
17
|
+
type Balance,
|
|
18
|
+
BalanceFromJSON,
|
|
19
|
+
BalanceToJSON,
|
|
20
|
+
} from '../models/Balance';
|
|
16
21
|
import {
|
|
17
22
|
type CreateCryptoDepositRequest,
|
|
18
23
|
CreateCryptoDepositRequestFromJSON,
|
|
@@ -118,6 +123,53 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
118
123
|
return await response.value();
|
|
119
124
|
}
|
|
120
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Creates request options for getBalance without sending the request
|
|
128
|
+
*/
|
|
129
|
+
async getBalanceRequestOpts(): Promise<runtime.RequestOpts> {
|
|
130
|
+
const queryParameters: any = {};
|
|
131
|
+
|
|
132
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
133
|
+
|
|
134
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
135
|
+
const token = this.configuration.accessToken;
|
|
136
|
+
const tokenString = await token("bearerAuth", []);
|
|
137
|
+
|
|
138
|
+
if (tokenString) {
|
|
139
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let urlPath = `/billing/balance`;
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
path: urlPath,
|
|
147
|
+
method: 'GET',
|
|
148
|
+
headers: headerParameters,
|
|
149
|
+
query: queryParameters,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 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`.
|
|
155
|
+
* Get the org credit balance
|
|
156
|
+
*/
|
|
157
|
+
async getBalanceRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Balance>> {
|
|
158
|
+
const requestOptions = await this.getBalanceRequestOpts();
|
|
159
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
160
|
+
|
|
161
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => BalanceFromJSON(jsonValue));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* 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`.
|
|
166
|
+
* Get the org credit balance
|
|
167
|
+
*/
|
|
168
|
+
async getBalance(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Balance> {
|
|
169
|
+
const response = await this.getBalanceRaw(initOverrides);
|
|
170
|
+
return await response.value();
|
|
171
|
+
}
|
|
172
|
+
|
|
121
173
|
/**
|
|
122
174
|
* Creates request options for getDeposit without sending the request
|
|
123
175
|
*/
|