@deeprelay/sdk 0.1.2 → 0.2.1
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 +0 -8
- package/README.md +3 -6
- package/dist/apis/BillingApi.d.ts +14 -0
- package/dist/apis/BillingApi.js +43 -0
- package/dist/apis/UsageApi.d.ts +14 -0
- package/dist/apis/UsageApi.js +18 -1
- package/dist/apis/index.d.ts +0 -1
- package/dist/apis/index.js +0 -1
- package/dist/esm/apis/BillingApi.d.ts +14 -0
- package/dist/esm/apis/BillingApi.js +43 -0
- package/dist/esm/apis/UsageApi.d.ts +14 -0
- package/dist/esm/apis/UsageApi.js +17 -0
- package/dist/esm/apis/index.d.ts +0 -1
- package/dist/esm/apis/index.js +0 -1
- package/dist/esm/models/UsageBucket.d.ts +38 -5
- package/dist/esm/models/UsageBucket.js +10 -0
- package/dist/esm/models/UsagePage.d.ts +1 -0
- package/dist/esm/models/index.d.ts +0 -3
- package/dist/esm/models/index.js +0 -3
- package/dist/esm/runtime.js +1 -1
- package/dist/models/UsageBucket.d.ts +38 -5
- package/dist/models/UsageBucket.js +10 -0
- package/dist/models/UsagePage.d.ts +1 -0
- package/dist/models/index.d.ts +0 -3
- package/dist/models/index.js +0 -3
- package/dist/runtime.js +1 -1
- package/docs/BillingApi.md +68 -0
- package/docs/UsageApi.md +17 -9
- package/docs/UsageBucket.md +11 -0
- package/package.json +1 -1
- package/src/apis/BillingApi.ts +46 -0
- package/src/apis/UsageApi.ts +22 -0
- package/src/apis/index.ts +0 -1
- package/src/models/UsageBucket.ts +48 -5
- package/src/models/UsagePage.ts +1 -0
- package/src/models/index.ts +0 -3
- package/src/runtime.ts +1 -1
- package/dist/apis/OperationsApi.d.ts +0 -33
- package/dist/apis/OperationsApi.js +0 -79
- package/dist/esm/apis/OperationsApi.d.ts +0 -33
- package/dist/esm/apis/OperationsApi.js +0 -75
- package/dist/esm/models/Operation.d.ts +0 -107
- package/dist/esm/models/Operation.js +0 -86
- package/dist/esm/models/OperationError.d.ts +0 -38
- package/dist/esm/models/OperationError.js +0 -43
- package/dist/esm/models/OperationResult.d.ts +0 -44
- package/dist/esm/models/OperationResult.js +0 -45
- package/dist/models/Operation.d.ts +0 -107
- package/dist/models/Operation.js +0 -94
- package/dist/models/OperationError.d.ts +0 -38
- package/dist/models/OperationError.js +0 -50
- package/dist/models/OperationResult.d.ts +0 -44
- package/dist/models/OperationResult.js +0 -52
- package/docs/Operation.md +0 -52
- package/docs/OperationError.md +0 -36
- package/docs/OperationResult.md +0 -39
- package/docs/OperationsApi.md +0 -80
- package/src/apis/OperationsApi.ts +0 -89
- package/src/models/Operation.ts +0 -179
- package/src/models/OperationError.ts +0 -73
- package/src/models/OperationResult.ts +0 -81
package/.openapi-generator/FILES
CHANGED
|
@@ -31,10 +31,6 @@ docs/ModelPricing.md
|
|
|
31
31
|
docs/ModelRate.md
|
|
32
32
|
docs/OpenAIErrorEnvelope.md
|
|
33
33
|
docs/OpenAIErrorEnvelopeError.md
|
|
34
|
-
docs/Operation.md
|
|
35
|
-
docs/OperationError.md
|
|
36
|
-
docs/OperationResult.md
|
|
37
|
-
docs/OperationsApi.md
|
|
38
34
|
docs/PeakWindow.md
|
|
39
35
|
docs/Problem.md
|
|
40
36
|
docs/RefereeStatus.md
|
|
@@ -65,7 +61,6 @@ package.json
|
|
|
65
61
|
src/apis/BillingApi.ts
|
|
66
62
|
src/apis/InferenceApi.ts
|
|
67
63
|
src/apis/MetaApi.ts
|
|
68
|
-
src/apis/OperationsApi.ts
|
|
69
64
|
src/apis/UsageApi.ts
|
|
70
65
|
src/apis/WebhooksApi.ts
|
|
71
66
|
src/apis/index.ts
|
|
@@ -97,9 +92,6 @@ src/models/ModelPricing.ts
|
|
|
97
92
|
src/models/ModelRate.ts
|
|
98
93
|
src/models/OpenAIErrorEnvelope.ts
|
|
99
94
|
src/models/OpenAIErrorEnvelopeError.ts
|
|
100
|
-
src/models/Operation.ts
|
|
101
|
-
src/models/OperationError.ts
|
|
102
|
-
src/models/OperationResult.ts
|
|
103
95
|
src/models/PeakWindow.ts
|
|
104
96
|
src/models/Problem.ts
|
|
105
97
|
src/models/RefereeStatus.ts
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @deeprelay/sdk@0.1
|
|
1
|
+
# @deeprelay/sdk@0.2.1
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK client for the api.deeprelay.ai API.
|
|
4
4
|
|
|
@@ -57,6 +57,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
57
57
|
*BillingApi* | [**createCryptoDeposit**](docs/BillingApi.md#createcryptodepositoperation) | **POST** /billing/deposits/crypto | Create a stablecoin deposit
|
|
58
58
|
*BillingApi* | [**createSubscriptionCheckout**](docs/BillingApi.md#createsubscriptioncheckout) | **POST** /billing/subscription/checkout | Start a subscription checkout session
|
|
59
59
|
*BillingApi* | [**createSubscriptionPortal**](docs/BillingApi.md#createsubscriptionportal) | **POST** /billing/subscription/portal | Open the billing portal to cancel or manage the subscription
|
|
60
|
+
*BillingApi* | [**deleteSpendingLimit**](docs/BillingApi.md#deletespendinglimit) | **DELETE** /billing/spending-limit | Clear the org spending limit
|
|
60
61
|
*BillingApi* | [**getBalance**](docs/BillingApi.md#getbalance) | **GET** /billing/balance | Get the org credit balance
|
|
61
62
|
*BillingApi* | [**getDeposit**](docs/BillingApi.md#getdeposit) | **GET** /billing/deposits/{id} | Get one stablecoin deposit
|
|
62
63
|
*BillingApi* | [**getReferral**](docs/BillingApi.md#getreferral) | **GET** /referrals | Get the org referral code, invite link, terms and stats
|
|
@@ -77,7 +78,6 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
77
78
|
*InferenceApi* | [**listVideos**](docs/InferenceApi.md#listvideos) | **GET** /videos | List video generation jobs
|
|
78
79
|
*MetaApi* | [**getHealth**](docs/MetaApi.md#gethealth) | **GET** /health | Liveness probe
|
|
79
80
|
*MetaApi* | [**getOpenApiSpec**](docs/MetaApi.md#getopenapispec) | **GET** /openapi.json | OpenAPI 3.1 specification
|
|
80
|
-
*OperationsApi* | [**getOperation**](docs/OperationsApi.md#getoperation) | **GET** /operations/{id} | Get an async operation status
|
|
81
81
|
*UsageApi* | [**listUsage**](docs/UsageApi.md#listusage) | **GET** /usage | Time-bucketed usage
|
|
82
82
|
*WebhooksApi* | [**createWebhookEndpoint**](docs/WebhooksApi.md#createwebhookendpointoperation) | **POST** /webhook-endpoints | Create a webhook endpoint
|
|
83
83
|
*WebhooksApi* | [**deleteWebhookEndpoint**](docs/WebhooksApi.md#deletewebhookendpoint) | **DELETE** /webhook-endpoints/{id} | Delete a webhook endpoint
|
|
@@ -114,9 +114,6 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
114
114
|
- [ModelRate](docs/ModelRate.md)
|
|
115
115
|
- [OpenAIErrorEnvelope](docs/OpenAIErrorEnvelope.md)
|
|
116
116
|
- [OpenAIErrorEnvelopeError](docs/OpenAIErrorEnvelopeError.md)
|
|
117
|
-
- [Operation](docs/Operation.md)
|
|
118
|
-
- [OperationError](docs/OperationError.md)
|
|
119
|
-
- [OperationResult](docs/OperationResult.md)
|
|
120
117
|
- [PeakWindow](docs/PeakWindow.md)
|
|
121
118
|
- [Problem](docs/Problem.md)
|
|
122
119
|
- [RefereeStatus](docs/RefereeStatus.md)
|
|
@@ -159,7 +156,7 @@ and is automatically generated by the
|
|
|
159
156
|
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
160
157
|
|
|
161
158
|
- API version: `1.0.0`
|
|
162
|
-
- Package version: `0.1
|
|
159
|
+
- Package version: `0.2.1`
|
|
163
160
|
- Generator version: `7.24.0`
|
|
164
161
|
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
|
|
165
162
|
|
|
@@ -83,6 +83,20 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
83
83
|
* Open the billing portal to cancel or manage the subscription
|
|
84
84
|
*/
|
|
85
85
|
createSubscriptionPortal(requestParameters?: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPortalSession>;
|
|
86
|
+
/**
|
|
87
|
+
* Creates request options for deleteSpendingLimit without sending the request
|
|
88
|
+
*/
|
|
89
|
+
deleteSpendingLimitRequestOpts(): Promise<runtime.RequestOpts>;
|
|
90
|
+
/**
|
|
91
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
92
|
+
* Clear the org spending limit
|
|
93
|
+
*/
|
|
94
|
+
deleteSpendingLimitRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
95
|
+
/**
|
|
96
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
97
|
+
* Clear the org spending limit
|
|
98
|
+
*/
|
|
99
|
+
deleteSpendingLimit(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
86
100
|
/**
|
|
87
101
|
* Creates request options for getBalance without sending the request
|
|
88
102
|
*/
|
package/dist/apis/BillingApi.js
CHANGED
|
@@ -181,6 +181,49 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
181
181
|
return yield response.value();
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Creates request options for deleteSpendingLimit without sending the request
|
|
186
|
+
*/
|
|
187
|
+
deleteSpendingLimitRequestOpts() {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
const queryParameters = {};
|
|
190
|
+
const headerParameters = {};
|
|
191
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
192
|
+
const token = this.configuration.accessToken;
|
|
193
|
+
const tokenString = yield token("bearerAuth", []);
|
|
194
|
+
if (tokenString) {
|
|
195
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
let urlPath = `/billing/spending-limit`;
|
|
199
|
+
return {
|
|
200
|
+
path: urlPath,
|
|
201
|
+
method: 'DELETE',
|
|
202
|
+
headers: headerParameters,
|
|
203
|
+
query: queryParameters,
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
209
|
+
* Clear the org spending limit
|
|
210
|
+
*/
|
|
211
|
+
deleteSpendingLimitRaw(initOverrides) {
|
|
212
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
const requestOptions = yield this.deleteSpendingLimitRequestOpts();
|
|
214
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
215
|
+
return new runtime.VoidApiResponse(response);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
220
|
+
* Clear the org spending limit
|
|
221
|
+
*/
|
|
222
|
+
deleteSpendingLimit(initOverrides) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
yield this.deleteSpendingLimitRaw(initOverrides);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
184
227
|
/**
|
|
185
228
|
* Creates request options for getBalance without sending the request
|
|
186
229
|
*/
|
package/dist/apis/UsageApi.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export interface ListUsageRequest {
|
|
|
18
18
|
end?: Date;
|
|
19
19
|
cursor?: string;
|
|
20
20
|
limit?: number;
|
|
21
|
+
modality?: ListUsageModalityEnum;
|
|
22
|
+
model?: string;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
*
|
|
@@ -28,10 +30,12 @@ export declare class UsageApi extends runtime.BaseAPI {
|
|
|
28
30
|
*/
|
|
29
31
|
listUsageRequestOpts(requestParameters: ListUsageRequest): Promise<runtime.RequestOpts>;
|
|
30
32
|
/**
|
|
33
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
31
34
|
* Time-bucketed usage
|
|
32
35
|
*/
|
|
33
36
|
listUsageRaw(requestParameters: ListUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UsagePage>>;
|
|
34
37
|
/**
|
|
38
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
35
39
|
* Time-bucketed usage
|
|
36
40
|
*/
|
|
37
41
|
listUsage(requestParameters?: ListUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UsagePage>;
|
|
@@ -54,3 +58,13 @@ export declare const ListUsageGroupByEnum: {
|
|
|
54
58
|
readonly GpuType: "gpu_type";
|
|
55
59
|
};
|
|
56
60
|
export type ListUsageGroupByEnum = typeof ListUsageGroupByEnum[keyof typeof ListUsageGroupByEnum];
|
|
61
|
+
/**
|
|
62
|
+
* @export
|
|
63
|
+
*/
|
|
64
|
+
export declare const ListUsageModalityEnum: {
|
|
65
|
+
readonly Chat: "chat";
|
|
66
|
+
readonly Image: "image";
|
|
67
|
+
readonly Video: "video";
|
|
68
|
+
readonly Embedding: "embedding";
|
|
69
|
+
};
|
|
70
|
+
export type ListUsageModalityEnum = typeof ListUsageModalityEnum[keyof typeof ListUsageModalityEnum];
|
package/dist/apis/UsageApi.js
CHANGED
|
@@ -22,7 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.ListUsageGroupByEnum = exports.ListUsageBucketEnum = exports.UsageApi = void 0;
|
|
25
|
+
exports.ListUsageModalityEnum = exports.ListUsageGroupByEnum = exports.ListUsageBucketEnum = exports.UsageApi = void 0;
|
|
26
26
|
const runtime = require("../runtime");
|
|
27
27
|
const UsagePage_1 = require("../models/UsagePage");
|
|
28
28
|
/**
|
|
@@ -53,6 +53,12 @@ class UsageApi extends runtime.BaseAPI {
|
|
|
53
53
|
if (requestParameters['limit'] != null) {
|
|
54
54
|
queryParameters['limit'] = requestParameters['limit'];
|
|
55
55
|
}
|
|
56
|
+
if (requestParameters['modality'] != null) {
|
|
57
|
+
queryParameters['modality'] = requestParameters['modality'];
|
|
58
|
+
}
|
|
59
|
+
if (requestParameters['model'] != null) {
|
|
60
|
+
queryParameters['model'] = requestParameters['model'];
|
|
61
|
+
}
|
|
56
62
|
const headerParameters = {};
|
|
57
63
|
if (this.configuration && this.configuration.accessToken) {
|
|
58
64
|
const token = this.configuration.accessToken;
|
|
@@ -71,6 +77,7 @@ class UsageApi extends runtime.BaseAPI {
|
|
|
71
77
|
});
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
80
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
74
81
|
* Time-bucketed usage
|
|
75
82
|
*/
|
|
76
83
|
listUsageRaw(requestParameters, initOverrides) {
|
|
@@ -81,6 +88,7 @@ class UsageApi extends runtime.BaseAPI {
|
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
91
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
84
92
|
* Time-bucketed usage
|
|
85
93
|
*/
|
|
86
94
|
listUsage() {
|
|
@@ -107,3 +115,12 @@ exports.ListUsageGroupByEnum = {
|
|
|
107
115
|
InstanceId: 'instance_id',
|
|
108
116
|
GpuType: 'gpu_type'
|
|
109
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* @export
|
|
120
|
+
*/
|
|
121
|
+
exports.ListUsageModalityEnum = {
|
|
122
|
+
Chat: 'chat',
|
|
123
|
+
Image: 'image',
|
|
124
|
+
Video: 'video',
|
|
125
|
+
Embedding: 'embedding'
|
|
126
|
+
};
|
package/dist/apis/index.d.ts
CHANGED
package/dist/apis/index.js
CHANGED
|
@@ -19,6 +19,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
__exportStar(require("./BillingApi"), exports);
|
|
20
20
|
__exportStar(require("./InferenceApi"), exports);
|
|
21
21
|
__exportStar(require("./MetaApi"), exports);
|
|
22
|
-
__exportStar(require("./OperationsApi"), exports);
|
|
23
22
|
__exportStar(require("./UsageApi"), exports);
|
|
24
23
|
__exportStar(require("./WebhooksApi"), exports);
|
|
@@ -83,6 +83,20 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
83
83
|
* Open the billing portal to cancel or manage the subscription
|
|
84
84
|
*/
|
|
85
85
|
createSubscriptionPortal(requestParameters?: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPortalSession>;
|
|
86
|
+
/**
|
|
87
|
+
* Creates request options for deleteSpendingLimit without sending the request
|
|
88
|
+
*/
|
|
89
|
+
deleteSpendingLimitRequestOpts(): Promise<runtime.RequestOpts>;
|
|
90
|
+
/**
|
|
91
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
92
|
+
* Clear the org spending limit
|
|
93
|
+
*/
|
|
94
|
+
deleteSpendingLimitRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
95
|
+
/**
|
|
96
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
97
|
+
* Clear the org spending limit
|
|
98
|
+
*/
|
|
99
|
+
deleteSpendingLimit(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
86
100
|
/**
|
|
87
101
|
* Creates request options for getBalance without sending the request
|
|
88
102
|
*/
|
|
@@ -178,6 +178,49 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
178
178
|
return yield response.value();
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Creates request options for deleteSpendingLimit without sending the request
|
|
183
|
+
*/
|
|
184
|
+
deleteSpendingLimitRequestOpts() {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
const queryParameters = {};
|
|
187
|
+
const headerParameters = {};
|
|
188
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
189
|
+
const token = this.configuration.accessToken;
|
|
190
|
+
const tokenString = yield token("bearerAuth", []);
|
|
191
|
+
if (tokenString) {
|
|
192
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
let urlPath = `/billing/spending-limit`;
|
|
196
|
+
return {
|
|
197
|
+
path: urlPath,
|
|
198
|
+
method: 'DELETE',
|
|
199
|
+
headers: headerParameters,
|
|
200
|
+
query: queryParameters,
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
206
|
+
* Clear the org spending limit
|
|
207
|
+
*/
|
|
208
|
+
deleteSpendingLimitRaw(initOverrides) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
const requestOptions = yield this.deleteSpendingLimitRequestOpts();
|
|
211
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
212
|
+
return new runtime.VoidApiResponse(response);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Removes the organization\'s monthly spending limit and daily spend cap entirely. Requires the `billing:write` scope AND org-admin privileges (a non-admin member gets 403). Returns 404 when no limit is configured. This is the only way to remove a limit through the API, because `PUT` floors `monthly_limit_dollars` at 1.00 and so cannot express \"no limit\".
|
|
217
|
+
* Clear the org spending limit
|
|
218
|
+
*/
|
|
219
|
+
deleteSpendingLimit(initOverrides) {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
yield this.deleteSpendingLimitRaw(initOverrides);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
181
224
|
/**
|
|
182
225
|
* Creates request options for getBalance without sending the request
|
|
183
226
|
*/
|
|
@@ -18,6 +18,8 @@ export interface ListUsageRequest {
|
|
|
18
18
|
end?: Date;
|
|
19
19
|
cursor?: string;
|
|
20
20
|
limit?: number;
|
|
21
|
+
modality?: ListUsageModalityEnum;
|
|
22
|
+
model?: string;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
*
|
|
@@ -28,10 +30,12 @@ export declare class UsageApi extends runtime.BaseAPI {
|
|
|
28
30
|
*/
|
|
29
31
|
listUsageRequestOpts(requestParameters: ListUsageRequest): Promise<runtime.RequestOpts>;
|
|
30
32
|
/**
|
|
33
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
31
34
|
* Time-bucketed usage
|
|
32
35
|
*/
|
|
33
36
|
listUsageRaw(requestParameters: ListUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UsagePage>>;
|
|
34
37
|
/**
|
|
38
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
35
39
|
* Time-bucketed usage
|
|
36
40
|
*/
|
|
37
41
|
listUsage(requestParameters?: ListUsageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UsagePage>;
|
|
@@ -54,3 +58,13 @@ export declare const ListUsageGroupByEnum: {
|
|
|
54
58
|
readonly GpuType: "gpu_type";
|
|
55
59
|
};
|
|
56
60
|
export type ListUsageGroupByEnum = typeof ListUsageGroupByEnum[keyof typeof ListUsageGroupByEnum];
|
|
61
|
+
/**
|
|
62
|
+
* @export
|
|
63
|
+
*/
|
|
64
|
+
export declare const ListUsageModalityEnum: {
|
|
65
|
+
readonly Chat: "chat";
|
|
66
|
+
readonly Image: "image";
|
|
67
|
+
readonly Video: "video";
|
|
68
|
+
readonly Embedding: "embedding";
|
|
69
|
+
};
|
|
70
|
+
export type ListUsageModalityEnum = typeof ListUsageModalityEnum[keyof typeof ListUsageModalityEnum];
|
|
@@ -50,6 +50,12 @@ export class UsageApi extends runtime.BaseAPI {
|
|
|
50
50
|
if (requestParameters['limit'] != null) {
|
|
51
51
|
queryParameters['limit'] = requestParameters['limit'];
|
|
52
52
|
}
|
|
53
|
+
if (requestParameters['modality'] != null) {
|
|
54
|
+
queryParameters['modality'] = requestParameters['modality'];
|
|
55
|
+
}
|
|
56
|
+
if (requestParameters['model'] != null) {
|
|
57
|
+
queryParameters['model'] = requestParameters['model'];
|
|
58
|
+
}
|
|
53
59
|
const headerParameters = {};
|
|
54
60
|
if (this.configuration && this.configuration.accessToken) {
|
|
55
61
|
const token = this.configuration.accessToken;
|
|
@@ -68,6 +74,7 @@ export class UsageApi extends runtime.BaseAPI {
|
|
|
68
74
|
});
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
77
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
71
78
|
* Time-bucketed usage
|
|
72
79
|
*/
|
|
73
80
|
listUsageRaw(requestParameters, initOverrides) {
|
|
@@ -78,6 +85,7 @@ export class UsageApi extends runtime.BaseAPI {
|
|
|
78
85
|
});
|
|
79
86
|
}
|
|
80
87
|
/**
|
|
88
|
+
* Returns spend aggregated into time buckets over `[start, end)` (default: the last 30 days, `bucket=day`), newest bucket first. The response has one of two row shapes, selected by the query: - **Inference usage** — set `modality` and/or `model`. Rows aggregate serverless inference calls, one row per (bucket, modality, model), and carry `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count`. This is the usage a serverless-inference customer is billed for. - **Instance usage** — neither `modality` nor `model` set. Rows aggregate GPU instance billing sessions, optionally split by `group_by`. With no instance usage this returns an empty `data` array, so to read inference spend always pass `modality` or `model`. Requires the `billing:read` scope.
|
|
81
89
|
* Time-bucketed usage
|
|
82
90
|
*/
|
|
83
91
|
listUsage() {
|
|
@@ -103,3 +111,12 @@ export const ListUsageGroupByEnum = {
|
|
|
103
111
|
InstanceId: 'instance_id',
|
|
104
112
|
GpuType: 'gpu_type'
|
|
105
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* @export
|
|
116
|
+
*/
|
|
117
|
+
export const ListUsageModalityEnum = {
|
|
118
|
+
Chat: 'chat',
|
|
119
|
+
Image: 'image',
|
|
120
|
+
Video: 'video',
|
|
121
|
+
Embedding: 'embedding'
|
|
122
|
+
};
|
package/dist/esm/apis/index.d.ts
CHANGED
package/dist/esm/apis/index.js
CHANGED
|
@@ -10,41 +10,74 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
+
* One `/usage` row. Every row carries `bucket_start`, `gpu_seconds` and `cost_cents`. When the request set `modality` or `model` the row is an inference-usage row: it also carries `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count` (aggregating every serverless inference call in the bucket for that modality and model), and `gpu_seconds` is always 0. Otherwise it is an instance-usage row, carrying `instance_id` / `gpu_type` when `group_by` asked for them.
|
|
13
14
|
*
|
|
14
15
|
* @export
|
|
15
16
|
* @interface UsageBucket
|
|
16
17
|
*/
|
|
17
18
|
export interface UsageBucket {
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* Start of the time bucket (truncated to `bucket`).
|
|
20
21
|
* @type {Date}
|
|
21
22
|
* @memberof UsageBucket
|
|
22
23
|
*/
|
|
23
24
|
bucketStart: Date;
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* Instance-usage rows with `group_by=instance_id` only.
|
|
26
27
|
* @type {string}
|
|
27
28
|
* @memberof UsageBucket
|
|
28
29
|
*/
|
|
29
30
|
instanceId?: string;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* Instance-usage rows with `group_by=gpu_type` only.
|
|
32
33
|
* @type {string}
|
|
33
34
|
* @memberof UsageBucket
|
|
34
35
|
*/
|
|
35
36
|
gpuType?: string;
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
+
* GPU instance seconds billed in the bucket. Always 0 on inference-usage rows.
|
|
38
39
|
* @type {number}
|
|
39
40
|
* @memberof UsageBucket
|
|
40
41
|
*/
|
|
41
42
|
gpuSeconds: number;
|
|
42
43
|
/**
|
|
43
|
-
*
|
|
44
|
+
* Total cost of the row, in US cents.
|
|
44
45
|
* @type {number}
|
|
45
46
|
* @memberof UsageBucket
|
|
46
47
|
*/
|
|
47
48
|
costCents: number;
|
|
49
|
+
/**
|
|
50
|
+
* Inference-usage rows only: the modality of the calls in this row (chat, image, video or embedding).
|
|
51
|
+
*
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @memberof UsageBucket
|
|
54
|
+
*/
|
|
55
|
+
modality?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Inference-usage rows only: the model `id` the calls in this row were made against.
|
|
58
|
+
*
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @memberof UsageBucket
|
|
61
|
+
*/
|
|
62
|
+
model?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Inference-usage rows only. Sum of input tokens; 0 for modalities not billed per token.
|
|
65
|
+
* @type {number}
|
|
66
|
+
* @memberof UsageBucket
|
|
67
|
+
*/
|
|
68
|
+
promptTokens?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Inference-usage rows only. Sum of output tokens; 0 for modalities not billed per token.
|
|
71
|
+
* @type {number}
|
|
72
|
+
* @memberof UsageBucket
|
|
73
|
+
*/
|
|
74
|
+
completionTokens?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Inference-usage rows only. Sum of generated images; 0 for non-image modalities.
|
|
77
|
+
* @type {number}
|
|
78
|
+
* @memberof UsageBucket
|
|
79
|
+
*/
|
|
80
|
+
imageCount?: number;
|
|
48
81
|
}
|
|
49
82
|
/**
|
|
50
83
|
* Check if a given object implements the UsageBucket interface.
|
|
@@ -36,6 +36,11 @@ export function UsageBucketFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
36
36
|
'gpuType': json['gpu_type'] == null ? undefined : json['gpu_type'],
|
|
37
37
|
'gpuSeconds': json['gpu_seconds'],
|
|
38
38
|
'costCents': json['cost_cents'],
|
|
39
|
+
'modality': json['modality'] == null ? undefined : json['modality'],
|
|
40
|
+
'model': json['model'] == null ? undefined : json['model'],
|
|
41
|
+
'promptTokens': json['prompt_tokens'] == null ? undefined : json['prompt_tokens'],
|
|
42
|
+
'completionTokens': json['completion_tokens'] == null ? undefined : json['completion_tokens'],
|
|
43
|
+
'imageCount': json['image_count'] == null ? undefined : json['image_count'],
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
46
|
export function UsageBucketToJSON(json) {
|
|
@@ -51,5 +56,10 @@ export function UsageBucketToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
51
56
|
'gpu_type': value['gpuType'],
|
|
52
57
|
'gpu_seconds': value['gpuSeconds'],
|
|
53
58
|
'cost_cents': value['costCents'],
|
|
59
|
+
'modality': value['modality'],
|
|
60
|
+
'model': value['model'],
|
|
61
|
+
'prompt_tokens': value['promptTokens'],
|
|
62
|
+
'completion_tokens': value['completionTokens'],
|
|
63
|
+
'image_count': value['imageCount'],
|
|
54
64
|
};
|
|
55
65
|
}
|
|
@@ -17,6 +17,7 @@ import type { UsageBucket } from './UsageBucket';
|
|
|
17
17
|
*/
|
|
18
18
|
export interface UsagePage {
|
|
19
19
|
/**
|
|
20
|
+
* Inference-usage rows when the request set `modality` or `model`; instance-usage rows otherwise. One page never mixes the two.
|
|
20
21
|
*
|
|
21
22
|
* @type {Array<UsageBucket>}
|
|
22
23
|
* @memberof UsagePage
|
|
@@ -25,9 +25,6 @@ export * from './ModelPricing';
|
|
|
25
25
|
export * from './ModelRate';
|
|
26
26
|
export * from './OpenAIErrorEnvelope';
|
|
27
27
|
export * from './OpenAIErrorEnvelopeError';
|
|
28
|
-
export * from './Operation';
|
|
29
|
-
export * from './OperationError';
|
|
30
|
-
export * from './OperationResult';
|
|
31
28
|
export * from './PeakWindow';
|
|
32
29
|
export * from './Problem';
|
|
33
30
|
export * from './RefereeStatus';
|
package/dist/esm/models/index.js
CHANGED
|
@@ -27,9 +27,6 @@ export * from './ModelPricing';
|
|
|
27
27
|
export * from './ModelRate';
|
|
28
28
|
export * from './OpenAIErrorEnvelope';
|
|
29
29
|
export * from './OpenAIErrorEnvelopeError';
|
|
30
|
-
export * from './Operation';
|
|
31
|
-
export * from './OperationError';
|
|
32
|
-
export * from './OperationResult';
|
|
33
30
|
export * from './PeakWindow';
|
|
34
31
|
export * from './Problem';
|
|
35
32
|
export * from './RefereeStatus';
|
package/dist/esm/runtime.js
CHANGED
|
@@ -61,7 +61,7 @@ export class Configuration {
|
|
|
61
61
|
return undefined;
|
|
62
62
|
}
|
|
63
63
|
get headers() {
|
|
64
|
-
return Object.assign({ 'User-Agent': 'deeprelay-sdk-ts/0.1
|
|
64
|
+
return Object.assign({ 'User-Agent': 'deeprelay-sdk-ts/0.2.1' }, this.configuration.headers);
|
|
65
65
|
}
|
|
66
66
|
get credentials() {
|
|
67
67
|
return this.configuration.credentials;
|
|
@@ -10,41 +10,74 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
+
* One `/usage` row. Every row carries `bucket_start`, `gpu_seconds` and `cost_cents`. When the request set `modality` or `model` the row is an inference-usage row: it also carries `modality`, `model`, `prompt_tokens`, `completion_tokens` and `image_count` (aggregating every serverless inference call in the bucket for that modality and model), and `gpu_seconds` is always 0. Otherwise it is an instance-usage row, carrying `instance_id` / `gpu_type` when `group_by` asked for them.
|
|
13
14
|
*
|
|
14
15
|
* @export
|
|
15
16
|
* @interface UsageBucket
|
|
16
17
|
*/
|
|
17
18
|
export interface UsageBucket {
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* Start of the time bucket (truncated to `bucket`).
|
|
20
21
|
* @type {Date}
|
|
21
22
|
* @memberof UsageBucket
|
|
22
23
|
*/
|
|
23
24
|
bucketStart: Date;
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* Instance-usage rows with `group_by=instance_id` only.
|
|
26
27
|
* @type {string}
|
|
27
28
|
* @memberof UsageBucket
|
|
28
29
|
*/
|
|
29
30
|
instanceId?: string;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* Instance-usage rows with `group_by=gpu_type` only.
|
|
32
33
|
* @type {string}
|
|
33
34
|
* @memberof UsageBucket
|
|
34
35
|
*/
|
|
35
36
|
gpuType?: string;
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
+
* GPU instance seconds billed in the bucket. Always 0 on inference-usage rows.
|
|
38
39
|
* @type {number}
|
|
39
40
|
* @memberof UsageBucket
|
|
40
41
|
*/
|
|
41
42
|
gpuSeconds: number;
|
|
42
43
|
/**
|
|
43
|
-
*
|
|
44
|
+
* Total cost of the row, in US cents.
|
|
44
45
|
* @type {number}
|
|
45
46
|
* @memberof UsageBucket
|
|
46
47
|
*/
|
|
47
48
|
costCents: number;
|
|
49
|
+
/**
|
|
50
|
+
* Inference-usage rows only: the modality of the calls in this row (chat, image, video or embedding).
|
|
51
|
+
*
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @memberof UsageBucket
|
|
54
|
+
*/
|
|
55
|
+
modality?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Inference-usage rows only: the model `id` the calls in this row were made against.
|
|
58
|
+
*
|
|
59
|
+
* @type {string}
|
|
60
|
+
* @memberof UsageBucket
|
|
61
|
+
*/
|
|
62
|
+
model?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Inference-usage rows only. Sum of input tokens; 0 for modalities not billed per token.
|
|
65
|
+
* @type {number}
|
|
66
|
+
* @memberof UsageBucket
|
|
67
|
+
*/
|
|
68
|
+
promptTokens?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Inference-usage rows only. Sum of output tokens; 0 for modalities not billed per token.
|
|
71
|
+
* @type {number}
|
|
72
|
+
* @memberof UsageBucket
|
|
73
|
+
*/
|
|
74
|
+
completionTokens?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Inference-usage rows only. Sum of generated images; 0 for non-image modalities.
|
|
77
|
+
* @type {number}
|
|
78
|
+
* @memberof UsageBucket
|
|
79
|
+
*/
|
|
80
|
+
imageCount?: number;
|
|
48
81
|
}
|
|
49
82
|
/**
|
|
50
83
|
* Check if a given object implements the UsageBucket interface.
|