@deeprelay/sdk 0.1.0 → 0.1.2
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 +14 -0
- package/README.md +13 -2
- package/dist/apis/BillingApi.d.ts +53 -0
- package/dist/apis/BillingApi.js +141 -0
- package/dist/apis/InferenceApi.d.ts +18 -0
- package/dist/apis/InferenceApi.js +51 -0
- package/dist/esm/apis/BillingApi.d.ts +53 -0
- package/dist/esm/apis/BillingApi.js +141 -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/RefereeStatus.d.ts +79 -0
- package/dist/esm/models/RefereeStatus.js +70 -0
- package/dist/esm/models/Referral.d.ts +94 -0
- package/dist/esm/models/Referral.js +82 -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/VideoJob.d.ts +6 -0
- package/dist/esm/models/VideoJob.js +2 -0
- package/dist/esm/models/index.d.ts +7 -0
- package/dist/esm/models/index.js +7 -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/RefereeStatus.d.ts +79 -0
- package/dist/models/RefereeStatus.js +78 -0
- package/dist/models/Referral.d.ts +94 -0
- package/dist/models/Referral.js +89 -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/VideoJob.d.ts +6 -0
- package/dist/models/VideoJob.js +2 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.js +7 -0
- package/dist/runtime.js +1 -1
- package/docs/BillingApi.md +220 -0
- package/docs/InferenceApi.md +74 -0
- package/docs/InferencePreflight.md +47 -0
- package/docs/RefereeStatus.md +47 -0
- package/docs/Referral.md +55 -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/docs/VideoJob.md +2 -0
- package/package.json +1 -1
- package/src/apis/BillingApi.ts +180 -0
- package/src/apis/InferenceApi.ts +67 -0
- package/src/models/InferencePreflight.ts +147 -0
- package/src/models/RefereeStatus.ts +131 -0
- package/src/models/Referral.ts +164 -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/VideoJob.ts +8 -0
- package/src/models/index.ts +7 -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
|
|
@@ -36,10 +37,16 @@ docs/OperationResult.md
|
|
|
36
37
|
docs/OperationsApi.md
|
|
37
38
|
docs/PeakWindow.md
|
|
38
39
|
docs/Problem.md
|
|
40
|
+
docs/RefereeStatus.md
|
|
41
|
+
docs/Referral.md
|
|
39
42
|
docs/SpendingLimit.md
|
|
40
43
|
docs/StreamOptions.md
|
|
41
44
|
docs/Subscription.md
|
|
45
|
+
docs/SubscriptionCheckoutRequest.md
|
|
46
|
+
docs/SubscriptionCheckoutSession.md
|
|
42
47
|
docs/SubscriptionPlan.md
|
|
48
|
+
docs/SubscriptionPortalRequest.md
|
|
49
|
+
docs/SubscriptionPortalSession.md
|
|
43
50
|
docs/SubscriptionPrice.md
|
|
44
51
|
docs/SubscriptionQuota.md
|
|
45
52
|
docs/SubscriptionUsage.md
|
|
@@ -81,6 +88,7 @@ src/models/ImagesGenerationsRequest.ts
|
|
|
81
88
|
src/models/ImagesResponse.ts
|
|
82
89
|
src/models/ImagesResponseDataInner.ts
|
|
83
90
|
src/models/ImagesResponseUsage.ts
|
|
91
|
+
src/models/InferencePreflight.ts
|
|
84
92
|
src/models/ListDeposits200Response.ts
|
|
85
93
|
src/models/Model.ts
|
|
86
94
|
src/models/ModelList.ts
|
|
@@ -94,10 +102,16 @@ src/models/OperationError.ts
|
|
|
94
102
|
src/models/OperationResult.ts
|
|
95
103
|
src/models/PeakWindow.ts
|
|
96
104
|
src/models/Problem.ts
|
|
105
|
+
src/models/RefereeStatus.ts
|
|
106
|
+
src/models/Referral.ts
|
|
97
107
|
src/models/SpendingLimit.ts
|
|
98
108
|
src/models/StreamOptions.ts
|
|
99
109
|
src/models/Subscription.ts
|
|
110
|
+
src/models/SubscriptionCheckoutRequest.ts
|
|
111
|
+
src/models/SubscriptionCheckoutSession.ts
|
|
100
112
|
src/models/SubscriptionPlan.ts
|
|
113
|
+
src/models/SubscriptionPortalRequest.ts
|
|
114
|
+
src/models/SubscriptionPortalSession.ts
|
|
101
115
|
src/models/SubscriptionPrice.ts
|
|
102
116
|
src/models/SubscriptionQuota.ts
|
|
103
117
|
src/models/SubscriptionUsage.ts
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @deeprelay/sdk@0.1.
|
|
1
|
+
# @deeprelay/sdk@0.1.2
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK client for the api.deeprelay.ai API.
|
|
4
4
|
|
|
@@ -55,8 +55,11 @@ 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
|
|
62
|
+
*BillingApi* | [**getReferral**](docs/BillingApi.md#getreferral) | **GET** /referrals | Get the org referral code, invite link, terms and stats
|
|
60
63
|
*BillingApi* | [**getSpendingLimit**](docs/BillingApi.md#getspendinglimit) | **GET** /billing/spending-limit | Get the org spending limit
|
|
61
64
|
*BillingApi* | [**getSubscription**](docs/BillingApi.md#getsubscription) | **GET** /billing/subscription | Get the org subscription status and quota usage
|
|
62
65
|
*BillingApi* | [**listDeposits**](docs/BillingApi.md#listdeposits) | **GET** /billing/deposits | List stablecoin deposits
|
|
@@ -69,6 +72,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
69
72
|
*InferenceApi* | [**getModel**](docs/InferenceApi.md#getmodel) | **GET** /models/{id} | Get a specific model (OpenAI-compatible)
|
|
70
73
|
*InferenceApi* | [**getVideo**](docs/InferenceApi.md#getvideo) | **GET** /videos/{id} | Get a video generation job
|
|
71
74
|
*InferenceApi* | [**getVideoContent**](docs/InferenceApi.md#getvideocontent) | **GET** /videos/{id}/content | Download a completed video artifact
|
|
75
|
+
*InferenceApi* | [**inferencePreflight**](docs/InferenceApi.md#inferencepreflight) | **GET** /inference/preflight | Check whether a model request would be served, and at whose expense
|
|
72
76
|
*InferenceApi* | [**listModels**](docs/InferenceApi.md#listmodels) | **GET** /models | List available models (OpenAI-compatible)
|
|
73
77
|
*InferenceApi* | [**listVideos**](docs/InferenceApi.md#listvideos) | **GET** /videos | List video generation jobs
|
|
74
78
|
*MetaApi* | [**getHealth**](docs/MetaApi.md#gethealth) | **GET** /health | Liveness probe
|
|
@@ -101,6 +105,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
101
105
|
- [ImagesResponse](docs/ImagesResponse.md)
|
|
102
106
|
- [ImagesResponseDataInner](docs/ImagesResponseDataInner.md)
|
|
103
107
|
- [ImagesResponseUsage](docs/ImagesResponseUsage.md)
|
|
108
|
+
- [InferencePreflight](docs/InferencePreflight.md)
|
|
104
109
|
- [ListDeposits200Response](docs/ListDeposits200Response.md)
|
|
105
110
|
- [Model](docs/Model.md)
|
|
106
111
|
- [ModelList](docs/ModelList.md)
|
|
@@ -114,10 +119,16 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
|
|
|
114
119
|
- [OperationResult](docs/OperationResult.md)
|
|
115
120
|
- [PeakWindow](docs/PeakWindow.md)
|
|
116
121
|
- [Problem](docs/Problem.md)
|
|
122
|
+
- [RefereeStatus](docs/RefereeStatus.md)
|
|
123
|
+
- [Referral](docs/Referral.md)
|
|
117
124
|
- [SpendingLimit](docs/SpendingLimit.md)
|
|
118
125
|
- [StreamOptions](docs/StreamOptions.md)
|
|
119
126
|
- [Subscription](docs/Subscription.md)
|
|
127
|
+
- [SubscriptionCheckoutRequest](docs/SubscriptionCheckoutRequest.md)
|
|
128
|
+
- [SubscriptionCheckoutSession](docs/SubscriptionCheckoutSession.md)
|
|
120
129
|
- [SubscriptionPlan](docs/SubscriptionPlan.md)
|
|
130
|
+
- [SubscriptionPortalRequest](docs/SubscriptionPortalRequest.md)
|
|
131
|
+
- [SubscriptionPortalSession](docs/SubscriptionPortalSession.md)
|
|
121
132
|
- [SubscriptionPrice](docs/SubscriptionPrice.md)
|
|
122
133
|
- [SubscriptionQuota](docs/SubscriptionQuota.md)
|
|
123
134
|
- [SubscriptionUsage](docs/SubscriptionUsage.md)
|
|
@@ -148,7 +159,7 @@ and is automatically generated by the
|
|
|
148
159
|
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
149
160
|
|
|
150
161
|
- API version: `1.0.0`
|
|
151
|
-
- Package version: `0.1.
|
|
162
|
+
- Package version: `0.1.2`
|
|
152
163
|
- Generator version: `7.24.0`
|
|
153
164
|
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
|
|
154
165
|
|
|
@@ -14,12 +14,23 @@ import { type Balance } from '../models/Balance';
|
|
|
14
14
|
import { type CreateCryptoDepositRequest } from '../models/CreateCryptoDepositRequest';
|
|
15
15
|
import { type CryptoDeposit } from '../models/CryptoDeposit';
|
|
16
16
|
import { type ListDeposits200Response } from '../models/ListDeposits200Response';
|
|
17
|
+
import { type Referral } from '../models/Referral';
|
|
17
18
|
import { type SpendingLimit } from '../models/SpendingLimit';
|
|
18
19
|
import { type Subscription } from '../models/Subscription';
|
|
20
|
+
import { type SubscriptionCheckoutRequest } from '../models/SubscriptionCheckoutRequest';
|
|
21
|
+
import { type SubscriptionCheckoutSession } from '../models/SubscriptionCheckoutSession';
|
|
22
|
+
import { type SubscriptionPortalRequest } from '../models/SubscriptionPortalRequest';
|
|
23
|
+
import { type SubscriptionPortalSession } from '../models/SubscriptionPortalSession';
|
|
19
24
|
import { type UpdateSpendingLimitRequest } from '../models/UpdateSpendingLimitRequest';
|
|
20
25
|
export interface CreateCryptoDepositOperationRequest {
|
|
21
26
|
createCryptoDepositRequest: CreateCryptoDepositRequest;
|
|
22
27
|
}
|
|
28
|
+
export interface CreateSubscriptionCheckoutRequest {
|
|
29
|
+
subscriptionCheckoutRequest?: SubscriptionCheckoutRequest;
|
|
30
|
+
}
|
|
31
|
+
export interface CreateSubscriptionPortalRequest {
|
|
32
|
+
subscriptionPortalRequest?: SubscriptionPortalRequest;
|
|
33
|
+
}
|
|
23
34
|
export interface GetDepositRequest {
|
|
24
35
|
id: string;
|
|
25
36
|
}
|
|
@@ -44,6 +55,34 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
44
55
|
* Create a stablecoin deposit
|
|
45
56
|
*/
|
|
46
57
|
createCryptoDeposit(requestParameters: CreateCryptoDepositOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
60
|
+
*/
|
|
61
|
+
createSubscriptionCheckoutRequestOpts(requestParameters: CreateSubscriptionCheckoutRequest): Promise<runtime.RequestOpts>;
|
|
62
|
+
/**
|
|
63
|
+
* 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.
|
|
64
|
+
* Start a subscription checkout session
|
|
65
|
+
*/
|
|
66
|
+
createSubscriptionCheckoutRaw(requestParameters: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionCheckoutSession>>;
|
|
67
|
+
/**
|
|
68
|
+
* 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.
|
|
69
|
+
* Start a subscription checkout session
|
|
70
|
+
*/
|
|
71
|
+
createSubscriptionCheckout(requestParameters?: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionCheckoutSession>;
|
|
72
|
+
/**
|
|
73
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
74
|
+
*/
|
|
75
|
+
createSubscriptionPortalRequestOpts(requestParameters: CreateSubscriptionPortalRequest): Promise<runtime.RequestOpts>;
|
|
76
|
+
/**
|
|
77
|
+
* 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.
|
|
78
|
+
* Open the billing portal to cancel or manage the subscription
|
|
79
|
+
*/
|
|
80
|
+
createSubscriptionPortalRaw(requestParameters: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionPortalSession>>;
|
|
81
|
+
/**
|
|
82
|
+
* 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.
|
|
83
|
+
* Open the billing portal to cancel or manage the subscription
|
|
84
|
+
*/
|
|
85
|
+
createSubscriptionPortal(requestParameters?: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPortalSession>;
|
|
47
86
|
/**
|
|
48
87
|
* Creates request options for getBalance without sending the request
|
|
49
88
|
*/
|
|
@@ -72,6 +111,20 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
72
111
|
* Get one stablecoin deposit
|
|
73
112
|
*/
|
|
74
113
|
getDeposit(requestParameters: GetDepositRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
114
|
+
/**
|
|
115
|
+
* Creates request options for getReferral without sending the request
|
|
116
|
+
*/
|
|
117
|
+
getReferralRequestOpts(): Promise<runtime.RequestOpts>;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
120
|
+
* Get the org referral code, invite link, terms and stats
|
|
121
|
+
*/
|
|
122
|
+
getReferralRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Referral>>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
125
|
+
* Get the org referral code, invite link, terms and stats
|
|
126
|
+
*/
|
|
127
|
+
getReferral(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Referral>;
|
|
75
128
|
/**
|
|
76
129
|
* Creates request options for getSpendingLimit without sending the request
|
|
77
130
|
*/
|
package/dist/apis/BillingApi.js
CHANGED
|
@@ -28,8 +28,13 @@ const Balance_1 = require("../models/Balance");
|
|
|
28
28
|
const CreateCryptoDepositRequest_1 = require("../models/CreateCryptoDepositRequest");
|
|
29
29
|
const CryptoDeposit_1 = require("../models/CryptoDeposit");
|
|
30
30
|
const ListDeposits200Response_1 = require("../models/ListDeposits200Response");
|
|
31
|
+
const Referral_1 = require("../models/Referral");
|
|
31
32
|
const SpendingLimit_1 = require("../models/SpendingLimit");
|
|
32
33
|
const Subscription_1 = require("../models/Subscription");
|
|
34
|
+
const SubscriptionCheckoutRequest_1 = require("../models/SubscriptionCheckoutRequest");
|
|
35
|
+
const SubscriptionCheckoutSession_1 = require("../models/SubscriptionCheckoutSession");
|
|
36
|
+
const SubscriptionPortalRequest_1 = require("../models/SubscriptionPortalRequest");
|
|
37
|
+
const SubscriptionPortalSession_1 = require("../models/SubscriptionPortalSession");
|
|
33
38
|
const UpdateSpendingLimitRequest_1 = require("../models/UpdateSpendingLimitRequest");
|
|
34
39
|
/**
|
|
35
40
|
*
|
|
@@ -84,6 +89,98 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
84
89
|
return yield response.value();
|
|
85
90
|
});
|
|
86
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
94
|
+
*/
|
|
95
|
+
createSubscriptionCheckoutRequestOpts(requestParameters) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const queryParameters = {};
|
|
98
|
+
const headerParameters = {};
|
|
99
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
100
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
101
|
+
const token = this.configuration.accessToken;
|
|
102
|
+
const tokenString = yield token("bearerAuth", []);
|
|
103
|
+
if (tokenString) {
|
|
104
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
let urlPath = `/billing/subscription/checkout`;
|
|
108
|
+
return {
|
|
109
|
+
path: urlPath,
|
|
110
|
+
method: 'POST',
|
|
111
|
+
headers: headerParameters,
|
|
112
|
+
query: queryParameters,
|
|
113
|
+
body: (0, SubscriptionCheckoutRequest_1.SubscriptionCheckoutRequestToJSON)(requestParameters['subscriptionCheckoutRequest']),
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* 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.
|
|
119
|
+
* Start a subscription checkout session
|
|
120
|
+
*/
|
|
121
|
+
createSubscriptionCheckoutRaw(requestParameters, initOverrides) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const requestOptions = yield this.createSubscriptionCheckoutRequestOpts(requestParameters);
|
|
124
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
125
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, SubscriptionCheckoutSession_1.SubscriptionCheckoutSessionFromJSON)(jsonValue));
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 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.
|
|
130
|
+
* Start a subscription checkout session
|
|
131
|
+
*/
|
|
132
|
+
createSubscriptionCheckout() {
|
|
133
|
+
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
|
|
134
|
+
const response = yield this.createSubscriptionCheckoutRaw(requestParameters, initOverrides);
|
|
135
|
+
return yield response.value();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
140
|
+
*/
|
|
141
|
+
createSubscriptionPortalRequestOpts(requestParameters) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
const queryParameters = {};
|
|
144
|
+
const headerParameters = {};
|
|
145
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
146
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
147
|
+
const token = this.configuration.accessToken;
|
|
148
|
+
const tokenString = yield token("bearerAuth", []);
|
|
149
|
+
if (tokenString) {
|
|
150
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let urlPath = `/billing/subscription/portal`;
|
|
154
|
+
return {
|
|
155
|
+
path: urlPath,
|
|
156
|
+
method: 'POST',
|
|
157
|
+
headers: headerParameters,
|
|
158
|
+
query: queryParameters,
|
|
159
|
+
body: (0, SubscriptionPortalRequest_1.SubscriptionPortalRequestToJSON)(requestParameters['subscriptionPortalRequest']),
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 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.
|
|
165
|
+
* Open the billing portal to cancel or manage the subscription
|
|
166
|
+
*/
|
|
167
|
+
createSubscriptionPortalRaw(requestParameters, initOverrides) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const requestOptions = yield this.createSubscriptionPortalRequestOpts(requestParameters);
|
|
170
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
171
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, SubscriptionPortalSession_1.SubscriptionPortalSessionFromJSON)(jsonValue));
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* 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.
|
|
176
|
+
* Open the billing portal to cancel or manage the subscription
|
|
177
|
+
*/
|
|
178
|
+
createSubscriptionPortal() {
|
|
179
|
+
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
|
|
180
|
+
const response = yield this.createSubscriptionPortalRaw(requestParameters, initOverrides);
|
|
181
|
+
return yield response.value();
|
|
182
|
+
});
|
|
183
|
+
}
|
|
87
184
|
/**
|
|
88
185
|
* Creates request options for getBalance without sending the request
|
|
89
186
|
*/
|
|
@@ -176,6 +273,50 @@ class BillingApi extends runtime.BaseAPI {
|
|
|
176
273
|
return yield response.value();
|
|
177
274
|
});
|
|
178
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Creates request options for getReferral without sending the request
|
|
278
|
+
*/
|
|
279
|
+
getReferralRequestOpts() {
|
|
280
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
281
|
+
const queryParameters = {};
|
|
282
|
+
const headerParameters = {};
|
|
283
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
284
|
+
const token = this.configuration.accessToken;
|
|
285
|
+
const tokenString = yield token("bearerAuth", []);
|
|
286
|
+
if (tokenString) {
|
|
287
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
let urlPath = `/referrals`;
|
|
291
|
+
return {
|
|
292
|
+
path: urlPath,
|
|
293
|
+
method: 'GET',
|
|
294
|
+
headers: headerParameters,
|
|
295
|
+
query: queryParameters,
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
301
|
+
* Get the org referral code, invite link, terms and stats
|
|
302
|
+
*/
|
|
303
|
+
getReferralRaw(initOverrides) {
|
|
304
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
305
|
+
const requestOptions = yield this.getReferralRequestOpts();
|
|
306
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
307
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, Referral_1.ReferralFromJSON)(jsonValue));
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
312
|
+
* Get the org referral code, invite link, terms and stats
|
|
313
|
+
*/
|
|
314
|
+
getReferral(initOverrides) {
|
|
315
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
316
|
+
const response = yield this.getReferralRaw(initOverrides);
|
|
317
|
+
return yield response.value();
|
|
318
|
+
});
|
|
319
|
+
}
|
|
179
320
|
/**
|
|
180
321
|
* Creates request options for getSpendingLimit without sending the request
|
|
181
322
|
*/
|
|
@@ -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
|
*/
|
|
@@ -14,12 +14,23 @@ import { type Balance } from '../models/Balance';
|
|
|
14
14
|
import { type CreateCryptoDepositRequest } from '../models/CreateCryptoDepositRequest';
|
|
15
15
|
import { type CryptoDeposit } from '../models/CryptoDeposit';
|
|
16
16
|
import { type ListDeposits200Response } from '../models/ListDeposits200Response';
|
|
17
|
+
import { type Referral } from '../models/Referral';
|
|
17
18
|
import { type SpendingLimit } from '../models/SpendingLimit';
|
|
18
19
|
import { type Subscription } from '../models/Subscription';
|
|
20
|
+
import { type SubscriptionCheckoutRequest } from '../models/SubscriptionCheckoutRequest';
|
|
21
|
+
import { type SubscriptionCheckoutSession } from '../models/SubscriptionCheckoutSession';
|
|
22
|
+
import { type SubscriptionPortalRequest } from '../models/SubscriptionPortalRequest';
|
|
23
|
+
import { type SubscriptionPortalSession } from '../models/SubscriptionPortalSession';
|
|
19
24
|
import { type UpdateSpendingLimitRequest } from '../models/UpdateSpendingLimitRequest';
|
|
20
25
|
export interface CreateCryptoDepositOperationRequest {
|
|
21
26
|
createCryptoDepositRequest: CreateCryptoDepositRequest;
|
|
22
27
|
}
|
|
28
|
+
export interface CreateSubscriptionCheckoutRequest {
|
|
29
|
+
subscriptionCheckoutRequest?: SubscriptionCheckoutRequest;
|
|
30
|
+
}
|
|
31
|
+
export interface CreateSubscriptionPortalRequest {
|
|
32
|
+
subscriptionPortalRequest?: SubscriptionPortalRequest;
|
|
33
|
+
}
|
|
23
34
|
export interface GetDepositRequest {
|
|
24
35
|
id: string;
|
|
25
36
|
}
|
|
@@ -44,6 +55,34 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
44
55
|
* Create a stablecoin deposit
|
|
45
56
|
*/
|
|
46
57
|
createCryptoDeposit(requestParameters: CreateCryptoDepositOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
60
|
+
*/
|
|
61
|
+
createSubscriptionCheckoutRequestOpts(requestParameters: CreateSubscriptionCheckoutRequest): Promise<runtime.RequestOpts>;
|
|
62
|
+
/**
|
|
63
|
+
* 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.
|
|
64
|
+
* Start a subscription checkout session
|
|
65
|
+
*/
|
|
66
|
+
createSubscriptionCheckoutRaw(requestParameters: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionCheckoutSession>>;
|
|
67
|
+
/**
|
|
68
|
+
* 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.
|
|
69
|
+
* Start a subscription checkout session
|
|
70
|
+
*/
|
|
71
|
+
createSubscriptionCheckout(requestParameters?: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionCheckoutSession>;
|
|
72
|
+
/**
|
|
73
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
74
|
+
*/
|
|
75
|
+
createSubscriptionPortalRequestOpts(requestParameters: CreateSubscriptionPortalRequest): Promise<runtime.RequestOpts>;
|
|
76
|
+
/**
|
|
77
|
+
* 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.
|
|
78
|
+
* Open the billing portal to cancel or manage the subscription
|
|
79
|
+
*/
|
|
80
|
+
createSubscriptionPortalRaw(requestParameters: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionPortalSession>>;
|
|
81
|
+
/**
|
|
82
|
+
* 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.
|
|
83
|
+
* Open the billing portal to cancel or manage the subscription
|
|
84
|
+
*/
|
|
85
|
+
createSubscriptionPortal(requestParameters?: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPortalSession>;
|
|
47
86
|
/**
|
|
48
87
|
* Creates request options for getBalance without sending the request
|
|
49
88
|
*/
|
|
@@ -72,6 +111,20 @@ export declare class BillingApi extends runtime.BaseAPI {
|
|
|
72
111
|
* Get one stablecoin deposit
|
|
73
112
|
*/
|
|
74
113
|
getDeposit(requestParameters: GetDepositRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CryptoDeposit>;
|
|
114
|
+
/**
|
|
115
|
+
* Creates request options for getReferral without sending the request
|
|
116
|
+
*/
|
|
117
|
+
getReferralRequestOpts(): Promise<runtime.RequestOpts>;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
120
|
+
* Get the org referral code, invite link, terms and stats
|
|
121
|
+
*/
|
|
122
|
+
getReferralRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Referral>>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the organization\'s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\'s stats, and — when this organization itself signed up through someone else\'s link — its own progress toward the referee reward. Requires the `billing:read` scope. The organization is taken from the authenticated API key, never from a parameter. The program: share the invite link; when a friend signs up through it and spends `qualify_spend_cents` on inference, the referrer receives `reward_cents` and the friend receives `referee_reward_cents`, both as non-withdrawable credit, after a `hold_days` chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. `referred` is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\'s referral card reads.
|
|
125
|
+
* Get the org referral code, invite link, terms and stats
|
|
126
|
+
*/
|
|
127
|
+
getReferral(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Referral>;
|
|
75
128
|
/**
|
|
76
129
|
* Creates request options for getSpendingLimit without sending the request
|
|
77
130
|
*/
|