@gpuai/sdk 0.3.14 → 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 +2 -0
- package/README.md +4 -2
- package/dist/apis/BillingApi.d.ts +15 -0
- package/dist/apis/BillingApi.js +45 -0
- package/dist/esm/apis/BillingApi.d.ts +15 -0
- package/dist/esm/apis/BillingApi.js +45 -0
- package/dist/esm/models/Balance.d.ts +65 -0
- package/dist/esm/models/Balance.js +63 -0
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.js +1 -0
- package/dist/models/Balance.d.ts +65 -0
- package/dist/models/Balance.js +70 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/docs/Balance.md +45 -0
- package/docs/BillingApi.md +66 -0
- package/package.json +1 -1
- package/src/apis/BillingApi.ts +52 -0
- package/src/models/Balance.ts +114 -0
- package/src/models/index.ts +1 -0
package/.openapi-generator/FILES
CHANGED
|
@@ -6,6 +6,7 @@ docs/AutolaunchRule.md
|
|
|
6
6
|
docs/AutolaunchRuleCreate.md
|
|
7
7
|
docs/AutolaunchRuleDisarm.md
|
|
8
8
|
docs/AutolaunchRulePage.md
|
|
9
|
+
docs/Balance.md
|
|
9
10
|
docs/BillingApi.md
|
|
10
11
|
docs/ChatChoice.md
|
|
11
12
|
docs/ChatCompletionRequest.md
|
|
@@ -135,6 +136,7 @@ src/models/AutolaunchRule.ts
|
|
|
135
136
|
src/models/AutolaunchRuleCreate.ts
|
|
136
137
|
src/models/AutolaunchRuleDisarm.ts
|
|
137
138
|
src/models/AutolaunchRulePage.ts
|
|
139
|
+
src/models/Balance.ts
|
|
138
140
|
src/models/ChatChoice.ts
|
|
139
141
|
src/models/ChatCompletionRequest.ts
|
|
140
142
|
src/models/ChatCompletionResponse.ts
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @gpuai/sdk@0.3.
|
|
1
|
+
# @gpuai/sdk@0.3.15
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK client for the api.gpu.ai API.
|
|
4
4
|
|
|
@@ -62,6 +62,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
62
62
|
*AutolaunchApi* | [**getAutolaunchRule**](docs/AutolaunchApi.md#getautolaunchrule) | **GET** /autolaunch-rules/{id} | Get an auto-launch rule
|
|
63
63
|
*AutolaunchApi* | [**listAutolaunchRules**](docs/AutolaunchApi.md#listautolaunchrules) | **GET** /autolaunch-rules | List auto-launch rules
|
|
64
64
|
*BillingApi* | [**createCryptoDeposit**](docs/BillingApi.md#createcryptodepositoperation) | **POST** /billing/deposits/crypto | Create a stablecoin deposit
|
|
65
|
+
*BillingApi* | [**getBalance**](docs/BillingApi.md#getbalance) | **GET** /billing/balance | Get the org credit balance
|
|
65
66
|
*BillingApi* | [**getDeposit**](docs/BillingApi.md#getdeposit) | **GET** /billing/deposits/{id} | Get one stablecoin deposit
|
|
66
67
|
*BillingApi* | [**getSpendingLimit**](docs/BillingApi.md#getspendinglimit) | **GET** /billing/spending-limit | Get the org spending limit
|
|
67
68
|
*BillingApi* | [**listDeposits**](docs/BillingApi.md#listdeposits) | **GET** /billing/deposits | List stablecoin deposits
|
|
@@ -128,6 +129,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
128
129
|
- [AutolaunchRuleCreate](docs/AutolaunchRuleCreate.md)
|
|
129
130
|
- [AutolaunchRuleDisarm](docs/AutolaunchRuleDisarm.md)
|
|
130
131
|
- [AutolaunchRulePage](docs/AutolaunchRulePage.md)
|
|
132
|
+
- [Balance](docs/Balance.md)
|
|
131
133
|
- [ChatChoice](docs/ChatChoice.md)
|
|
132
134
|
- [ChatCompletionRequest](docs/ChatCompletionRequest.md)
|
|
133
135
|
- [ChatCompletionResponse](docs/ChatCompletionResponse.md)
|
|
@@ -233,7 +235,7 @@ and is automatically generated by the
|
|
|
233
235
|
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
234
236
|
|
|
235
237
|
- API version: `1.0.0`
|
|
236
|
-
- Package version: `0.3.
|
|
238
|
+
- Package version: `0.3.15`
|
|
237
239
|
- Generator version: `7.24.0`
|
|
238
240
|
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
|
|
239
241
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime';
|
|
13
|
+
import { type Balance } from '../models/Balance';
|
|
13
14
|
import { type CreateCryptoDepositRequest } from '../models/CreateCryptoDepositRequest';
|
|
14
15
|
import { type CryptoDeposit } from '../models/CryptoDeposit';
|
|
15
16
|
import { type ListDeposits200Response } from '../models/ListDeposits200Response';
|
|
@@ -42,6 +43,20 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
42
43
|
* Create a stablecoin deposit
|
|
43
44
|
*/
|
|
44
45
|
createCryptoDeposit(requestParameters: CreateCryptoDepositOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates request options for getBalance without sending the request
|
|
48
|
+
*/
|
|
49
|
+
getBalanceRequestOpts(): Promise<runtime.RequestOpts>;
|
|
50
|
+
/**
|
|
51
|
+
* 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`.
|
|
52
|
+
* Get the org credit balance
|
|
53
|
+
*/
|
|
54
|
+
getBalanceRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Balance>>;
|
|
55
|
+
/**
|
|
56
|
+
* 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`.
|
|
57
|
+
* Get the org credit balance
|
|
58
|
+
*/
|
|
59
|
+
getBalance(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Balance>;
|
|
45
60
|
/**
|
|
46
61
|
* Creates request options for getDeposit without sending the request
|
|
47
62
|
*/
|
package/dist/apis/BillingApi.js
CHANGED
|
@@ -24,6 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
exports.BillingApi = void 0;
|
|
26
26
|
const runtime = require("../runtime");
|
|
27
|
+
const Balance_1 = require("../models/Balance");
|
|
27
28
|
const CreateCryptoDepositRequest_1 = require("../models/CreateCryptoDepositRequest");
|
|
28
29
|
const CryptoDeposit_1 = require("../models/CryptoDeposit");
|
|
29
30
|
const ListDeposits200Response_1 = require("../models/ListDeposits200Response");
|
|
@@ -82,6 +83,50 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
82
83
|
return yield response.value();
|
|
83
84
|
});
|
|
84
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates request options for getBalance without sending the request
|
|
88
|
+
*/
|
|
89
|
+
getBalanceRequestOpts() {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const queryParameters = {};
|
|
92
|
+
const headerParameters = {};
|
|
93
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
94
|
+
const token = this.configuration.accessToken;
|
|
95
|
+
const tokenString = yield token("bearerAuth", []);
|
|
96
|
+
if (tokenString) {
|
|
97
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
let urlPath = `/billing/balance`;
|
|
101
|
+
return {
|
|
102
|
+
path: urlPath,
|
|
103
|
+
method: 'GET',
|
|
104
|
+
headers: headerParameters,
|
|
105
|
+
query: queryParameters,
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 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`.
|
|
111
|
+
* Get the org credit balance
|
|
112
|
+
*/
|
|
113
|
+
getBalanceRaw(initOverrides) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const requestOptions = yield this.getBalanceRequestOpts();
|
|
116
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
117
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, Balance_1.BalanceFromJSON)(jsonValue));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 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`.
|
|
122
|
+
* Get the org credit balance
|
|
123
|
+
*/
|
|
124
|
+
getBalance(initOverrides) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const response = yield this.getBalanceRaw(initOverrides);
|
|
127
|
+
return yield response.value();
|
|
128
|
+
});
|
|
129
|
+
}
|
|
85
130
|
/**
|
|
86
131
|
* Creates request options for getDeposit without sending the request
|
|
87
132
|
*/
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime';
|
|
13
|
+
import { type Balance } from '../models/Balance';
|
|
13
14
|
import { type CreateCryptoDepositRequest } from '../models/CreateCryptoDepositRequest';
|
|
14
15
|
import { type CryptoDeposit } from '../models/CryptoDeposit';
|
|
15
16
|
import { type ListDeposits200Response } from '../models/ListDeposits200Response';
|
|
@@ -42,6 +43,20 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
42
43
|
* Create a stablecoin deposit
|
|
43
44
|
*/
|
|
44
45
|
createCryptoDeposit(requestParameters: CreateCryptoDepositOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates request options for getBalance without sending the request
|
|
48
|
+
*/
|
|
49
|
+
getBalanceRequestOpts(): Promise<runtime.RequestOpts>;
|
|
50
|
+
/**
|
|
51
|
+
* 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`.
|
|
52
|
+
* Get the org credit balance
|
|
53
|
+
*/
|
|
54
|
+
getBalanceRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Balance>>;
|
|
55
|
+
/**
|
|
56
|
+
* 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`.
|
|
57
|
+
* Get the org credit balance
|
|
58
|
+
*/
|
|
59
|
+
getBalance(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Balance>;
|
|
45
60
|
/**
|
|
46
61
|
* Creates request options for getDeposit without sending the request
|
|
47
62
|
*/
|
|
@@ -21,6 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
import * as runtime from '../runtime';
|
|
24
|
+
import { BalanceFromJSON, } from '../models/Balance';
|
|
24
25
|
import { CreateCryptoDepositRequestToJSON, } from '../models/CreateCryptoDepositRequest';
|
|
25
26
|
import { CryptoDepositFromJSON, } from '../models/CryptoDeposit';
|
|
26
27
|
import { ListDeposits200ResponseFromJSON, } from '../models/ListDeposits200Response';
|
|
@@ -79,6 +80,50 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
79
80
|
return yield response.value();
|
|
80
81
|
});
|
|
81
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates request options for getBalance without sending the request
|
|
85
|
+
*/
|
|
86
|
+
getBalanceRequestOpts() {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const queryParameters = {};
|
|
89
|
+
const headerParameters = {};
|
|
90
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
91
|
+
const token = this.configuration.accessToken;
|
|
92
|
+
const tokenString = yield token("bearerAuth", []);
|
|
93
|
+
if (tokenString) {
|
|
94
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
let urlPath = `/billing/balance`;
|
|
98
|
+
return {
|
|
99
|
+
path: urlPath,
|
|
100
|
+
method: 'GET',
|
|
101
|
+
headers: headerParameters,
|
|
102
|
+
query: queryParameters,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 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`.
|
|
108
|
+
* Get the org credit balance
|
|
109
|
+
*/
|
|
110
|
+
getBalanceRaw(initOverrides) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const requestOptions = yield this.getBalanceRequestOpts();
|
|
113
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
114
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => BalanceFromJSON(jsonValue));
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 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`.
|
|
119
|
+
* Get the org credit balance
|
|
120
|
+
*/
|
|
121
|
+
getBalance(initOverrides) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const response = yield this.getBalanceRaw(initOverrides);
|
|
124
|
+
return yield response.value();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
82
127
|
/**
|
|
83
128
|
* Creates request options for getDeposit without sending the request
|
|
84
129
|
*/
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU.ai Public Developer API
|
|
3
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
* Contact: support@gpu.ai
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The organization's credit balance with its auto-pay configuration and live burn rate. Mirrors the dashboard's balance contract field for field. No payment-instrument detail appears here — saved cards live behind separate admin-only routes.
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface Balance
|
|
17
|
+
*/
|
|
18
|
+
export interface Balance {
|
|
19
|
+
/**
|
|
20
|
+
* Remaining credit in USD cents. May be negative when usage has outrun the balance.
|
|
21
|
+
* @type {number}
|
|
22
|
+
* @memberof Balance
|
|
23
|
+
*/
|
|
24
|
+
balanceCents: number;
|
|
25
|
+
/**
|
|
26
|
+
* The same figure in dollars, for display.
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof Balance
|
|
29
|
+
*/
|
|
30
|
+
balanceDollars: number;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
* @memberof Balance
|
|
35
|
+
*/
|
|
36
|
+
autoPayEnabled: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Auto-pay triggers when the balance falls below this. Meaningful only when auto_pay_enabled.
|
|
39
|
+
* @type {number}
|
|
40
|
+
* @memberof Balance
|
|
41
|
+
*/
|
|
42
|
+
autoPayThresholdCents: number;
|
|
43
|
+
/**
|
|
44
|
+
* Amount auto-pay charges when it triggers. Meaningful only when auto_pay_enabled.
|
|
45
|
+
* @type {number}
|
|
46
|
+
* @memberof Balance
|
|
47
|
+
*/
|
|
48
|
+
autoPayAmountCents: number;
|
|
49
|
+
/**
|
|
50
|
+
* Live burn rate in USD cents per hour: the committed hourly price of every instance that is live, counted from launch — so instances still creating, provisioning or booting are included, not only those that have reached running. 0 when nothing is live.
|
|
51
|
+
*
|
|
52
|
+
* `null` means the burn rate could not be determined. Treat that as unknown, never as 0: reading an unavailable burn rate as "nothing running" reports unbounded runway to an organization that may be minutes from empty.
|
|
53
|
+
* @type {number}
|
|
54
|
+
* @memberof Balance
|
|
55
|
+
*/
|
|
56
|
+
burnCentsPerHour: number | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if a given object implements the Balance interface.
|
|
60
|
+
*/
|
|
61
|
+
export declare function instanceOfBalance(value: object): value is Balance;
|
|
62
|
+
export declare function BalanceFromJSON(json: any): Balance;
|
|
63
|
+
export declare function BalanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): Balance;
|
|
64
|
+
export declare function BalanceToJSON(json: any): Balance;
|
|
65
|
+
export declare function BalanceToJSONTyped(value?: Balance | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
* Check if a given object implements the Balance interface.
|
|
16
|
+
*/
|
|
17
|
+
export function instanceOfBalance(value) {
|
|
18
|
+
if ((!('balanceCents' in value) && !('balance_cents' in value)) || (value['balanceCents'] === undefined && value['balance_cents'] === undefined))
|
|
19
|
+
return false;
|
|
20
|
+
if ((!('balanceDollars' in value) && !('balance_dollars' in value)) || (value['balanceDollars'] === undefined && value['balance_dollars'] === undefined))
|
|
21
|
+
return false;
|
|
22
|
+
if ((!('autoPayEnabled' in value) && !('auto_pay_enabled' in value)) || (value['autoPayEnabled'] === undefined && value['auto_pay_enabled'] === undefined))
|
|
23
|
+
return false;
|
|
24
|
+
if ((!('autoPayThresholdCents' in value) && !('auto_pay_threshold_cents' in value)) || (value['autoPayThresholdCents'] === undefined && value['auto_pay_threshold_cents'] === undefined))
|
|
25
|
+
return false;
|
|
26
|
+
if ((!('autoPayAmountCents' in value) && !('auto_pay_amount_cents' in value)) || (value['autoPayAmountCents'] === undefined && value['auto_pay_amount_cents'] === undefined))
|
|
27
|
+
return false;
|
|
28
|
+
if ((!('burnCentsPerHour' in value) && !('burn_cents_per_hour' in value)) || (value['burnCentsPerHour'] === undefined && value['burn_cents_per_hour'] === undefined))
|
|
29
|
+
return false;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
export function BalanceFromJSON(json) {
|
|
33
|
+
return BalanceFromJSONTyped(json, false);
|
|
34
|
+
}
|
|
35
|
+
export function BalanceFromJSONTyped(json, ignoreDiscriminator) {
|
|
36
|
+
if (json == null) {
|
|
37
|
+
return json;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
'balanceCents': json['balance_cents'],
|
|
41
|
+
'balanceDollars': json['balance_dollars'],
|
|
42
|
+
'autoPayEnabled': json['auto_pay_enabled'],
|
|
43
|
+
'autoPayThresholdCents': json['auto_pay_threshold_cents'],
|
|
44
|
+
'autoPayAmountCents': json['auto_pay_amount_cents'],
|
|
45
|
+
'burnCentsPerHour': json['burn_cents_per_hour'],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function BalanceToJSON(json) {
|
|
49
|
+
return BalanceToJSONTyped(json, false);
|
|
50
|
+
}
|
|
51
|
+
export function BalanceToJSONTyped(value, ignoreDiscriminator = false) {
|
|
52
|
+
if (value == null) {
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
'balance_cents': value['balanceCents'],
|
|
57
|
+
'balance_dollars': value['balanceDollars'],
|
|
58
|
+
'auto_pay_enabled': value['autoPayEnabled'],
|
|
59
|
+
'auto_pay_threshold_cents': value['autoPayThresholdCents'],
|
|
60
|
+
'auto_pay_amount_cents': value['autoPayAmountCents'],
|
|
61
|
+
'burn_cents_per_hour': value['burnCentsPerHour'],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -2,6 +2,7 @@ export * from './AutolaunchRule';
|
|
|
2
2
|
export * from './AutolaunchRuleCreate';
|
|
3
3
|
export * from './AutolaunchRuleDisarm';
|
|
4
4
|
export * from './AutolaunchRulePage';
|
|
5
|
+
export * from './Balance';
|
|
5
6
|
export * from './ChatChoice';
|
|
6
7
|
export * from './ChatCompletionRequest';
|
|
7
8
|
export * from './ChatCompletionResponse';
|
package/dist/esm/models/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from './AutolaunchRule';
|
|
|
4
4
|
export * from './AutolaunchRuleCreate';
|
|
5
5
|
export * from './AutolaunchRuleDisarm';
|
|
6
6
|
export * from './AutolaunchRulePage';
|
|
7
|
+
export * from './Balance';
|
|
7
8
|
export * from './ChatChoice';
|
|
8
9
|
export * from './ChatCompletionRequest';
|
|
9
10
|
export * from './ChatCompletionResponse';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU.ai Public Developer API
|
|
3
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
* Contact: support@gpu.ai
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The organization's credit balance with its auto-pay configuration and live burn rate. Mirrors the dashboard's balance contract field for field. No payment-instrument detail appears here — saved cards live behind separate admin-only routes.
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface Balance
|
|
17
|
+
*/
|
|
18
|
+
export interface Balance {
|
|
19
|
+
/**
|
|
20
|
+
* Remaining credit in USD cents. May be negative when usage has outrun the balance.
|
|
21
|
+
* @type {number}
|
|
22
|
+
* @memberof Balance
|
|
23
|
+
*/
|
|
24
|
+
balanceCents: number;
|
|
25
|
+
/**
|
|
26
|
+
* The same figure in dollars, for display.
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof Balance
|
|
29
|
+
*/
|
|
30
|
+
balanceDollars: number;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
* @memberof Balance
|
|
35
|
+
*/
|
|
36
|
+
autoPayEnabled: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Auto-pay triggers when the balance falls below this. Meaningful only when auto_pay_enabled.
|
|
39
|
+
* @type {number}
|
|
40
|
+
* @memberof Balance
|
|
41
|
+
*/
|
|
42
|
+
autoPayThresholdCents: number;
|
|
43
|
+
/**
|
|
44
|
+
* Amount auto-pay charges when it triggers. Meaningful only when auto_pay_enabled.
|
|
45
|
+
* @type {number}
|
|
46
|
+
* @memberof Balance
|
|
47
|
+
*/
|
|
48
|
+
autoPayAmountCents: number;
|
|
49
|
+
/**
|
|
50
|
+
* Live burn rate in USD cents per hour: the committed hourly price of every instance that is live, counted from launch — so instances still creating, provisioning or booting are included, not only those that have reached running. 0 when nothing is live.
|
|
51
|
+
*
|
|
52
|
+
* `null` means the burn rate could not be determined. Treat that as unknown, never as 0: reading an unavailable burn rate as "nothing running" reports unbounded runway to an organization that may be minutes from empty.
|
|
53
|
+
* @type {number}
|
|
54
|
+
* @memberof Balance
|
|
55
|
+
*/
|
|
56
|
+
burnCentsPerHour: number | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if a given object implements the Balance interface.
|
|
60
|
+
*/
|
|
61
|
+
export declare function instanceOfBalance(value: object): value is Balance;
|
|
62
|
+
export declare function BalanceFromJSON(json: any): Balance;
|
|
63
|
+
export declare function BalanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): Balance;
|
|
64
|
+
export declare function BalanceToJSON(json: any): Balance;
|
|
65
|
+
export declare function BalanceToJSONTyped(value?: Balance | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* GPU.ai Public Developer API
|
|
6
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
* Contact: support@gpu.ai
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.instanceOfBalance = instanceOfBalance;
|
|
17
|
+
exports.BalanceFromJSON = BalanceFromJSON;
|
|
18
|
+
exports.BalanceFromJSONTyped = BalanceFromJSONTyped;
|
|
19
|
+
exports.BalanceToJSON = BalanceToJSON;
|
|
20
|
+
exports.BalanceToJSONTyped = BalanceToJSONTyped;
|
|
21
|
+
/**
|
|
22
|
+
* Check if a given object implements the Balance interface.
|
|
23
|
+
*/
|
|
24
|
+
function instanceOfBalance(value) {
|
|
25
|
+
if ((!('balanceCents' in value) && !('balance_cents' in value)) || (value['balanceCents'] === undefined && value['balance_cents'] === undefined))
|
|
26
|
+
return false;
|
|
27
|
+
if ((!('balanceDollars' in value) && !('balance_dollars' in value)) || (value['balanceDollars'] === undefined && value['balance_dollars'] === undefined))
|
|
28
|
+
return false;
|
|
29
|
+
if ((!('autoPayEnabled' in value) && !('auto_pay_enabled' in value)) || (value['autoPayEnabled'] === undefined && value['auto_pay_enabled'] === undefined))
|
|
30
|
+
return false;
|
|
31
|
+
if ((!('autoPayThresholdCents' in value) && !('auto_pay_threshold_cents' in value)) || (value['autoPayThresholdCents'] === undefined && value['auto_pay_threshold_cents'] === undefined))
|
|
32
|
+
return false;
|
|
33
|
+
if ((!('autoPayAmountCents' in value) && !('auto_pay_amount_cents' in value)) || (value['autoPayAmountCents'] === undefined && value['auto_pay_amount_cents'] === undefined))
|
|
34
|
+
return false;
|
|
35
|
+
if ((!('burnCentsPerHour' in value) && !('burn_cents_per_hour' in value)) || (value['burnCentsPerHour'] === undefined && value['burn_cents_per_hour'] === undefined))
|
|
36
|
+
return false;
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
function BalanceFromJSON(json) {
|
|
40
|
+
return BalanceFromJSONTyped(json, false);
|
|
41
|
+
}
|
|
42
|
+
function BalanceFromJSONTyped(json, ignoreDiscriminator) {
|
|
43
|
+
if (json == null) {
|
|
44
|
+
return json;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
'balanceCents': json['balance_cents'],
|
|
48
|
+
'balanceDollars': json['balance_dollars'],
|
|
49
|
+
'autoPayEnabled': json['auto_pay_enabled'],
|
|
50
|
+
'autoPayThresholdCents': json['auto_pay_threshold_cents'],
|
|
51
|
+
'autoPayAmountCents': json['auto_pay_amount_cents'],
|
|
52
|
+
'burnCentsPerHour': json['burn_cents_per_hour'],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function BalanceToJSON(json) {
|
|
56
|
+
return BalanceToJSONTyped(json, false);
|
|
57
|
+
}
|
|
58
|
+
function BalanceToJSONTyped(value, ignoreDiscriminator = false) {
|
|
59
|
+
if (value == null) {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
'balance_cents': value['balanceCents'],
|
|
64
|
+
'balance_dollars': value['balanceDollars'],
|
|
65
|
+
'auto_pay_enabled': value['autoPayEnabled'],
|
|
66
|
+
'auto_pay_threshold_cents': value['autoPayThresholdCents'],
|
|
67
|
+
'auto_pay_amount_cents': value['autoPayAmountCents'],
|
|
68
|
+
'burn_cents_per_hour': value['burnCentsPerHour'],
|
|
69
|
+
};
|
|
70
|
+
}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './AutolaunchRule';
|
|
|
2
2
|
export * from './AutolaunchRuleCreate';
|
|
3
3
|
export * from './AutolaunchRuleDisarm';
|
|
4
4
|
export * from './AutolaunchRulePage';
|
|
5
|
+
export * from './Balance';
|
|
5
6
|
export * from './ChatChoice';
|
|
6
7
|
export * from './ChatCompletionRequest';
|
|
7
8
|
export * from './ChatCompletionResponse';
|
package/dist/models/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./AutolaunchRule"), exports);
|
|
|
20
20
|
__exportStar(require("./AutolaunchRuleCreate"), exports);
|
|
21
21
|
__exportStar(require("./AutolaunchRuleDisarm"), exports);
|
|
22
22
|
__exportStar(require("./AutolaunchRulePage"), exports);
|
|
23
|
+
__exportStar(require("./Balance"), exports);
|
|
23
24
|
__exportStar(require("./ChatChoice"), exports);
|
|
24
25
|
__exportStar(require("./ChatCompletionRequest"), exports);
|
|
25
26
|
__exportStar(require("./ChatCompletionResponse"), exports);
|
package/docs/Balance.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
# Balance
|
|
3
|
+
|
|
4
|
+
The organization\'s credit balance with its auto-pay configuration and live burn rate. Mirrors the dashboard\'s balance contract field for field. No payment-instrument detail appears here — saved cards live behind separate admin-only routes.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`balanceCents` | number
|
|
11
|
+
`balanceDollars` | number
|
|
12
|
+
`autoPayEnabled` | boolean
|
|
13
|
+
`autoPayThresholdCents` | number
|
|
14
|
+
`autoPayAmountCents` | number
|
|
15
|
+
`burnCentsPerHour` | number
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import type { Balance } from '@gpuai/sdk'
|
|
21
|
+
|
|
22
|
+
// TODO: Update the object below with actual values
|
|
23
|
+
const example = {
|
|
24
|
+
"balanceCents": null,
|
|
25
|
+
"balanceDollars": null,
|
|
26
|
+
"autoPayEnabled": null,
|
|
27
|
+
"autoPayThresholdCents": null,
|
|
28
|
+
"autoPayAmountCents": null,
|
|
29
|
+
"burnCentsPerHour": null,
|
|
30
|
+
} satisfies Balance
|
|
31
|
+
|
|
32
|
+
console.log(example)
|
|
33
|
+
|
|
34
|
+
// Convert the instance to a JSON string
|
|
35
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
36
|
+
console.log(exampleJSON)
|
|
37
|
+
|
|
38
|
+
// Parse the JSON string back to an object
|
|
39
|
+
const exampleParsed = JSON.parse(exampleJSON) as Balance
|
|
40
|
+
console.log(exampleParsed)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
44
|
+
|
|
45
|
+
|
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)
|
package/package.json
CHANGED
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
|
*/
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* GPU.ai Public Developer API
|
|
5
|
+
* Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
* Contact: support@gpu.ai
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { mapValues } from '../runtime';
|
|
16
|
+
/**
|
|
17
|
+
* The organization's credit balance with its auto-pay configuration and live burn rate. Mirrors the dashboard's balance contract field for field. No payment-instrument detail appears here — saved cards live behind separate admin-only routes.
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface Balance
|
|
21
|
+
*/
|
|
22
|
+
export interface Balance {
|
|
23
|
+
/**
|
|
24
|
+
* Remaining credit in USD cents. May be negative when usage has outrun the balance.
|
|
25
|
+
* @type {number}
|
|
26
|
+
* @memberof Balance
|
|
27
|
+
*/
|
|
28
|
+
balanceCents: number;
|
|
29
|
+
/**
|
|
30
|
+
* The same figure in dollars, for display.
|
|
31
|
+
* @type {number}
|
|
32
|
+
* @memberof Balance
|
|
33
|
+
*/
|
|
34
|
+
balanceDollars: number;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @type {boolean}
|
|
38
|
+
* @memberof Balance
|
|
39
|
+
*/
|
|
40
|
+
autoPayEnabled: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Auto-pay triggers when the balance falls below this. Meaningful only when auto_pay_enabled.
|
|
43
|
+
* @type {number}
|
|
44
|
+
* @memberof Balance
|
|
45
|
+
*/
|
|
46
|
+
autoPayThresholdCents: number;
|
|
47
|
+
/**
|
|
48
|
+
* Amount auto-pay charges when it triggers. Meaningful only when auto_pay_enabled.
|
|
49
|
+
* @type {number}
|
|
50
|
+
* @memberof Balance
|
|
51
|
+
*/
|
|
52
|
+
autoPayAmountCents: number;
|
|
53
|
+
/**
|
|
54
|
+
* Live burn rate in USD cents per hour: the committed hourly price of every instance that is live, counted from launch — so instances still creating, provisioning or booting are included, not only those that have reached running. 0 when nothing is live.
|
|
55
|
+
*
|
|
56
|
+
* `null` means the burn rate could not be determined. Treat that as unknown, never as 0: reading an unavailable burn rate as "nothing running" reports unbounded runway to an organization that may be minutes from empty.
|
|
57
|
+
* @type {number}
|
|
58
|
+
* @memberof Balance
|
|
59
|
+
*/
|
|
60
|
+
burnCentsPerHour: number | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Check if a given object implements the Balance interface.
|
|
65
|
+
*/
|
|
66
|
+
export function instanceOfBalance(value: object): value is Balance {
|
|
67
|
+
if ((!('balanceCents' in (value as Record<string, any>)) && !('balance_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['balanceCents'] === undefined && (value as Record<string, any>)['balance_cents'] === undefined)) return false;
|
|
68
|
+
if ((!('balanceDollars' in (value as Record<string, any>)) && !('balance_dollars' in (value as Record<string, any>))) || ((value as Record<string, any>)['balanceDollars'] === undefined && (value as Record<string, any>)['balance_dollars'] === undefined)) return false;
|
|
69
|
+
if ((!('autoPayEnabled' in (value as Record<string, any>)) && !('auto_pay_enabled' in (value as Record<string, any>))) || ((value as Record<string, any>)['autoPayEnabled'] === undefined && (value as Record<string, any>)['auto_pay_enabled'] === undefined)) return false;
|
|
70
|
+
if ((!('autoPayThresholdCents' in (value as Record<string, any>)) && !('auto_pay_threshold_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['autoPayThresholdCents'] === undefined && (value as Record<string, any>)['auto_pay_threshold_cents'] === undefined)) return false;
|
|
71
|
+
if ((!('autoPayAmountCents' in (value as Record<string, any>)) && !('auto_pay_amount_cents' in (value as Record<string, any>))) || ((value as Record<string, any>)['autoPayAmountCents'] === undefined && (value as Record<string, any>)['auto_pay_amount_cents'] === undefined)) return false;
|
|
72
|
+
if ((!('burnCentsPerHour' in (value as Record<string, any>)) && !('burn_cents_per_hour' in (value as Record<string, any>))) || ((value as Record<string, any>)['burnCentsPerHour'] === undefined && (value as Record<string, any>)['burn_cents_per_hour'] === undefined)) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function BalanceFromJSON(json: any): Balance {
|
|
77
|
+
return BalanceFromJSONTyped(json, false);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function BalanceFromJSONTyped(json: any, ignoreDiscriminator: boolean): Balance {
|
|
81
|
+
if (json == null) {
|
|
82
|
+
return json;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
|
|
86
|
+
'balanceCents': json['balance_cents'],
|
|
87
|
+
'balanceDollars': json['balance_dollars'],
|
|
88
|
+
'autoPayEnabled': json['auto_pay_enabled'],
|
|
89
|
+
'autoPayThresholdCents': json['auto_pay_threshold_cents'],
|
|
90
|
+
'autoPayAmountCents': json['auto_pay_amount_cents'],
|
|
91
|
+
'burnCentsPerHour': json['burn_cents_per_hour'],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function BalanceToJSON(json: any): Balance {
|
|
96
|
+
return BalanceToJSONTyped(json, false);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function BalanceToJSONTyped(value?: Balance | null, ignoreDiscriminator: boolean = false): any {
|
|
100
|
+
if (value == null) {
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
|
|
106
|
+
'balance_cents': value['balanceCents'],
|
|
107
|
+
'balance_dollars': value['balanceDollars'],
|
|
108
|
+
'auto_pay_enabled': value['autoPayEnabled'],
|
|
109
|
+
'auto_pay_threshold_cents': value['autoPayThresholdCents'],
|
|
110
|
+
'auto_pay_amount_cents': value['autoPayAmountCents'],
|
|
111
|
+
'burn_cents_per_hour': value['burnCentsPerHour'],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
package/src/models/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './AutolaunchRule';
|
|
|
4
4
|
export * from './AutolaunchRuleCreate';
|
|
5
5
|
export * from './AutolaunchRuleDisarm';
|
|
6
6
|
export * from './AutolaunchRulePage';
|
|
7
|
+
export * from './Balance';
|
|
7
8
|
export * from './ChatChoice';
|
|
8
9
|
export * from './ChatCompletionRequest';
|
|
9
10
|
export * from './ChatCompletionResponse';
|