@deeprelay/sdk 0.1.0 → 0.1.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 +10 -0
- package/README.md +10 -2
- package/dist/apis/BillingApi.d.ts +38 -0
- package/dist/apis/BillingApi.js +96 -0
- package/dist/apis/InferenceApi.d.ts +18 -0
- package/dist/apis/InferenceApi.js +51 -0
- package/dist/esm/apis/BillingApi.d.ts +38 -0
- package/dist/esm/apis/BillingApi.js +96 -0
- package/dist/esm/apis/InferenceApi.d.ts +18 -0
- package/dist/esm/apis/InferenceApi.js +51 -0
- package/dist/esm/models/InferencePreflight.d.ts +92 -0
- package/dist/esm/models/InferencePreflight.js +86 -0
- package/dist/esm/models/SubscriptionCheckoutRequest.d.ts +45 -0
- package/dist/esm/models/SubscriptionCheckoutRequest.js +45 -0
- package/dist/esm/models/SubscriptionCheckoutSession.d.ts +45 -0
- package/dist/esm/models/SubscriptionCheckoutSession.js +52 -0
- package/dist/esm/models/SubscriptionPortalRequest.d.ts +32 -0
- package/dist/esm/models/SubscriptionPortalRequest.js +41 -0
- package/dist/esm/models/SubscriptionPortalSession.d.ts +32 -0
- package/dist/esm/models/SubscriptionPortalSession.js +43 -0
- package/dist/esm/models/index.d.ts +5 -0
- package/dist/esm/models/index.js +5 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/InferencePreflight.d.ts +92 -0
- package/dist/models/InferencePreflight.js +94 -0
- package/dist/models/SubscriptionCheckoutRequest.d.ts +45 -0
- package/dist/models/SubscriptionCheckoutRequest.js +52 -0
- package/dist/models/SubscriptionCheckoutSession.d.ts +45 -0
- package/dist/models/SubscriptionCheckoutSession.js +59 -0
- package/dist/models/SubscriptionPortalRequest.d.ts +32 -0
- package/dist/models/SubscriptionPortalRequest.js +48 -0
- package/dist/models/SubscriptionPortalSession.d.ts +32 -0
- package/dist/models/SubscriptionPortalSession.js +50 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.js +5 -0
- package/dist/runtime.js +1 -1
- package/docs/BillingApi.md +154 -0
- package/docs/InferenceApi.md +74 -0
- package/docs/InferencePreflight.md +47 -0
- package/docs/SubscriptionCheckoutRequest.md +39 -0
- package/docs/SubscriptionCheckoutSession.md +38 -0
- package/docs/SubscriptionPortalRequest.md +35 -0
- package/docs/SubscriptionPortalSession.md +34 -0
- package/package.json +1 -1
- package/src/apis/BillingApi.ts +128 -0
- package/src/apis/InferenceApi.ts +67 -0
- package/src/models/InferencePreflight.ts +147 -0
- package/src/models/SubscriptionCheckoutRequest.ts +82 -0
- package/src/models/SubscriptionCheckoutSession.ts +92 -0
- package/src/models/SubscriptionPortalRequest.ts +65 -0
- package/src/models/SubscriptionPortalSession.ts +66 -0
- package/src/models/index.ts +5 -0
- package/src/runtime.ts +1 -1
package/.openapi-generator/FILES
CHANGED
|
@@ -21,6 +21,7 @@ docs/ImagesResponse.md
|
|
|
21
21
|
docs/ImagesResponseDataInner.md
|
|
22
22
|
docs/ImagesResponseUsage.md
|
|
23
23
|
docs/InferenceApi.md
|
|
24
|
+
docs/InferencePreflight.md
|
|
24
25
|
docs/ListDeposits200Response.md
|
|
25
26
|
docs/MetaApi.md
|
|
26
27
|
docs/Model.md
|
|
@@ -39,7 +40,11 @@ docs/Problem.md
|
|
|
39
40
|
docs/SpendingLimit.md
|
|
40
41
|
docs/StreamOptions.md
|
|
41
42
|
docs/Subscription.md
|
|
43
|
+
docs/SubscriptionCheckoutRequest.md
|
|
44
|
+
docs/SubscriptionCheckoutSession.md
|
|
42
45
|
docs/SubscriptionPlan.md
|
|
46
|
+
docs/SubscriptionPortalRequest.md
|
|
47
|
+
docs/SubscriptionPortalSession.md
|
|
43
48
|
docs/SubscriptionPrice.md
|
|
44
49
|
docs/SubscriptionQuota.md
|
|
45
50
|
docs/SubscriptionUsage.md
|
|
@@ -81,6 +86,7 @@ src/models/ImagesGenerationsRequest.ts
|
|
|
81
86
|
src/models/ImagesResponse.ts
|
|
82
87
|
src/models/ImagesResponseDataInner.ts
|
|
83
88
|
src/models/ImagesResponseUsage.ts
|
|
89
|
+
src/models/InferencePreflight.ts
|
|
84
90
|
src/models/ListDeposits200Response.ts
|
|
85
91
|
src/models/Model.ts
|
|
86
92
|
src/models/ModelList.ts
|
|
@@ -97,7 +103,11 @@ src/models/Problem.ts
|
|
|
97
103
|
src/models/SpendingLimit.ts
|
|
98
104
|
src/models/StreamOptions.ts
|
|
99
105
|
src/models/Subscription.ts
|
|
106
|
+
src/models/SubscriptionCheckoutRequest.ts
|
|
107
|
+
src/models/SubscriptionCheckoutSession.ts
|
|
100
108
|
src/models/SubscriptionPlan.ts
|
|
109
|
+
src/models/SubscriptionPortalRequest.ts
|
|
110
|
+
src/models/SubscriptionPortalSession.ts
|
|
101
111
|
src/models/SubscriptionPrice.ts
|
|
102
112
|
src/models/SubscriptionQuota.ts
|
|
103
113
|
src/models/SubscriptionUsage.ts
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @deeprelay/sdk@0.1.
|
|
1
|
+
# @deeprelay/sdk@0.1.1
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK client for the api.deeprelay.ai API.
|
|
4
4
|
|
|
@@ -55,6 +55,8 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
55
55
|
| Class | Method | HTTP request | Description
|
|
56
56
|
| ----- | ------ | ------------ | -------------
|
|
57
57
|
*BillingApi* | [**createCryptoDeposit**](docs/BillingApi.md#createcryptodepositoperation) | **POST** /billing/deposits/crypto | Create a stablecoin deposit
|
|
58
|
+
*BillingApi* | [**createSubscriptionCheckout**](docs/BillingApi.md#createsubscriptioncheckout) | **POST** /billing/subscription/checkout | Start a subscription checkout session
|
|
59
|
+
*BillingApi* | [**createSubscriptionPortal**](docs/BillingApi.md#createsubscriptionportal) | **POST** /billing/subscription/portal | Open the billing portal to cancel or manage the subscription
|
|
58
60
|
*BillingApi* | [**getBalance**](docs/BillingApi.md#getbalance) | **GET** /billing/balance | Get the org credit balance
|
|
59
61
|
*BillingApi* | [**getDeposit**](docs/BillingApi.md#getdeposit) | **GET** /billing/deposits/{id} | Get one stablecoin deposit
|
|
60
62
|
*BillingApi* | [**getSpendingLimit**](docs/BillingApi.md#getspendinglimit) | **GET** /billing/spending-limit | Get the org spending limit
|
|
@@ -69,6 +71,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
69
71
|
*InferenceApi* | [**getModel**](docs/InferenceApi.md#getmodel) | **GET** /models/{id} | Get a specific model (OpenAI-compatible)
|
|
70
72
|
*InferenceApi* | [**getVideo**](docs/InferenceApi.md#getvideo) | **GET** /videos/{id} | Get a video generation job
|
|
71
73
|
*InferenceApi* | [**getVideoContent**](docs/InferenceApi.md#getvideocontent) | **GET** /videos/{id}/content | Download a completed video artifact
|
|
74
|
+
*InferenceApi* | [**inferencePreflight**](docs/InferenceApi.md#inferencepreflight) | **GET** /inference/preflight | Check whether a model request would be served, and at whose expense
|
|
72
75
|
*InferenceApi* | [**listModels**](docs/InferenceApi.md#listmodels) | **GET** /models | List available models (OpenAI-compatible)
|
|
73
76
|
*InferenceApi* | [**listVideos**](docs/InferenceApi.md#listvideos) | **GET** /videos | List video generation jobs
|
|
74
77
|
*MetaApi* | [**getHealth**](docs/MetaApi.md#gethealth) | **GET** /health | Liveness probe
|
|
@@ -101,6 +104,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
101
104
|
- [ImagesResponse](docs/ImagesResponse.md)
|
|
102
105
|
- [ImagesResponseDataInner](docs/ImagesResponseDataInner.md)
|
|
103
106
|
- [ImagesResponseUsage](docs/ImagesResponseUsage.md)
|
|
107
|
+
- [InferencePreflight](docs/InferencePreflight.md)
|
|
104
108
|
- [ListDeposits200Response](docs/ListDeposits200Response.md)
|
|
105
109
|
- [Model](docs/Model.md)
|
|
106
110
|
- [ModelList](docs/ModelList.md)
|
|
@@ -117,7 +121,11 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
117
121
|
- [SpendingLimit](docs/SpendingLimit.md)
|
|
118
122
|
- [StreamOptions](docs/StreamOptions.md)
|
|
119
123
|
- [Subscription](docs/Subscription.md)
|
|
124
|
+
- [SubscriptionCheckoutRequest](docs/SubscriptionCheckoutRequest.md)
|
|
125
|
+
- [SubscriptionCheckoutSession](docs/SubscriptionCheckoutSession.md)
|
|
120
126
|
- [SubscriptionPlan](docs/SubscriptionPlan.md)
|
|
127
|
+
- [SubscriptionPortalRequest](docs/SubscriptionPortalRequest.md)
|
|
128
|
+
- [SubscriptionPortalSession](docs/SubscriptionPortalSession.md)
|
|
121
129
|
- [SubscriptionPrice](docs/SubscriptionPrice.md)
|
|
122
130
|
- [SubscriptionQuota](docs/SubscriptionQuota.md)
|
|
123
131
|
- [SubscriptionUsage](docs/SubscriptionUsage.md)
|
|
@@ -148,7 +156,7 @@ and is automatically generated by the
|
|
|
148
156
|
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
149
157
|
|
|
150
158
|
- API version: `1.0.0`
|
|
151
|
-
- Package version: `0.1.
|
|
159
|
+
- Package version: `0.1.1`
|
|
152
160
|
- Generator version: `7.24.0`
|
|
153
161
|
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
|
|
154
162
|
|
|
@@ -16,10 +16,20 @@ import { type CryptoDeposit } from '../models/CryptoDeposit';
|
|
|
16
16
|
import { type ListDeposits200Response } from '../models/ListDeposits200Response';
|
|
17
17
|
import { type SpendingLimit } from '../models/SpendingLimit';
|
|
18
18
|
import { type Subscription } from '../models/Subscription';
|
|
19
|
+
import { type SubscriptionCheckoutRequest } from '../models/SubscriptionCheckoutRequest';
|
|
20
|
+
import { type SubscriptionCheckoutSession } from '../models/SubscriptionCheckoutSession';
|
|
21
|
+
import { type SubscriptionPortalRequest } from '../models/SubscriptionPortalRequest';
|
|
22
|
+
import { type SubscriptionPortalSession } from '../models/SubscriptionPortalSession';
|
|
19
23
|
import { type UpdateSpendingLimitRequest } from '../models/UpdateSpendingLimitRequest';
|
|
20
24
|
export interface CreateCryptoDepositOperationRequest {
|
|
21
25
|
createCryptoDepositRequest: CreateCryptoDepositRequest;
|
|
22
26
|
}
|
|
27
|
+
export interface CreateSubscriptionCheckoutRequest {
|
|
28
|
+
subscriptionCheckoutRequest?: SubscriptionCheckoutRequest;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateSubscriptionPortalRequest {
|
|
31
|
+
subscriptionPortalRequest?: SubscriptionPortalRequest;
|
|
32
|
+
}
|
|
23
33
|
export interface GetDepositRequest {
|
|
24
34
|
id: string;
|
|
25
35
|
}
|
|
@@ -44,6 +54,34 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
44
54
|
* Create a stablecoin deposit
|
|
45
55
|
*/
|
|
46
56
|
createCryptoDeposit(requestParameters: CreateCryptoDepositOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
57
|
+
/**
|
|
58
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
59
|
+
*/
|
|
60
|
+
createSubscriptionCheckoutRequestOpts(requestParameters: CreateSubscriptionCheckoutRequest): Promise<runtime.RequestOpts>;
|
|
61
|
+
/**
|
|
62
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
63
|
+
* Start a subscription checkout session
|
|
64
|
+
*/
|
|
65
|
+
createSubscriptionCheckoutRaw(requestParameters: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionCheckoutSession>>;
|
|
66
|
+
/**
|
|
67
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
68
|
+
* Start a subscription checkout session
|
|
69
|
+
*/
|
|
70
|
+
createSubscriptionCheckout(requestParameters?: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionCheckoutSession>;
|
|
71
|
+
/**
|
|
72
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
73
|
+
*/
|
|
74
|
+
createSubscriptionPortalRequestOpts(requestParameters: CreateSubscriptionPortalRequest): Promise<runtime.RequestOpts>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
77
|
+
* Open the billing portal to cancel or manage the subscription
|
|
78
|
+
*/
|
|
79
|
+
createSubscriptionPortalRaw(requestParameters: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionPortalSession>>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
82
|
+
* Open the billing portal to cancel or manage the subscription
|
|
83
|
+
*/
|
|
84
|
+
createSubscriptionPortal(requestParameters?: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPortalSession>;
|
|
47
85
|
/**
|
|
48
86
|
* Creates request options for getBalance without sending the request
|
|
49
87
|
*/
|
package/dist/apis/BillingApi.js
CHANGED
|
@@ -30,6 +30,10 @@ const CryptoDeposit_1 = require("../models/CryptoDeposit");
|
|
|
30
30
|
const ListDeposits200Response_1 = require("../models/ListDeposits200Response");
|
|
31
31
|
const SpendingLimit_1 = require("../models/SpendingLimit");
|
|
32
32
|
const Subscription_1 = require("../models/Subscription");
|
|
33
|
+
const SubscriptionCheckoutRequest_1 = require("../models/SubscriptionCheckoutRequest");
|
|
34
|
+
const SubscriptionCheckoutSession_1 = require("../models/SubscriptionCheckoutSession");
|
|
35
|
+
const SubscriptionPortalRequest_1 = require("../models/SubscriptionPortalRequest");
|
|
36
|
+
const SubscriptionPortalSession_1 = require("../models/SubscriptionPortalSession");
|
|
33
37
|
const UpdateSpendingLimitRequest_1 = require("../models/UpdateSpendingLimitRequest");
|
|
34
38
|
/**
|
|
35
39
|
*
|
|
@@ -84,6 +88,98 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
84
88
|
return yield response.value();
|
|
85
89
|
});
|
|
86
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
93
|
+
*/
|
|
94
|
+
createSubscriptionCheckoutRequestOpts(requestParameters) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const queryParameters = {};
|
|
97
|
+
const headerParameters = {};
|
|
98
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
99
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
100
|
+
const token = this.configuration.accessToken;
|
|
101
|
+
const tokenString = yield token("bearerAuth", []);
|
|
102
|
+
if (tokenString) {
|
|
103
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
let urlPath = `/billing/subscription/checkout`;
|
|
107
|
+
return {
|
|
108
|
+
path: urlPath,
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers: headerParameters,
|
|
111
|
+
query: queryParameters,
|
|
112
|
+
body: (0, SubscriptionCheckoutRequest_1.SubscriptionCheckoutRequestToJSON)(requestParameters['subscriptionCheckoutRequest']),
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
118
|
+
* Start a subscription checkout session
|
|
119
|
+
*/
|
|
120
|
+
createSubscriptionCheckoutRaw(requestParameters, initOverrides) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const requestOptions = yield this.createSubscriptionCheckoutRequestOpts(requestParameters);
|
|
123
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
124
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, SubscriptionCheckoutSession_1.SubscriptionCheckoutSessionFromJSON)(jsonValue));
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
129
|
+
* Start a subscription checkout session
|
|
130
|
+
*/
|
|
131
|
+
createSubscriptionCheckout() {
|
|
132
|
+
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
|
|
133
|
+
const response = yield this.createSubscriptionCheckoutRaw(requestParameters, initOverrides);
|
|
134
|
+
return yield response.value();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
139
|
+
*/
|
|
140
|
+
createSubscriptionPortalRequestOpts(requestParameters) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
const queryParameters = {};
|
|
143
|
+
const headerParameters = {};
|
|
144
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
145
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
146
|
+
const token = this.configuration.accessToken;
|
|
147
|
+
const tokenString = yield token("bearerAuth", []);
|
|
148
|
+
if (tokenString) {
|
|
149
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
let urlPath = `/billing/subscription/portal`;
|
|
153
|
+
return {
|
|
154
|
+
path: urlPath,
|
|
155
|
+
method: 'POST',
|
|
156
|
+
headers: headerParameters,
|
|
157
|
+
query: queryParameters,
|
|
158
|
+
body: (0, SubscriptionPortalRequest_1.SubscriptionPortalRequestToJSON)(requestParameters['subscriptionPortalRequest']),
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
164
|
+
* Open the billing portal to cancel or manage the subscription
|
|
165
|
+
*/
|
|
166
|
+
createSubscriptionPortalRaw(requestParameters, initOverrides) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const requestOptions = yield this.createSubscriptionPortalRequestOpts(requestParameters);
|
|
169
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
170
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, SubscriptionPortalSession_1.SubscriptionPortalSessionFromJSON)(jsonValue));
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
175
|
+
* Open the billing portal to cancel or manage the subscription
|
|
176
|
+
*/
|
|
177
|
+
createSubscriptionPortal() {
|
|
178
|
+
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
|
|
179
|
+
const response = yield this.createSubscriptionPortalRaw(requestParameters, initOverrides);
|
|
180
|
+
return yield response.value();
|
|
181
|
+
});
|
|
182
|
+
}
|
|
87
183
|
/**
|
|
88
184
|
* Creates request options for getBalance without sending the request
|
|
89
185
|
*/
|
|
@@ -16,6 +16,7 @@ import { type EmbeddingsRequest } from '../models/EmbeddingsRequest';
|
|
|
16
16
|
import { type EmbeddingsResponse } from '../models/EmbeddingsResponse';
|
|
17
17
|
import { type ImagesGenerationsRequest } from '../models/ImagesGenerationsRequest';
|
|
18
18
|
import { type ImagesResponse } from '../models/ImagesResponse';
|
|
19
|
+
import { type InferencePreflight } from '../models/InferencePreflight';
|
|
19
20
|
import { type Model } from '../models/Model';
|
|
20
21
|
import { type ModelList } from '../models/ModelList';
|
|
21
22
|
import { type VideoCreateRequest } from '../models/VideoCreateRequest';
|
|
@@ -47,6 +48,9 @@ export interface GetVideoRequest {
|
|
|
47
48
|
export interface GetVideoContentRequest {
|
|
48
49
|
id: string;
|
|
49
50
|
}
|
|
51
|
+
export interface InferencePreflightRequest {
|
|
52
|
+
model: string;
|
|
53
|
+
}
|
|
50
54
|
export interface ListModelsRequest {
|
|
51
55
|
modality?: ListModelsModalityEnum;
|
|
52
56
|
}
|
|
@@ -162,6 +166,20 @@ export declare class InferenceApi extends runtime.BaseAPI {
|
|
|
162
166
|
* Download a completed video artifact
|
|
163
167
|
*/
|
|
164
168
|
getVideoContent(requestParameters: GetVideoContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob>;
|
|
169
|
+
/**
|
|
170
|
+
* Creates request options for inferencePreflight without sending the request
|
|
171
|
+
*/
|
|
172
|
+
inferencePreflightRequestOpts(requestParameters: InferencePreflightRequest): Promise<runtime.RequestOpts>;
|
|
173
|
+
/**
|
|
174
|
+
* Answers \"what happens if I call this model right now?\" before the call is made: whether the plan covers the model, whether the organization is subscribed, and whether there is credit to pay if it is not covered. Requires the `serverless:read` scope. Nothing is sent, counted, charged, or reserved. The verdict is computed from the state of the SAME gates that judge the real request — plan coverage, subscription entitlement, remaining plan quota, credit balance and self-set spending caps — so the advice cannot drift from enforcement. It is deliberately NOT a dry run: no per-request cost estimate is quoted, because that figure changes with every prompt and quoting it would invite clients to cache it. The gates consulted depend on the model\'s MODALITY, because the endpoints do not all meet the same ones. Chat, embeddings and image requests meet the full gate (balance, then the organization\'s opt-in daily cap, then its monthly cap). Video creation meets only the balance check, so an organization past its own spending cap but holding credit is reported as fundable for video — which is what the video endpoint will in fact do. Predicting the strictest gate rather than the applicable one would make this endpoint refuse requests the API accepts. The same is true of the plan: video creation does not run the subscription gate, so `plan_covered` is false for a video model even if an operator has placed it on the plan\'s covered list. That is a deliberate divergence from the same-named field on `/v1/models`, which reports the platform\'s configuration. Here it means \"the plan covers this REQUEST\" — describing what will happen is the entire job of a preflight. One caveat on \"read-only\": resolving the balance creates the organization\'s balance row if it has never had one (idempotent, org-scoped, and the same row the first real request would create). Nothing else is written. The case this exists for is `warn` / `not_plan_covered`. A subscriber calling a model outside the plan IS served and IS charged pay-as-you-go, and nothing in the response to that request says so — the first signal used to be the invoice. `funded` is a boolean and never a figure. This route is on the inference read scope, so it must not disclose the organization\'s balance; use `/billing/balance` for the number. Failure posture is the opposite of the request gate\'s: any gate that cannot be read degrades the verdict toward `ok`, never toward `block`. A false `block` would stop a customer whose request would have succeeded, while a false `ok` costs them one honest error from the real call.
|
|
175
|
+
* Check whether a model request would be served, and at whose expense
|
|
176
|
+
*/
|
|
177
|
+
inferencePreflightRaw(requestParameters: InferencePreflightRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InferencePreflight>>;
|
|
178
|
+
/**
|
|
179
|
+
* Answers \"what happens if I call this model right now?\" before the call is made: whether the plan covers the model, whether the organization is subscribed, and whether there is credit to pay if it is not covered. Requires the `serverless:read` scope. Nothing is sent, counted, charged, or reserved. The verdict is computed from the state of the SAME gates that judge the real request — plan coverage, subscription entitlement, remaining plan quota, credit balance and self-set spending caps — so the advice cannot drift from enforcement. It is deliberately NOT a dry run: no per-request cost estimate is quoted, because that figure changes with every prompt and quoting it would invite clients to cache it. The gates consulted depend on the model\'s MODALITY, because the endpoints do not all meet the same ones. Chat, embeddings and image requests meet the full gate (balance, then the organization\'s opt-in daily cap, then its monthly cap). Video creation meets only the balance check, so an organization past its own spending cap but holding credit is reported as fundable for video — which is what the video endpoint will in fact do. Predicting the strictest gate rather than the applicable one would make this endpoint refuse requests the API accepts. The same is true of the plan: video creation does not run the subscription gate, so `plan_covered` is false for a video model even if an operator has placed it on the plan\'s covered list. That is a deliberate divergence from the same-named field on `/v1/models`, which reports the platform\'s configuration. Here it means \"the plan covers this REQUEST\" — describing what will happen is the entire job of a preflight. One caveat on \"read-only\": resolving the balance creates the organization\'s balance row if it has never had one (idempotent, org-scoped, and the same row the first real request would create). Nothing else is written. The case this exists for is `warn` / `not_plan_covered`. A subscriber calling a model outside the plan IS served and IS charged pay-as-you-go, and nothing in the response to that request says so — the first signal used to be the invoice. `funded` is a boolean and never a figure. This route is on the inference read scope, so it must not disclose the organization\'s balance; use `/billing/balance` for the number. Failure posture is the opposite of the request gate\'s: any gate that cannot be read degrades the verdict toward `ok`, never toward `block`. A false `block` would stop a customer whose request would have succeeded, while a false `ok` costs them one honest error from the real call.
|
|
180
|
+
* Check whether a model request would be served, and at whose expense
|
|
181
|
+
*/
|
|
182
|
+
inferencePreflight(requestParameters: InferencePreflightRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InferencePreflight>;
|
|
165
183
|
/**
|
|
166
184
|
* Creates request options for listModels without sending the request
|
|
167
185
|
*/
|
|
@@ -30,6 +30,7 @@ const EmbeddingsRequest_1 = require("../models/EmbeddingsRequest");
|
|
|
30
30
|
const EmbeddingsResponse_1 = require("../models/EmbeddingsResponse");
|
|
31
31
|
const ImagesGenerationsRequest_1 = require("../models/ImagesGenerationsRequest");
|
|
32
32
|
const ImagesResponse_1 = require("../models/ImagesResponse");
|
|
33
|
+
const InferencePreflight_1 = require("../models/InferencePreflight");
|
|
33
34
|
const Model_1 = require("../models/Model");
|
|
34
35
|
const ModelList_1 = require("../models/ModelList");
|
|
35
36
|
const VideoCreateRequest_1 = require("../models/VideoCreateRequest");
|
|
@@ -425,6 +426,56 @@ class InferenceApi extends runtime.BaseAPI {
|
|
|
425
426
|
return yield response.value();
|
|
426
427
|
});
|
|
427
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* Creates request options for inferencePreflight without sending the request
|
|
431
|
+
*/
|
|
432
|
+
inferencePreflightRequestOpts(requestParameters) {
|
|
433
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
434
|
+
if (requestParameters['model'] == null) {
|
|
435
|
+
throw new runtime.RequiredError('model', 'Required parameter "model" was null or undefined when calling inferencePreflight().');
|
|
436
|
+
}
|
|
437
|
+
const queryParameters = {};
|
|
438
|
+
if (requestParameters['model'] != null) {
|
|
439
|
+
queryParameters['model'] = requestParameters['model'];
|
|
440
|
+
}
|
|
441
|
+
const headerParameters = {};
|
|
442
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
443
|
+
const token = this.configuration.accessToken;
|
|
444
|
+
const tokenString = yield token("bearerAuth", []);
|
|
445
|
+
if (tokenString) {
|
|
446
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
let urlPath = `/inference/preflight`;
|
|
450
|
+
return {
|
|
451
|
+
path: urlPath,
|
|
452
|
+
method: 'GET',
|
|
453
|
+
headers: headerParameters,
|
|
454
|
+
query: queryParameters,
|
|
455
|
+
};
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Answers \"what happens if I call this model right now?\" before the call is made: whether the plan covers the model, whether the organization is subscribed, and whether there is credit to pay if it is not covered. Requires the `serverless:read` scope. Nothing is sent, counted, charged, or reserved. The verdict is computed from the state of the SAME gates that judge the real request — plan coverage, subscription entitlement, remaining plan quota, credit balance and self-set spending caps — so the advice cannot drift from enforcement. It is deliberately NOT a dry run: no per-request cost estimate is quoted, because that figure changes with every prompt and quoting it would invite clients to cache it. The gates consulted depend on the model\'s MODALITY, because the endpoints do not all meet the same ones. Chat, embeddings and image requests meet the full gate (balance, then the organization\'s opt-in daily cap, then its monthly cap). Video creation meets only the balance check, so an organization past its own spending cap but holding credit is reported as fundable for video — which is what the video endpoint will in fact do. Predicting the strictest gate rather than the applicable one would make this endpoint refuse requests the API accepts. The same is true of the plan: video creation does not run the subscription gate, so `plan_covered` is false for a video model even if an operator has placed it on the plan\'s covered list. That is a deliberate divergence from the same-named field on `/v1/models`, which reports the platform\'s configuration. Here it means \"the plan covers this REQUEST\" — describing what will happen is the entire job of a preflight. One caveat on \"read-only\": resolving the balance creates the organization\'s balance row if it has never had one (idempotent, org-scoped, and the same row the first real request would create). Nothing else is written. The case this exists for is `warn` / `not_plan_covered`. A subscriber calling a model outside the plan IS served and IS charged pay-as-you-go, and nothing in the response to that request says so — the first signal used to be the invoice. `funded` is a boolean and never a figure. This route is on the inference read scope, so it must not disclose the organization\'s balance; use `/billing/balance` for the number. Failure posture is the opposite of the request gate\'s: any gate that cannot be read degrades the verdict toward `ok`, never toward `block`. A false `block` would stop a customer whose request would have succeeded, while a false `ok` costs them one honest error from the real call.
|
|
460
|
+
* Check whether a model request would be served, and at whose expense
|
|
461
|
+
*/
|
|
462
|
+
inferencePreflightRaw(requestParameters, initOverrides) {
|
|
463
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
464
|
+
const requestOptions = yield this.inferencePreflightRequestOpts(requestParameters);
|
|
465
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
466
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, InferencePreflight_1.InferencePreflightFromJSON)(jsonValue));
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Answers \"what happens if I call this model right now?\" before the call is made: whether the plan covers the model, whether the organization is subscribed, and whether there is credit to pay if it is not covered. Requires the `serverless:read` scope. Nothing is sent, counted, charged, or reserved. The verdict is computed from the state of the SAME gates that judge the real request — plan coverage, subscription entitlement, remaining plan quota, credit balance and self-set spending caps — so the advice cannot drift from enforcement. It is deliberately NOT a dry run: no per-request cost estimate is quoted, because that figure changes with every prompt and quoting it would invite clients to cache it. The gates consulted depend on the model\'s MODALITY, because the endpoints do not all meet the same ones. Chat, embeddings and image requests meet the full gate (balance, then the organization\'s opt-in daily cap, then its monthly cap). Video creation meets only the balance check, so an organization past its own spending cap but holding credit is reported as fundable for video — which is what the video endpoint will in fact do. Predicting the strictest gate rather than the applicable one would make this endpoint refuse requests the API accepts. The same is true of the plan: video creation does not run the subscription gate, so `plan_covered` is false for a video model even if an operator has placed it on the plan\'s covered list. That is a deliberate divergence from the same-named field on `/v1/models`, which reports the platform\'s configuration. Here it means \"the plan covers this REQUEST\" — describing what will happen is the entire job of a preflight. One caveat on \"read-only\": resolving the balance creates the organization\'s balance row if it has never had one (idempotent, org-scoped, and the same row the first real request would create). Nothing else is written. The case this exists for is `warn` / `not_plan_covered`. A subscriber calling a model outside the plan IS served and IS charged pay-as-you-go, and nothing in the response to that request says so — the first signal used to be the invoice. `funded` is a boolean and never a figure. This route is on the inference read scope, so it must not disclose the organization\'s balance; use `/billing/balance` for the number. Failure posture is the opposite of the request gate\'s: any gate that cannot be read degrades the verdict toward `ok`, never toward `block`. A false `block` would stop a customer whose request would have succeeded, while a false `ok` costs them one honest error from the real call.
|
|
471
|
+
* Check whether a model request would be served, and at whose expense
|
|
472
|
+
*/
|
|
473
|
+
inferencePreflight(requestParameters, initOverrides) {
|
|
474
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
475
|
+
const response = yield this.inferencePreflightRaw(requestParameters, initOverrides);
|
|
476
|
+
return yield response.value();
|
|
477
|
+
});
|
|
478
|
+
}
|
|
428
479
|
/**
|
|
429
480
|
* Creates request options for listModels without sending the request
|
|
430
481
|
*/
|
|
@@ -16,10 +16,20 @@ import { type CryptoDeposit } from '../models/CryptoDeposit';
|
|
|
16
16
|
import { type ListDeposits200Response } from '../models/ListDeposits200Response';
|
|
17
17
|
import { type SpendingLimit } from '../models/SpendingLimit';
|
|
18
18
|
import { type Subscription } from '../models/Subscription';
|
|
19
|
+
import { type SubscriptionCheckoutRequest } from '../models/SubscriptionCheckoutRequest';
|
|
20
|
+
import { type SubscriptionCheckoutSession } from '../models/SubscriptionCheckoutSession';
|
|
21
|
+
import { type SubscriptionPortalRequest } from '../models/SubscriptionPortalRequest';
|
|
22
|
+
import { type SubscriptionPortalSession } from '../models/SubscriptionPortalSession';
|
|
19
23
|
import { type UpdateSpendingLimitRequest } from '../models/UpdateSpendingLimitRequest';
|
|
20
24
|
export interface CreateCryptoDepositOperationRequest {
|
|
21
25
|
createCryptoDepositRequest: CreateCryptoDepositRequest;
|
|
22
26
|
}
|
|
27
|
+
export interface CreateSubscriptionCheckoutRequest {
|
|
28
|
+
subscriptionCheckoutRequest?: SubscriptionCheckoutRequest;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateSubscriptionPortalRequest {
|
|
31
|
+
subscriptionPortalRequest?: SubscriptionPortalRequest;
|
|
32
|
+
}
|
|
23
33
|
export interface GetDepositRequest {
|
|
24
34
|
id: string;
|
|
25
35
|
}
|
|
@@ -44,6 +54,34 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
44
54
|
* Create a stablecoin deposit
|
|
45
55
|
*/
|
|
46
56
|
createCryptoDeposit(requestParameters: CreateCryptoDepositOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
57
|
+
/**
|
|
58
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
59
|
+
*/
|
|
60
|
+
createSubscriptionCheckoutRequestOpts(requestParameters: CreateSubscriptionCheckoutRequest): Promise<runtime.RequestOpts>;
|
|
61
|
+
/**
|
|
62
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
63
|
+
* Start a subscription checkout session
|
|
64
|
+
*/
|
|
65
|
+
createSubscriptionCheckoutRaw(requestParameters: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionCheckoutSession>>;
|
|
66
|
+
/**
|
|
67
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
68
|
+
* Start a subscription checkout session
|
|
69
|
+
*/
|
|
70
|
+
createSubscriptionCheckout(requestParameters?: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionCheckoutSession>;
|
|
71
|
+
/**
|
|
72
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
73
|
+
*/
|
|
74
|
+
createSubscriptionPortalRequestOpts(requestParameters: CreateSubscriptionPortalRequest): Promise<runtime.RequestOpts>;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
77
|
+
* Open the billing portal to cancel or manage the subscription
|
|
78
|
+
*/
|
|
79
|
+
createSubscriptionPortalRaw(requestParameters: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionPortalSession>>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
82
|
+
* Open the billing portal to cancel or manage the subscription
|
|
83
|
+
*/
|
|
84
|
+
createSubscriptionPortal(requestParameters?: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPortalSession>;
|
|
47
85
|
/**
|
|
48
86
|
* Creates request options for getBalance without sending the request
|
|
49
87
|
*/
|
|
@@ -27,6 +27,10 @@ import { CryptoDepositFromJSON, } from '../models/CryptoDeposit';
|
|
|
27
27
|
import { ListDeposits200ResponseFromJSON, } from '../models/ListDeposits200Response';
|
|
28
28
|
import { SpendingLimitFromJSON, } from '../models/SpendingLimit';
|
|
29
29
|
import { SubscriptionFromJSON, } from '../models/Subscription';
|
|
30
|
+
import { SubscriptionCheckoutRequestToJSON, } from '../models/SubscriptionCheckoutRequest';
|
|
31
|
+
import { SubscriptionCheckoutSessionFromJSON, } from '../models/SubscriptionCheckoutSession';
|
|
32
|
+
import { SubscriptionPortalRequestToJSON, } from '../models/SubscriptionPortalRequest';
|
|
33
|
+
import { SubscriptionPortalSessionFromJSON, } from '../models/SubscriptionPortalSession';
|
|
30
34
|
import { UpdateSpendingLimitRequestToJSON, } from '../models/UpdateSpendingLimitRequest';
|
|
31
35
|
/**
|
|
32
36
|
*
|
|
@@ -81,6 +85,98 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
81
85
|
return yield response.value();
|
|
82
86
|
});
|
|
83
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
90
|
+
*/
|
|
91
|
+
createSubscriptionCheckoutRequestOpts(requestParameters) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const queryParameters = {};
|
|
94
|
+
const headerParameters = {};
|
|
95
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
96
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
97
|
+
const token = this.configuration.accessToken;
|
|
98
|
+
const tokenString = yield token("bearerAuth", []);
|
|
99
|
+
if (tokenString) {
|
|
100
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
let urlPath = `/billing/subscription/checkout`;
|
|
104
|
+
return {
|
|
105
|
+
path: urlPath,
|
|
106
|
+
method: 'POST',
|
|
107
|
+
headers: headerParameters,
|
|
108
|
+
query: queryParameters,
|
|
109
|
+
body: SubscriptionCheckoutRequestToJSON(requestParameters['subscriptionCheckoutRequest']),
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
115
|
+
* Start a subscription checkout session
|
|
116
|
+
*/
|
|
117
|
+
createSubscriptionCheckoutRaw(requestParameters, initOverrides) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
const requestOptions = yield this.createSubscriptionCheckoutRequestOpts(requestParameters);
|
|
120
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
121
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionCheckoutSessionFromJSON(jsonValue));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Opens a hosted checkout session for the flat tier and returns its URL. Requires the `billing:write` scope AND organization-admin privileges — subscribing spends organization money. This endpoint does NOT subscribe anyone. Checkout is a hosted page that needs a browser and a card, so the caller\'s job is to put the returned URL in front of a human. The subscription becomes active when payment completes, which is not synchronous with this call: poll `/billing/subscription` to confirm. `success_url` and `cancel_url` are optional and fall back to the deployment\'s configured redirects, which is what lets a command-line client start a purchase without having any URLs of its own. An empty request body is valid and means \"use every default\". `plan_key`, when sent, pins the plan the client DISPLAYED: an unknown key is a 400 rather than a silent purchase of a different tier. Today there is one tier, so the only accepted value is its key — but sending it is the forward-compatible choice. One flat tier means at most one subscription per organization: a second checkout while an entitling subscription exists is a 409.
|
|
126
|
+
* Start a subscription checkout session
|
|
127
|
+
*/
|
|
128
|
+
createSubscriptionCheckout() {
|
|
129
|
+
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
|
|
130
|
+
const response = yield this.createSubscriptionCheckoutRaw(requestParameters, initOverrides);
|
|
131
|
+
return yield response.value();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
136
|
+
*/
|
|
137
|
+
createSubscriptionPortalRequestOpts(requestParameters) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
const queryParameters = {};
|
|
140
|
+
const headerParameters = {};
|
|
141
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
142
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
143
|
+
const token = this.configuration.accessToken;
|
|
144
|
+
const tokenString = yield token("bearerAuth", []);
|
|
145
|
+
if (tokenString) {
|
|
146
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
let urlPath = `/billing/subscription/portal`;
|
|
150
|
+
return {
|
|
151
|
+
path: urlPath,
|
|
152
|
+
method: 'POST',
|
|
153
|
+
headers: headerParameters,
|
|
154
|
+
query: queryParameters,
|
|
155
|
+
body: SubscriptionPortalRequestToJSON(requestParameters['subscriptionPortalRequest']),
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
161
|
+
* Open the billing portal to cancel or manage the subscription
|
|
162
|
+
*/
|
|
163
|
+
createSubscriptionPortalRaw(requestParameters, initOverrides) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
const requestOptions = yield this.createSubscriptionPortalRequestOpts(requestParameters);
|
|
166
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
167
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionPortalSessionFromJSON(jsonValue));
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Returns a URL for the hosted billing portal: where a customer cancels the subscription, resumes one they cancelled, changes payment method, or downloads invoices. Requires the `billing:write` scope AND organization-admin privileges. Cancellation lives here rather than on its own endpoint because it is one surface with the rest of the billing lifecycle. The common reason a subscription is about to lapse is a declined card, and the fix for that is a new card, not a cancellation — sending a customer somewhere that can only cancel would lose renewals. Cancelling in the portal ends the subscription at the close of the current period; coverage continues until then and `/billing/subscription` reports `cancel_at_period_end: true`. An organization that has never paid for anything gets 404: there is no billing account to manage, and this endpoint deliberately does not create one as a side effect of looking.
|
|
172
|
+
* Open the billing portal to cancel or manage the subscription
|
|
173
|
+
*/
|
|
174
|
+
createSubscriptionPortal() {
|
|
175
|
+
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
|
|
176
|
+
const response = yield this.createSubscriptionPortalRaw(requestParameters, initOverrides);
|
|
177
|
+
return yield response.value();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
84
180
|
/**
|
|
85
181
|
* Creates request options for getBalance without sending the request
|
|
86
182
|
*/
|
|
@@ -16,6 +16,7 @@ import { type EmbeddingsRequest } from '../models/EmbeddingsRequest';
|
|
|
16
16
|
import { type EmbeddingsResponse } from '../models/EmbeddingsResponse';
|
|
17
17
|
import { type ImagesGenerationsRequest } from '../models/ImagesGenerationsRequest';
|
|
18
18
|
import { type ImagesResponse } from '../models/ImagesResponse';
|
|
19
|
+
import { type InferencePreflight } from '../models/InferencePreflight';
|
|
19
20
|
import { type Model } from '../models/Model';
|
|
20
21
|
import { type ModelList } from '../models/ModelList';
|
|
21
22
|
import { type VideoCreateRequest } from '../models/VideoCreateRequest';
|
|
@@ -47,6 +48,9 @@ export interface GetVideoRequest {
|
|
|
47
48
|
export interface GetVideoContentRequest {
|
|
48
49
|
id: string;
|
|
49
50
|
}
|
|
51
|
+
export interface InferencePreflightRequest {
|
|
52
|
+
model: string;
|
|
53
|
+
}
|
|
50
54
|
export interface ListModelsRequest {
|
|
51
55
|
modality?: ListModelsModalityEnum;
|
|
52
56
|
}
|
|
@@ -162,6 +166,20 @@ export declare class InferenceApi extends runtime.BaseAPI {
|
|
|
162
166
|
* Download a completed video artifact
|
|
163
167
|
*/
|
|
164
168
|
getVideoContent(requestParameters: GetVideoContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob>;
|
|
169
|
+
/**
|
|
170
|
+
* Creates request options for inferencePreflight without sending the request
|
|
171
|
+
*/
|
|
172
|
+
inferencePreflightRequestOpts(requestParameters: InferencePreflightRequest): Promise<runtime.RequestOpts>;
|
|
173
|
+
/**
|
|
174
|
+
* Answers \"what happens if I call this model right now?\" before the call is made: whether the plan covers the model, whether the organization is subscribed, and whether there is credit to pay if it is not covered. Requires the `serverless:read` scope. Nothing is sent, counted, charged, or reserved. The verdict is computed from the state of the SAME gates that judge the real request — plan coverage, subscription entitlement, remaining plan quota, credit balance and self-set spending caps — so the advice cannot drift from enforcement. It is deliberately NOT a dry run: no per-request cost estimate is quoted, because that figure changes with every prompt and quoting it would invite clients to cache it. The gates consulted depend on the model\'s MODALITY, because the endpoints do not all meet the same ones. Chat, embeddings and image requests meet the full gate (balance, then the organization\'s opt-in daily cap, then its monthly cap). Video creation meets only the balance check, so an organization past its own spending cap but holding credit is reported as fundable for video — which is what the video endpoint will in fact do. Predicting the strictest gate rather than the applicable one would make this endpoint refuse requests the API accepts. The same is true of the plan: video creation does not run the subscription gate, so `plan_covered` is false for a video model even if an operator has placed it on the plan\'s covered list. That is a deliberate divergence from the same-named field on `/v1/models`, which reports the platform\'s configuration. Here it means \"the plan covers this REQUEST\" — describing what will happen is the entire job of a preflight. One caveat on \"read-only\": resolving the balance creates the organization\'s balance row if it has never had one (idempotent, org-scoped, and the same row the first real request would create). Nothing else is written. The case this exists for is `warn` / `not_plan_covered`. A subscriber calling a model outside the plan IS served and IS charged pay-as-you-go, and nothing in the response to that request says so — the first signal used to be the invoice. `funded` is a boolean and never a figure. This route is on the inference read scope, so it must not disclose the organization\'s balance; use `/billing/balance` for the number. Failure posture is the opposite of the request gate\'s: any gate that cannot be read degrades the verdict toward `ok`, never toward `block`. A false `block` would stop a customer whose request would have succeeded, while a false `ok` costs them one honest error from the real call.
|
|
175
|
+
* Check whether a model request would be served, and at whose expense
|
|
176
|
+
*/
|
|
177
|
+
inferencePreflightRaw(requestParameters: InferencePreflightRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InferencePreflight>>;
|
|
178
|
+
/**
|
|
179
|
+
* Answers \"what happens if I call this model right now?\" before the call is made: whether the plan covers the model, whether the organization is subscribed, and whether there is credit to pay if it is not covered. Requires the `serverless:read` scope. Nothing is sent, counted, charged, or reserved. The verdict is computed from the state of the SAME gates that judge the real request — plan coverage, subscription entitlement, remaining plan quota, credit balance and self-set spending caps — so the advice cannot drift from enforcement. It is deliberately NOT a dry run: no per-request cost estimate is quoted, because that figure changes with every prompt and quoting it would invite clients to cache it. The gates consulted depend on the model\'s MODALITY, because the endpoints do not all meet the same ones. Chat, embeddings and image requests meet the full gate (balance, then the organization\'s opt-in daily cap, then its monthly cap). Video creation meets only the balance check, so an organization past its own spending cap but holding credit is reported as fundable for video — which is what the video endpoint will in fact do. Predicting the strictest gate rather than the applicable one would make this endpoint refuse requests the API accepts. The same is true of the plan: video creation does not run the subscription gate, so `plan_covered` is false for a video model even if an operator has placed it on the plan\'s covered list. That is a deliberate divergence from the same-named field on `/v1/models`, which reports the platform\'s configuration. Here it means \"the plan covers this REQUEST\" — describing what will happen is the entire job of a preflight. One caveat on \"read-only\": resolving the balance creates the organization\'s balance row if it has never had one (idempotent, org-scoped, and the same row the first real request would create). Nothing else is written. The case this exists for is `warn` / `not_plan_covered`. A subscriber calling a model outside the plan IS served and IS charged pay-as-you-go, and nothing in the response to that request says so — the first signal used to be the invoice. `funded` is a boolean and never a figure. This route is on the inference read scope, so it must not disclose the organization\'s balance; use `/billing/balance` for the number. Failure posture is the opposite of the request gate\'s: any gate that cannot be read degrades the verdict toward `ok`, never toward `block`. A false `block` would stop a customer whose request would have succeeded, while a false `ok` costs them one honest error from the real call.
|
|
180
|
+
* Check whether a model request would be served, and at whose expense
|
|
181
|
+
*/
|
|
182
|
+
inferencePreflight(requestParameters: InferencePreflightRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InferencePreflight>;
|
|
165
183
|
/**
|
|
166
184
|
* Creates request options for listModels without sending the request
|
|
167
185
|
*/
|