@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.
Files changed (71) hide show
  1. package/.openapi-generator/FILES +14 -0
  2. package/README.md +13 -2
  3. package/dist/apis/BillingApi.d.ts +53 -0
  4. package/dist/apis/BillingApi.js +141 -0
  5. package/dist/apis/InferenceApi.d.ts +18 -0
  6. package/dist/apis/InferenceApi.js +51 -0
  7. package/dist/esm/apis/BillingApi.d.ts +53 -0
  8. package/dist/esm/apis/BillingApi.js +141 -0
  9. package/dist/esm/apis/InferenceApi.d.ts +18 -0
  10. package/dist/esm/apis/InferenceApi.js +51 -0
  11. package/dist/esm/models/InferencePreflight.d.ts +92 -0
  12. package/dist/esm/models/InferencePreflight.js +86 -0
  13. package/dist/esm/models/RefereeStatus.d.ts +79 -0
  14. package/dist/esm/models/RefereeStatus.js +70 -0
  15. package/dist/esm/models/Referral.d.ts +94 -0
  16. package/dist/esm/models/Referral.js +82 -0
  17. package/dist/esm/models/SubscriptionCheckoutRequest.d.ts +45 -0
  18. package/dist/esm/models/SubscriptionCheckoutRequest.js +45 -0
  19. package/dist/esm/models/SubscriptionCheckoutSession.d.ts +45 -0
  20. package/dist/esm/models/SubscriptionCheckoutSession.js +52 -0
  21. package/dist/esm/models/SubscriptionPortalRequest.d.ts +32 -0
  22. package/dist/esm/models/SubscriptionPortalRequest.js +41 -0
  23. package/dist/esm/models/SubscriptionPortalSession.d.ts +32 -0
  24. package/dist/esm/models/SubscriptionPortalSession.js +43 -0
  25. package/dist/esm/models/VideoJob.d.ts +6 -0
  26. package/dist/esm/models/VideoJob.js +2 -0
  27. package/dist/esm/models/index.d.ts +7 -0
  28. package/dist/esm/models/index.js +7 -0
  29. package/dist/esm/runtime.js +1 -1
  30. package/dist/models/InferencePreflight.d.ts +92 -0
  31. package/dist/models/InferencePreflight.js +94 -0
  32. package/dist/models/RefereeStatus.d.ts +79 -0
  33. package/dist/models/RefereeStatus.js +78 -0
  34. package/dist/models/Referral.d.ts +94 -0
  35. package/dist/models/Referral.js +89 -0
  36. package/dist/models/SubscriptionCheckoutRequest.d.ts +45 -0
  37. package/dist/models/SubscriptionCheckoutRequest.js +52 -0
  38. package/dist/models/SubscriptionCheckoutSession.d.ts +45 -0
  39. package/dist/models/SubscriptionCheckoutSession.js +59 -0
  40. package/dist/models/SubscriptionPortalRequest.d.ts +32 -0
  41. package/dist/models/SubscriptionPortalRequest.js +48 -0
  42. package/dist/models/SubscriptionPortalSession.d.ts +32 -0
  43. package/dist/models/SubscriptionPortalSession.js +50 -0
  44. package/dist/models/VideoJob.d.ts +6 -0
  45. package/dist/models/VideoJob.js +2 -0
  46. package/dist/models/index.d.ts +7 -0
  47. package/dist/models/index.js +7 -0
  48. package/dist/runtime.js +1 -1
  49. package/docs/BillingApi.md +220 -0
  50. package/docs/InferenceApi.md +74 -0
  51. package/docs/InferencePreflight.md +47 -0
  52. package/docs/RefereeStatus.md +47 -0
  53. package/docs/Referral.md +55 -0
  54. package/docs/SubscriptionCheckoutRequest.md +39 -0
  55. package/docs/SubscriptionCheckoutSession.md +38 -0
  56. package/docs/SubscriptionPortalRequest.md +35 -0
  57. package/docs/SubscriptionPortalSession.md +34 -0
  58. package/docs/VideoJob.md +2 -0
  59. package/package.json +1 -1
  60. package/src/apis/BillingApi.ts +180 -0
  61. package/src/apis/InferenceApi.ts +67 -0
  62. package/src/models/InferencePreflight.ts +147 -0
  63. package/src/models/RefereeStatus.ts +131 -0
  64. package/src/models/Referral.ts +164 -0
  65. package/src/models/SubscriptionCheckoutRequest.ts +82 -0
  66. package/src/models/SubscriptionCheckoutSession.ts +92 -0
  67. package/src/models/SubscriptionPortalRequest.ts +65 -0
  68. package/src/models/SubscriptionPortalSession.ts +66 -0
  69. package/src/models/VideoJob.ts +8 -0
  70. package/src/models/index.ts +7 -0
  71. package/src/runtime.ts +1 -1
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * deeprelay Public Developer API
6
+ * Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: support@deeprelay.ai
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfSubscriptionCheckoutSession = instanceOfSubscriptionCheckoutSession;
17
+ exports.SubscriptionCheckoutSessionFromJSON = SubscriptionCheckoutSessionFromJSON;
18
+ exports.SubscriptionCheckoutSessionFromJSONTyped = SubscriptionCheckoutSessionFromJSONTyped;
19
+ exports.SubscriptionCheckoutSessionToJSON = SubscriptionCheckoutSessionToJSON;
20
+ exports.SubscriptionCheckoutSessionToJSONTyped = SubscriptionCheckoutSessionToJSONTyped;
21
+ const SubscriptionPlan_1 = require("./SubscriptionPlan");
22
+ /**
23
+ * Check if a given object implements the SubscriptionCheckoutSession interface.
24
+ */
25
+ function instanceOfSubscriptionCheckoutSession(value) {
26
+ if ((!('checkoutUrl' in value) && !('checkout_url' in value)) || (value['checkoutUrl'] === undefined && value['checkout_url'] === undefined))
27
+ return false;
28
+ if ((!('sessionId' in value) && !('session_id' in value)) || (value['sessionId'] === undefined && value['session_id'] === undefined))
29
+ return false;
30
+ if (!('plan' in value) || value['plan'] === undefined)
31
+ return false;
32
+ return true;
33
+ }
34
+ function SubscriptionCheckoutSessionFromJSON(json) {
35
+ return SubscriptionCheckoutSessionFromJSONTyped(json, false);
36
+ }
37
+ function SubscriptionCheckoutSessionFromJSONTyped(json, ignoreDiscriminator) {
38
+ if (json == null) {
39
+ return json;
40
+ }
41
+ return {
42
+ 'checkoutUrl': json['checkout_url'],
43
+ 'sessionId': json['session_id'],
44
+ 'plan': (0, SubscriptionPlan_1.SubscriptionPlanFromJSON)(json['plan']),
45
+ };
46
+ }
47
+ function SubscriptionCheckoutSessionToJSON(json) {
48
+ return SubscriptionCheckoutSessionToJSONTyped(json, false);
49
+ }
50
+ function SubscriptionCheckoutSessionToJSONTyped(value, ignoreDiscriminator = false) {
51
+ if (value == null) {
52
+ return value;
53
+ }
54
+ return {
55
+ 'checkout_url': value['checkoutUrl'],
56
+ 'session_id': value['sessionId'],
57
+ 'plan': (0, SubscriptionPlan_1.SubscriptionPlanToJSON)(value['plan']),
58
+ };
59
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * deeprelay Public Developer API
3
+ * Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: support@deeprelay.ai
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Optional overrides for a billing-portal mint.
14
+ * @export
15
+ * @interface SubscriptionPortalRequest
16
+ */
17
+ export interface SubscriptionPortalRequest {
18
+ /**
19
+ * Where the provider returns when the customer leaves the portal. Defaults to the deployment's configured URL.
20
+ * @type {string}
21
+ * @memberof SubscriptionPortalRequest
22
+ */
23
+ returnUrl?: string;
24
+ }
25
+ /**
26
+ * Check if a given object implements the SubscriptionPortalRequest interface.
27
+ */
28
+ export declare function instanceOfSubscriptionPortalRequest(value: object): value is SubscriptionPortalRequest;
29
+ export declare function SubscriptionPortalRequestFromJSON(json: any): SubscriptionPortalRequest;
30
+ export declare function SubscriptionPortalRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubscriptionPortalRequest;
31
+ export declare function SubscriptionPortalRequestToJSON(json: any): SubscriptionPortalRequest;
32
+ export declare function SubscriptionPortalRequestToJSONTyped(value?: SubscriptionPortalRequest | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * deeprelay Public Developer API
6
+ * Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: support@deeprelay.ai
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfSubscriptionPortalRequest = instanceOfSubscriptionPortalRequest;
17
+ exports.SubscriptionPortalRequestFromJSON = SubscriptionPortalRequestFromJSON;
18
+ exports.SubscriptionPortalRequestFromJSONTyped = SubscriptionPortalRequestFromJSONTyped;
19
+ exports.SubscriptionPortalRequestToJSON = SubscriptionPortalRequestToJSON;
20
+ exports.SubscriptionPortalRequestToJSONTyped = SubscriptionPortalRequestToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the SubscriptionPortalRequest interface.
23
+ */
24
+ function instanceOfSubscriptionPortalRequest(value) {
25
+ return true;
26
+ }
27
+ function SubscriptionPortalRequestFromJSON(json) {
28
+ return SubscriptionPortalRequestFromJSONTyped(json, false);
29
+ }
30
+ function SubscriptionPortalRequestFromJSONTyped(json, ignoreDiscriminator) {
31
+ if (json == null) {
32
+ return json;
33
+ }
34
+ return {
35
+ 'returnUrl': json['return_url'] == null ? undefined : json['return_url'],
36
+ };
37
+ }
38
+ function SubscriptionPortalRequestToJSON(json) {
39
+ return SubscriptionPortalRequestToJSONTyped(json, false);
40
+ }
41
+ function SubscriptionPortalRequestToJSONTyped(value, ignoreDiscriminator = false) {
42
+ if (value == null) {
43
+ return value;
44
+ }
45
+ return {
46
+ 'return_url': value['returnUrl'],
47
+ };
48
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * deeprelay Public Developer API
3
+ * Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: support@deeprelay.ai
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface SubscriptionPortalSession
16
+ */
17
+ export interface SubscriptionPortalSession {
18
+ /**
19
+ * The hosted billing portal — cancel, resume, change payment method, download invoices.
20
+ * @type {string}
21
+ * @memberof SubscriptionPortalSession
22
+ */
23
+ portalUrl: string;
24
+ }
25
+ /**
26
+ * Check if a given object implements the SubscriptionPortalSession interface.
27
+ */
28
+ export declare function instanceOfSubscriptionPortalSession(value: object): value is SubscriptionPortalSession;
29
+ export declare function SubscriptionPortalSessionFromJSON(json: any): SubscriptionPortalSession;
30
+ export declare function SubscriptionPortalSessionFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubscriptionPortalSession;
31
+ export declare function SubscriptionPortalSessionToJSON(json: any): SubscriptionPortalSession;
32
+ export declare function SubscriptionPortalSessionToJSONTyped(value?: SubscriptionPortalSession | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * deeprelay Public Developer API
6
+ * Programmatic API for deeprelay. Authenticate with API keys minted from the dashboard. See https://deeprelay.ai/docs for details.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: support@deeprelay.ai
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfSubscriptionPortalSession = instanceOfSubscriptionPortalSession;
17
+ exports.SubscriptionPortalSessionFromJSON = SubscriptionPortalSessionFromJSON;
18
+ exports.SubscriptionPortalSessionFromJSONTyped = SubscriptionPortalSessionFromJSONTyped;
19
+ exports.SubscriptionPortalSessionToJSON = SubscriptionPortalSessionToJSON;
20
+ exports.SubscriptionPortalSessionToJSONTyped = SubscriptionPortalSessionToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the SubscriptionPortalSession interface.
23
+ */
24
+ function instanceOfSubscriptionPortalSession(value) {
25
+ if ((!('portalUrl' in value) && !('portal_url' in value)) || (value['portalUrl'] === undefined && value['portal_url'] === undefined))
26
+ return false;
27
+ return true;
28
+ }
29
+ function SubscriptionPortalSessionFromJSON(json) {
30
+ return SubscriptionPortalSessionFromJSONTyped(json, false);
31
+ }
32
+ function SubscriptionPortalSessionFromJSONTyped(json, ignoreDiscriminator) {
33
+ if (json == null) {
34
+ return json;
35
+ }
36
+ return {
37
+ 'portalUrl': json['portal_url'],
38
+ };
39
+ }
40
+ function SubscriptionPortalSessionToJSON(json) {
41
+ return SubscriptionPortalSessionToJSONTyped(json, false);
42
+ }
43
+ function SubscriptionPortalSessionToJSONTyped(value, ignoreDiscriminator = false) {
44
+ if (value == null) {
45
+ return value;
46
+ }
47
+ return {
48
+ 'portal_url': value['portalUrl'],
49
+ };
50
+ }
@@ -81,6 +81,12 @@ export interface VideoJob {
81
81
  * @memberof VideoJob
82
82
  */
83
83
  error?: string;
84
+ /**
85
+ * Human-readable reason behind `error`, when the upstream supplied one. `error` classifies the failure, `error_message` explains it (for example a requested duration outside the model's supported range). Sanitized before storage; only ever present alongside `error`.
86
+ * @type {string}
87
+ * @memberof VideoJob
88
+ */
89
+ errorMessage?: string;
84
90
  /**
85
91
  * Final billed cost in cents; present once the job completes (failed/cancelled jobs are never billed).
86
92
  * @type {number}
@@ -75,6 +75,7 @@ function VideoJobFromJSONTyped(json, ignoreDiscriminator) {
75
75
  'completedAt': json['completed_at'] == null ? undefined : json['completed_at'],
76
76
  'expiresAt': json['expires_at'] == null ? undefined : json['expires_at'],
77
77
  'error': json['error'] == null ? undefined : json['error'],
78
+ 'errorMessage': json['error_message'] == null ? undefined : json['error_message'],
78
79
  'costCents': json['cost_cents'] == null ? undefined : json['cost_cents'],
79
80
  };
80
81
  }
@@ -97,6 +98,7 @@ function VideoJobToJSONTyped(value, ignoreDiscriminator = false) {
97
98
  'completed_at': value['completedAt'],
98
99
  'expires_at': value['expiresAt'],
99
100
  'error': value['error'],
101
+ 'error_message': value['errorMessage'],
100
102
  'cost_cents': value['costCents'],
101
103
  };
102
104
  }
@@ -16,6 +16,7 @@ export * from './ImagesGenerationsRequest';
16
16
  export * from './ImagesResponse';
17
17
  export * from './ImagesResponseDataInner';
18
18
  export * from './ImagesResponseUsage';
19
+ export * from './InferencePreflight';
19
20
  export * from './ListDeposits200Response';
20
21
  export * from './Model';
21
22
  export * from './ModelList';
@@ -29,10 +30,16 @@ export * from './OperationError';
29
30
  export * from './OperationResult';
30
31
  export * from './PeakWindow';
31
32
  export * from './Problem';
33
+ export * from './RefereeStatus';
34
+ export * from './Referral';
32
35
  export * from './SpendingLimit';
33
36
  export * from './StreamOptions';
34
37
  export * from './Subscription';
38
+ export * from './SubscriptionCheckoutRequest';
39
+ export * from './SubscriptionCheckoutSession';
35
40
  export * from './SubscriptionPlan';
41
+ export * from './SubscriptionPortalRequest';
42
+ export * from './SubscriptionPortalSession';
36
43
  export * from './SubscriptionPrice';
37
44
  export * from './SubscriptionQuota';
38
45
  export * from './SubscriptionUsage';
@@ -34,6 +34,7 @@ __exportStar(require("./ImagesGenerationsRequest"), exports);
34
34
  __exportStar(require("./ImagesResponse"), exports);
35
35
  __exportStar(require("./ImagesResponseDataInner"), exports);
36
36
  __exportStar(require("./ImagesResponseUsage"), exports);
37
+ __exportStar(require("./InferencePreflight"), exports);
37
38
  __exportStar(require("./ListDeposits200Response"), exports);
38
39
  __exportStar(require("./Model"), exports);
39
40
  __exportStar(require("./ModelList"), exports);
@@ -47,10 +48,16 @@ __exportStar(require("./OperationError"), exports);
47
48
  __exportStar(require("./OperationResult"), exports);
48
49
  __exportStar(require("./PeakWindow"), exports);
49
50
  __exportStar(require("./Problem"), exports);
51
+ __exportStar(require("./RefereeStatus"), exports);
52
+ __exportStar(require("./Referral"), exports);
50
53
  __exportStar(require("./SpendingLimit"), exports);
51
54
  __exportStar(require("./StreamOptions"), exports);
52
55
  __exportStar(require("./Subscription"), exports);
56
+ __exportStar(require("./SubscriptionCheckoutRequest"), exports);
57
+ __exportStar(require("./SubscriptionCheckoutSession"), exports);
53
58
  __exportStar(require("./SubscriptionPlan"), exports);
59
+ __exportStar(require("./SubscriptionPortalRequest"), exports);
60
+ __exportStar(require("./SubscriptionPortalSession"), exports);
54
61
  __exportStar(require("./SubscriptionPrice"), exports);
55
62
  __exportStar(require("./SubscriptionQuota"), exports);
56
63
  __exportStar(require("./SubscriptionUsage"), exports);
package/dist/runtime.js CHANGED
@@ -69,7 +69,7 @@ class Configuration {
69
69
  return undefined;
70
70
  }
71
71
  get headers() {
72
- return Object.assign({ 'User-Agent': 'deeprelay-sdk-ts/0.1.0' }, this.configuration.headers);
72
+ return Object.assign({ 'User-Agent': 'deeprelay-sdk-ts/0.1.2' }, this.configuration.headers);
73
73
  }
74
74
  get credentials() {
75
75
  return this.configuration.credentials;
@@ -5,8 +5,11 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
5
5
  | Method | HTTP request | Description |
6
6
  |------------- | ------------- | -------------|
7
7
  | [**createCryptoDeposit**](BillingApi.md#createcryptodepositoperation) | **POST** /billing/deposits/crypto | Create a stablecoin deposit |
8
+ | [**createSubscriptionCheckout**](BillingApi.md#createsubscriptioncheckout) | **POST** /billing/subscription/checkout | Start a subscription checkout session |
9
+ | [**createSubscriptionPortal**](BillingApi.md#createsubscriptionportal) | **POST** /billing/subscription/portal | Open the billing portal to cancel or manage the subscription |
8
10
  | [**getBalance**](BillingApi.md#getbalance) | **GET** /billing/balance | Get the org credit balance |
9
11
  | [**getDeposit**](BillingApi.md#getdeposit) | **GET** /billing/deposits/{id} | Get one stablecoin deposit |
12
+ | [**getReferral**](BillingApi.md#getreferral) | **GET** /referrals | Get the org referral code, invite link, terms and stats |
10
13
  | [**getSpendingLimit**](BillingApi.md#getspendinglimit) | **GET** /billing/spending-limit | Get the org spending limit |
11
14
  | [**getSubscription**](BillingApi.md#getsubscription) | **GET** /billing/subscription | Get the org subscription status and quota usage |
12
15
  | [**listDeposits**](BillingApi.md#listdeposits) | **GET** /billing/deposits | List stablecoin deposits |
@@ -91,6 +94,158 @@ example().catch(console.error);
91
94
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
92
95
 
93
96
 
97
+ ## createSubscriptionCheckout
98
+
99
+ > SubscriptionCheckoutSession createSubscriptionCheckout(subscriptionCheckoutRequest)
100
+
101
+ Start a subscription checkout session
102
+
103
+ 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.
104
+
105
+ ### Example
106
+
107
+ ```ts
108
+ import {
109
+ Configuration,
110
+ BillingApi,
111
+ } from '@deeprelay/sdk';
112
+ import type { CreateSubscriptionCheckoutRequest } from '@deeprelay/sdk';
113
+
114
+ async function example() {
115
+ console.log("🚀 Testing @deeprelay/sdk SDK...");
116
+ const config = new Configuration({
117
+ // Configure HTTP bearer authorization: bearerAuth
118
+ accessToken: "YOUR BEARER TOKEN",
119
+ });
120
+ const api = new BillingApi(config);
121
+
122
+ const body = {
123
+ // SubscriptionCheckoutRequest (optional)
124
+ subscriptionCheckoutRequest: ...,
125
+ } satisfies CreateSubscriptionCheckoutRequest;
126
+
127
+ try {
128
+ const data = await api.createSubscriptionCheckout(body);
129
+ console.log(data);
130
+ } catch (error) {
131
+ console.error(error);
132
+ }
133
+ }
134
+
135
+ // Run the test
136
+ example().catch(console.error);
137
+ ```
138
+
139
+ ### Parameters
140
+
141
+
142
+ | Name | Type | Description | Notes |
143
+ |------------- | ------------- | ------------- | -------------|
144
+ | **subscriptionCheckoutRequest** | [SubscriptionCheckoutRequest](SubscriptionCheckoutRequest.md) | | [Optional] |
145
+
146
+ ### Return type
147
+
148
+ [**SubscriptionCheckoutSession**](SubscriptionCheckoutSession.md)
149
+
150
+ ### Authorization
151
+
152
+ [bearerAuth](../README.md#bearerAuth)
153
+
154
+ ### HTTP request headers
155
+
156
+ - **Content-Type**: `application/json`
157
+ - **Accept**: `application/json`, `application/problem+json`
158
+
159
+
160
+ ### HTTP response details
161
+ | Status code | Description | Response headers |
162
+ |-------------|-------------|------------------|
163
+ | **200** | OK | - |
164
+ | **403** | Not an organization admin | - |
165
+ | **409** | The organization already has an active subscription | - |
166
+ | **503** | Subscription billing is not configured on this deployment | - |
167
+ | **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
168
+ | **0** | Error response (RFC 7807) | - |
169
+
170
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
171
+
172
+
173
+ ## createSubscriptionPortal
174
+
175
+ > SubscriptionPortalSession createSubscriptionPortal(subscriptionPortalRequest)
176
+
177
+ Open the billing portal to cancel or manage the subscription
178
+
179
+ 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 &#x60;billing:write&#x60; 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 &#x60;/billing/subscription&#x60; reports &#x60;cancel_at_period_end: true&#x60;. 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.
180
+
181
+ ### Example
182
+
183
+ ```ts
184
+ import {
185
+ Configuration,
186
+ BillingApi,
187
+ } from '@deeprelay/sdk';
188
+ import type { CreateSubscriptionPortalRequest } from '@deeprelay/sdk';
189
+
190
+ async function example() {
191
+ console.log("🚀 Testing @deeprelay/sdk SDK...");
192
+ const config = new Configuration({
193
+ // Configure HTTP bearer authorization: bearerAuth
194
+ accessToken: "YOUR BEARER TOKEN",
195
+ });
196
+ const api = new BillingApi(config);
197
+
198
+ const body = {
199
+ // SubscriptionPortalRequest (optional)
200
+ subscriptionPortalRequest: ...,
201
+ } satisfies CreateSubscriptionPortalRequest;
202
+
203
+ try {
204
+ const data = await api.createSubscriptionPortal(body);
205
+ console.log(data);
206
+ } catch (error) {
207
+ console.error(error);
208
+ }
209
+ }
210
+
211
+ // Run the test
212
+ example().catch(console.error);
213
+ ```
214
+
215
+ ### Parameters
216
+
217
+
218
+ | Name | Type | Description | Notes |
219
+ |------------- | ------------- | ------------- | -------------|
220
+ | **subscriptionPortalRequest** | [SubscriptionPortalRequest](SubscriptionPortalRequest.md) | | [Optional] |
221
+
222
+ ### Return type
223
+
224
+ [**SubscriptionPortalSession**](SubscriptionPortalSession.md)
225
+
226
+ ### Authorization
227
+
228
+ [bearerAuth](../README.md#bearerAuth)
229
+
230
+ ### HTTP request headers
231
+
232
+ - **Content-Type**: `application/json`
233
+ - **Accept**: `application/json`, `application/problem+json`
234
+
235
+
236
+ ### HTTP response details
237
+ | Status code | Description | Response headers |
238
+ |-------------|-------------|------------------|
239
+ | **200** | OK | - |
240
+ | **403** | Not an organization admin | - |
241
+ | **404** | The organization has no billing account yet | - |
242
+ | **503** | Subscription billing is not configured on this deployment | - |
243
+ | **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
244
+ | **0** | Error response (RFC 7807) | - |
245
+
246
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
247
+
248
+
94
249
  ## getBalance
95
250
 
96
251
  > Balance getBalance()
@@ -230,6 +385,71 @@ example().catch(console.error);
230
385
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
231
386
 
232
387
 
388
+ ## getReferral
389
+
390
+ > Referral getReferral()
391
+
392
+ Get the org referral code, invite link, terms and stats
393
+
394
+ Returns the organization\&#39;s shareable referral code and invite link (minting the code on first read), the program terms, the referrer\&#39;s stats, and — when this organization itself signed up through someone else\&#39;s link — its own progress toward the referee reward. Requires the &#x60;billing:read&#x60; 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 &#x60;qualify_spend_cents&#x60; on inference, the referrer receives &#x60;reward_cents&#x60; and the friend receives &#x60;referee_reward_cents&#x60;, both as non-withdrawable credit, after a &#x60;hold_days&#x60; chargeback hold. The terms ride on the wire so a client never hard-codes the amounts. &#x60;referred&#x60; is ABSENT (not null) for an organization nobody referred — key on its presence. This is the same contract the dashboard\&#39;s referral card reads.
395
+
396
+ ### Example
397
+
398
+ ```ts
399
+ import {
400
+ Configuration,
401
+ BillingApi,
402
+ } from '@deeprelay/sdk';
403
+ import type { GetReferralRequest } from '@deeprelay/sdk';
404
+
405
+ async function example() {
406
+ console.log("🚀 Testing @deeprelay/sdk SDK...");
407
+ const config = new Configuration({
408
+ // Configure HTTP bearer authorization: bearerAuth
409
+ accessToken: "YOUR BEARER TOKEN",
410
+ });
411
+ const api = new BillingApi(config);
412
+
413
+ try {
414
+ const data = await api.getReferral();
415
+ console.log(data);
416
+ } catch (error) {
417
+ console.error(error);
418
+ }
419
+ }
420
+
421
+ // Run the test
422
+ example().catch(console.error);
423
+ ```
424
+
425
+ ### Parameters
426
+
427
+ This endpoint does not need any parameter.
428
+
429
+ ### Return type
430
+
431
+ [**Referral**](Referral.md)
432
+
433
+ ### Authorization
434
+
435
+ [bearerAuth](../README.md#bearerAuth)
436
+
437
+ ### HTTP request headers
438
+
439
+ - **Content-Type**: Not defined
440
+ - **Accept**: `application/json`, `application/problem+json`
441
+
442
+
443
+ ### HTTP response details
444
+ | Status code | Description | Response headers |
445
+ |-------------|-------------|------------------|
446
+ | **200** | OK | - |
447
+ | **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
448
+ | **0** | Error response (RFC 7807) | - |
449
+
450
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
451
+
452
+
233
453
  ## getSpendingLimit
234
454
 
235
455
  > SpendingLimit getSpendingLimit()
@@ -12,6 +12,7 @@ All URIs are relative to *https://api.deeprelay.ai/v1*
12
12
  | [**getModel**](InferenceApi.md#getmodel) | **GET** /models/{id} | Get a specific model (OpenAI-compatible) |
13
13
  | [**getVideo**](InferenceApi.md#getvideo) | **GET** /videos/{id} | Get a video generation job |
14
14
  | [**getVideoContent**](InferenceApi.md#getvideocontent) | **GET** /videos/{id}/content | Download a completed video artifact |
15
+ | [**inferencePreflight**](InferenceApi.md#inferencepreflight) | **GET** /inference/preflight | Check whether a model request would be served, and at whose expense |
15
16
  | [**listModels**](InferenceApi.md#listmodels) | **GET** /models | List available models (OpenAI-compatible) |
16
17
  | [**listVideos**](InferenceApi.md#listvideos) | **GET** /videos | List video generation jobs |
17
18
 
@@ -638,6 +639,79 @@ example().catch(console.error);
638
639
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
639
640
 
640
641
 
642
+ ## inferencePreflight
643
+
644
+ > InferencePreflight inferencePreflight(model)
645
+
646
+ Check whether a model request would be served, and at whose expense
647
+
648
+ Answers \&quot;what happens if I call this model right now?\&quot; 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 &#x60;serverless:read&#x60; 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\&#39;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\&#39;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 &#x60;plan_covered&#x60; is false for a video model even if an operator has placed it on the plan\&#39;s covered list. That is a deliberate divergence from the same-named field on &#x60;/v1/models&#x60;, which reports the platform\&#39;s configuration. Here it means \&quot;the plan covers this REQUEST\&quot; — describing what will happen is the entire job of a preflight. One caveat on \&quot;read-only\&quot;: resolving the balance creates the organization\&#39;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 &#x60;warn&#x60; / &#x60;not_plan_covered&#x60;. 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. &#x60;funded&#x60; is a boolean and never a figure. This route is on the inference read scope, so it must not disclose the organization\&#39;s balance; use &#x60;/billing/balance&#x60; for the number. Failure posture is the opposite of the request gate\&#39;s: any gate that cannot be read degrades the verdict toward &#x60;ok&#x60;, never toward &#x60;block&#x60;. A false &#x60;block&#x60; would stop a customer whose request would have succeeded, while a false &#x60;ok&#x60; costs them one honest error from the real call.
649
+
650
+ ### Example
651
+
652
+ ```ts
653
+ import {
654
+ Configuration,
655
+ InferenceApi,
656
+ } from '@deeprelay/sdk';
657
+ import type { InferencePreflightRequest } from '@deeprelay/sdk';
658
+
659
+ async function example() {
660
+ console.log("🚀 Testing @deeprelay/sdk SDK...");
661
+ const config = new Configuration({
662
+ // Configure HTTP bearer authorization: bearerAuth
663
+ accessToken: "YOUR BEARER TOKEN",
664
+ });
665
+ const api = new InferenceApi(config);
666
+
667
+ const body = {
668
+ // string | Model id or alias, optionally with a `:economy` tier suffix. It is resolved through the catalog exactly as the inference endpoints resolve it, so an alias and a tier view answer for the model that would actually serve.
669
+ model: model_example,
670
+ } satisfies InferencePreflightRequest;
671
+
672
+ try {
673
+ const data = await api.inferencePreflight(body);
674
+ console.log(data);
675
+ } catch (error) {
676
+ console.error(error);
677
+ }
678
+ }
679
+
680
+ // Run the test
681
+ example().catch(console.error);
682
+ ```
683
+
684
+ ### Parameters
685
+
686
+
687
+ | Name | Type | Description | Notes |
688
+ |------------- | ------------- | ------------- | -------------|
689
+ | **model** | `string` | Model id or alias, optionally with a &#x60;:economy&#x60; tier suffix. It is resolved through the catalog exactly as the inference endpoints resolve it, so an alias and a tier view answer for the model that would actually serve. | [Defaults to `undefined`] |
690
+
691
+ ### Return type
692
+
693
+ [**InferencePreflight**](InferencePreflight.md)
694
+
695
+ ### Authorization
696
+
697
+ [bearerAuth](../README.md#bearerAuth)
698
+
699
+ ### HTTP request headers
700
+
701
+ - **Content-Type**: Not defined
702
+ - **Accept**: `application/json`
703
+
704
+
705
+ ### HTTP response details
706
+ | Status code | Description | Response headers |
707
+ |-------------|-------------|------------------|
708
+ | **200** | OK | - |
709
+ | **404** | Model or resource not found (OpenAI error envelope). | - |
710
+ | **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
711
+
712
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
713
+
714
+
641
715
  ## listModels
642
716
 
643
717
  > ModelList listModels(modality)