@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
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
# InferencePreflight
|
|
3
|
+
|
|
4
|
+
The verdict for one (organization, model) pair: what would happen if the model were invoked right now.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`model` | string
|
|
11
|
+
`verdict` | string
|
|
12
|
+
`reason` | string
|
|
13
|
+
`message` | string
|
|
14
|
+
`planCovered` | boolean
|
|
15
|
+
`subscribed` | boolean
|
|
16
|
+
`funded` | boolean
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import type { InferencePreflight } from '@deeprelay/sdk'
|
|
22
|
+
|
|
23
|
+
// TODO: Update the object below with actual values
|
|
24
|
+
const example = {
|
|
25
|
+
"model": null,
|
|
26
|
+
"verdict": null,
|
|
27
|
+
"reason": null,
|
|
28
|
+
"message": null,
|
|
29
|
+
"planCovered": null,
|
|
30
|
+
"subscribed": null,
|
|
31
|
+
"funded": null,
|
|
32
|
+
} satisfies InferencePreflight
|
|
33
|
+
|
|
34
|
+
console.log(example)
|
|
35
|
+
|
|
36
|
+
// Convert the instance to a JSON string
|
|
37
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
38
|
+
console.log(exampleJSON)
|
|
39
|
+
|
|
40
|
+
// Parse the JSON string back to an object
|
|
41
|
+
const exampleParsed = JSON.parse(exampleJSON) as InferencePreflight
|
|
42
|
+
console.log(exampleParsed)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
46
|
+
|
|
47
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
|
|
2
|
+
# RefereeStatus
|
|
3
|
+
|
|
4
|
+
Present only when the organization signed up through someone else\'s invite link: where that referral sits and how far the organization is from unlocking its own reward.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`status` | string
|
|
11
|
+
`spentCents` | number
|
|
12
|
+
`qualifySpendCents` | number
|
|
13
|
+
`rewardCents` | number
|
|
14
|
+
`qualifiedAt` | Date
|
|
15
|
+
`holdUntil` | Date
|
|
16
|
+
`settledAt` | Date
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import type { RefereeStatus } from '@deeprelay/sdk'
|
|
22
|
+
|
|
23
|
+
// TODO: Update the object below with actual values
|
|
24
|
+
const example = {
|
|
25
|
+
"status": null,
|
|
26
|
+
"spentCents": null,
|
|
27
|
+
"qualifySpendCents": null,
|
|
28
|
+
"rewardCents": null,
|
|
29
|
+
"qualifiedAt": null,
|
|
30
|
+
"holdUntil": null,
|
|
31
|
+
"settledAt": null,
|
|
32
|
+
} satisfies RefereeStatus
|
|
33
|
+
|
|
34
|
+
console.log(example)
|
|
35
|
+
|
|
36
|
+
// Convert the instance to a JSON string
|
|
37
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
38
|
+
console.log(exampleJSON)
|
|
39
|
+
|
|
40
|
+
// Parse the JSON string back to an object
|
|
41
|
+
const exampleParsed = JSON.parse(exampleJSON) as RefereeStatus
|
|
42
|
+
console.log(exampleParsed)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
46
|
+
|
|
47
|
+
|
package/docs/Referral.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
# Referral
|
|
3
|
+
|
|
4
|
+
The organization\'s referral-program view: its invite link, the program terms, its referrer stats, and (only when it was itself referred) its referee progress. Amounts are USD cents.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`code` | string
|
|
11
|
+
`inviteUrl` | string
|
|
12
|
+
`pending` | number
|
|
13
|
+
`qualified` | number
|
|
14
|
+
`settled` | number
|
|
15
|
+
`earnedCents` | number
|
|
16
|
+
`rewardCents` | number
|
|
17
|
+
`refereeRewardCents` | number
|
|
18
|
+
`qualifySpendCents` | number
|
|
19
|
+
`holdDays` | number
|
|
20
|
+
`referred` | [RefereeStatus](RefereeStatus.md)
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import type { Referral } from '@deeprelay/sdk'
|
|
26
|
+
|
|
27
|
+
// TODO: Update the object below with actual values
|
|
28
|
+
const example = {
|
|
29
|
+
"code": GPU-7KQ2-M4XP,
|
|
30
|
+
"inviteUrl": https://deeprelay.ai/r/GPU-7KQ2-M4XP,
|
|
31
|
+
"pending": null,
|
|
32
|
+
"qualified": null,
|
|
33
|
+
"settled": null,
|
|
34
|
+
"earnedCents": null,
|
|
35
|
+
"rewardCents": null,
|
|
36
|
+
"refereeRewardCents": null,
|
|
37
|
+
"qualifySpendCents": null,
|
|
38
|
+
"holdDays": null,
|
|
39
|
+
"referred": null,
|
|
40
|
+
} satisfies Referral
|
|
41
|
+
|
|
42
|
+
console.log(example)
|
|
43
|
+
|
|
44
|
+
// Convert the instance to a JSON string
|
|
45
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
46
|
+
console.log(exampleJSON)
|
|
47
|
+
|
|
48
|
+
// Parse the JSON string back to an object
|
|
49
|
+
const exampleParsed = JSON.parse(exampleJSON) as Referral
|
|
50
|
+
console.log(exampleParsed)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
54
|
+
|
|
55
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# SubscriptionCheckoutRequest
|
|
3
|
+
|
|
4
|
+
Optional overrides for a checkout mint. Every field has a deployment default, so an empty body is the normal call.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`successUrl` | string
|
|
11
|
+
`cancelUrl` | string
|
|
12
|
+
`planKey` | string
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { SubscriptionCheckoutRequest } from '@deeprelay/sdk'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"successUrl": null,
|
|
22
|
+
"cancelUrl": null,
|
|
23
|
+
"planKey": null,
|
|
24
|
+
} satisfies SubscriptionCheckoutRequest
|
|
25
|
+
|
|
26
|
+
console.log(example)
|
|
27
|
+
|
|
28
|
+
// Convert the instance to a JSON string
|
|
29
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
30
|
+
console.log(exampleJSON)
|
|
31
|
+
|
|
32
|
+
// Parse the JSON string back to an object
|
|
33
|
+
const exampleParsed = JSON.parse(exampleJSON) as SubscriptionCheckoutRequest
|
|
34
|
+
console.log(exampleParsed)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
38
|
+
|
|
39
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# SubscriptionCheckoutSession
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`checkoutUrl` | string
|
|
10
|
+
`sessionId` | string
|
|
11
|
+
`plan` | [SubscriptionPlan](SubscriptionPlan.md)
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { SubscriptionCheckoutSession } from '@deeprelay/sdk'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"checkoutUrl": null,
|
|
21
|
+
"sessionId": null,
|
|
22
|
+
"plan": null,
|
|
23
|
+
} satisfies SubscriptionCheckoutSession
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as SubscriptionCheckoutSession
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
37
|
+
|
|
38
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
# SubscriptionPortalRequest
|
|
3
|
+
|
|
4
|
+
Optional overrides for a billing-portal mint.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`returnUrl` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { SubscriptionPortalRequest } from '@deeprelay/sdk'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"returnUrl": null,
|
|
20
|
+
} satisfies SubscriptionPortalRequest
|
|
21
|
+
|
|
22
|
+
console.log(example)
|
|
23
|
+
|
|
24
|
+
// Convert the instance to a JSON string
|
|
25
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
26
|
+
console.log(exampleJSON)
|
|
27
|
+
|
|
28
|
+
// Parse the JSON string back to an object
|
|
29
|
+
const exampleParsed = JSON.parse(exampleJSON) as SubscriptionPortalRequest
|
|
30
|
+
console.log(exampleParsed)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
34
|
+
|
|
35
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# SubscriptionPortalSession
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`portalUrl` | string
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { SubscriptionPortalSession } from '@deeprelay/sdk'
|
|
15
|
+
|
|
16
|
+
// TODO: Update the object below with actual values
|
|
17
|
+
const example = {
|
|
18
|
+
"portalUrl": null,
|
|
19
|
+
} satisfies SubscriptionPortalSession
|
|
20
|
+
|
|
21
|
+
console.log(example)
|
|
22
|
+
|
|
23
|
+
// Convert the instance to a JSON string
|
|
24
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
25
|
+
console.log(exampleJSON)
|
|
26
|
+
|
|
27
|
+
// Parse the JSON string back to an object
|
|
28
|
+
const exampleParsed = JSON.parse(exampleJSON) as SubscriptionPortalSession
|
|
29
|
+
console.log(exampleParsed)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
33
|
+
|
|
34
|
+
|
package/docs/VideoJob.md
CHANGED
|
@@ -17,6 +17,7 @@ Name | Type
|
|
|
17
17
|
`completedAt` | number
|
|
18
18
|
`expiresAt` | number
|
|
19
19
|
`error` | string
|
|
20
|
+
`errorMessage` | string
|
|
20
21
|
`costCents` | number
|
|
21
22
|
|
|
22
23
|
## Example
|
|
@@ -37,6 +38,7 @@ const example = {
|
|
|
37
38
|
"completedAt": null,
|
|
38
39
|
"expiresAt": null,
|
|
39
40
|
"error": null,
|
|
41
|
+
"errorMessage": null,
|
|
40
42
|
"costCents": null,
|
|
41
43
|
} satisfies VideoJob
|
|
42
44
|
|
package/package.json
CHANGED
package/src/apis/BillingApi.ts
CHANGED
|
@@ -38,6 +38,11 @@ import {
|
|
|
38
38
|
ProblemFromJSON,
|
|
39
39
|
ProblemToJSON,
|
|
40
40
|
} from '../models/Problem';
|
|
41
|
+
import {
|
|
42
|
+
type Referral,
|
|
43
|
+
ReferralFromJSON,
|
|
44
|
+
ReferralToJSON,
|
|
45
|
+
} from '../models/Referral';
|
|
41
46
|
import {
|
|
42
47
|
type SpendingLimit,
|
|
43
48
|
SpendingLimitFromJSON,
|
|
@@ -48,6 +53,26 @@ import {
|
|
|
48
53
|
SubscriptionFromJSON,
|
|
49
54
|
SubscriptionToJSON,
|
|
50
55
|
} from '../models/Subscription';
|
|
56
|
+
import {
|
|
57
|
+
type SubscriptionCheckoutRequest,
|
|
58
|
+
SubscriptionCheckoutRequestFromJSON,
|
|
59
|
+
SubscriptionCheckoutRequestToJSON,
|
|
60
|
+
} from '../models/SubscriptionCheckoutRequest';
|
|
61
|
+
import {
|
|
62
|
+
type SubscriptionCheckoutSession,
|
|
63
|
+
SubscriptionCheckoutSessionFromJSON,
|
|
64
|
+
SubscriptionCheckoutSessionToJSON,
|
|
65
|
+
} from '../models/SubscriptionCheckoutSession';
|
|
66
|
+
import {
|
|
67
|
+
type SubscriptionPortalRequest,
|
|
68
|
+
SubscriptionPortalRequestFromJSON,
|
|
69
|
+
SubscriptionPortalRequestToJSON,
|
|
70
|
+
} from '../models/SubscriptionPortalRequest';
|
|
71
|
+
import {
|
|
72
|
+
type SubscriptionPortalSession,
|
|
73
|
+
SubscriptionPortalSessionFromJSON,
|
|
74
|
+
SubscriptionPortalSessionToJSON,
|
|
75
|
+
} from '../models/SubscriptionPortalSession';
|
|
51
76
|
import {
|
|
52
77
|
type UpdateSpendingLimitRequest,
|
|
53
78
|
UpdateSpendingLimitRequestFromJSON,
|
|
@@ -58,6 +83,14 @@ export interface CreateCryptoDepositOperationRequest {
|
|
|
58
83
|
createCryptoDepositRequest: CreateCryptoDepositRequest;
|
|
59
84
|
}
|
|
60
85
|
|
|
86
|
+
export interface CreateSubscriptionCheckoutRequest {
|
|
87
|
+
subscriptionCheckoutRequest?: SubscriptionCheckoutRequest;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface CreateSubscriptionPortalRequest {
|
|
91
|
+
subscriptionPortalRequest?: SubscriptionPortalRequest;
|
|
92
|
+
}
|
|
93
|
+
|
|
61
94
|
export interface GetDepositRequest {
|
|
62
95
|
id: string;
|
|
63
96
|
}
|
|
@@ -128,6 +161,106 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
128
161
|
return await response.value();
|
|
129
162
|
}
|
|
130
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Creates request options for createSubscriptionCheckout without sending the request
|
|
166
|
+
*/
|
|
167
|
+
async createSubscriptionCheckoutRequestOpts(requestParameters: CreateSubscriptionCheckoutRequest): Promise<runtime.RequestOpts> {
|
|
168
|
+
const queryParameters: any = {};
|
|
169
|
+
|
|
170
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
171
|
+
|
|
172
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
173
|
+
|
|
174
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
175
|
+
const token = this.configuration.accessToken;
|
|
176
|
+
const tokenString = await token("bearerAuth", []);
|
|
177
|
+
|
|
178
|
+
if (tokenString) {
|
|
179
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
let urlPath = `/billing/subscription/checkout`;
|
|
184
|
+
|
|
185
|
+
return {
|
|
186
|
+
path: urlPath,
|
|
187
|
+
method: 'POST',
|
|
188
|
+
headers: headerParameters,
|
|
189
|
+
query: queryParameters,
|
|
190
|
+
body: SubscriptionCheckoutRequestToJSON(requestParameters['subscriptionCheckoutRequest']),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* 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.
|
|
196
|
+
* Start a subscription checkout session
|
|
197
|
+
*/
|
|
198
|
+
async createSubscriptionCheckoutRaw(requestParameters: CreateSubscriptionCheckoutRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionCheckoutSession>> {
|
|
199
|
+
const requestOptions = await this.createSubscriptionCheckoutRequestOpts(requestParameters);
|
|
200
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
201
|
+
|
|
202
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionCheckoutSessionFromJSON(jsonValue));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* 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.
|
|
207
|
+
* Start a subscription checkout session
|
|
208
|
+
*/
|
|
209
|
+
async createSubscriptionCheckout(requestParameters: CreateSubscriptionCheckoutRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionCheckoutSession> {
|
|
210
|
+
const response = await this.createSubscriptionCheckoutRaw(requestParameters, initOverrides);
|
|
211
|
+
return await response.value();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Creates request options for createSubscriptionPortal without sending the request
|
|
216
|
+
*/
|
|
217
|
+
async createSubscriptionPortalRequestOpts(requestParameters: CreateSubscriptionPortalRequest): Promise<runtime.RequestOpts> {
|
|
218
|
+
const queryParameters: any = {};
|
|
219
|
+
|
|
220
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
221
|
+
|
|
222
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
223
|
+
|
|
224
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
225
|
+
const token = this.configuration.accessToken;
|
|
226
|
+
const tokenString = await token("bearerAuth", []);
|
|
227
|
+
|
|
228
|
+
if (tokenString) {
|
|
229
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
let urlPath = `/billing/subscription/portal`;
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
path: urlPath,
|
|
237
|
+
method: 'POST',
|
|
238
|
+
headers: headerParameters,
|
|
239
|
+
query: queryParameters,
|
|
240
|
+
body: SubscriptionPortalRequestToJSON(requestParameters['subscriptionPortalRequest']),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* 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.
|
|
246
|
+
* Open the billing portal to cancel or manage the subscription
|
|
247
|
+
*/
|
|
248
|
+
async createSubscriptionPortalRaw(requestParameters: CreateSubscriptionPortalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubscriptionPortalSession>> {
|
|
249
|
+
const requestOptions = await this.createSubscriptionPortalRequestOpts(requestParameters);
|
|
250
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
251
|
+
|
|
252
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SubscriptionPortalSessionFromJSON(jsonValue));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* 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.
|
|
257
|
+
* Open the billing portal to cancel or manage the subscription
|
|
258
|
+
*/
|
|
259
|
+
async createSubscriptionPortal(requestParameters: CreateSubscriptionPortalRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubscriptionPortalSession> {
|
|
260
|
+
const response = await this.createSubscriptionPortalRaw(requestParameters, initOverrides);
|
|
261
|
+
return await response.value();
|
|
262
|
+
}
|
|
263
|
+
|
|
131
264
|
/**
|
|
132
265
|
* Creates request options for getBalance without sending the request
|
|
133
266
|
*/
|
|
@@ -230,6 +363,53 @@ export class BillingApi extends runtime.BaseAPI {
|
|
|
230
363
|
return await response.value();
|
|
231
364
|
}
|
|
232
365
|
|
|
366
|
+
/**
|
|
367
|
+
* Creates request options for getReferral without sending the request
|
|
368
|
+
*/
|
|
369
|
+
async getReferralRequestOpts(): Promise<runtime.RequestOpts> {
|
|
370
|
+
const queryParameters: any = {};
|
|
371
|
+
|
|
372
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
373
|
+
|
|
374
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
375
|
+
const token = this.configuration.accessToken;
|
|
376
|
+
const tokenString = await token("bearerAuth", []);
|
|
377
|
+
|
|
378
|
+
if (tokenString) {
|
|
379
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
let urlPath = `/referrals`;
|
|
384
|
+
|
|
385
|
+
return {
|
|
386
|
+
path: urlPath,
|
|
387
|
+
method: 'GET',
|
|
388
|
+
headers: headerParameters,
|
|
389
|
+
query: queryParameters,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* 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.
|
|
395
|
+
* Get the org referral code, invite link, terms and stats
|
|
396
|
+
*/
|
|
397
|
+
async getReferralRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Referral>> {
|
|
398
|
+
const requestOptions = await this.getReferralRequestOpts();
|
|
399
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
400
|
+
|
|
401
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => ReferralFromJSON(jsonValue));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* 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.
|
|
406
|
+
* Get the org referral code, invite link, terms and stats
|
|
407
|
+
*/
|
|
408
|
+
async getReferral(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Referral> {
|
|
409
|
+
const response = await this.getReferralRaw(initOverrides);
|
|
410
|
+
return await response.value();
|
|
411
|
+
}
|
|
412
|
+
|
|
233
413
|
/**
|
|
234
414
|
* Creates request options for getSpendingLimit without sending the request
|
|
235
415
|
*/
|
package/src/apis/InferenceApi.ts
CHANGED
|
@@ -43,6 +43,11 @@ import {
|
|
|
43
43
|
ImagesResponseFromJSON,
|
|
44
44
|
ImagesResponseToJSON,
|
|
45
45
|
} from '../models/ImagesResponse';
|
|
46
|
+
import {
|
|
47
|
+
type InferencePreflight,
|
|
48
|
+
InferencePreflightFromJSON,
|
|
49
|
+
InferencePreflightToJSON,
|
|
50
|
+
} from '../models/InferencePreflight';
|
|
46
51
|
import {
|
|
47
52
|
type Model,
|
|
48
53
|
ModelFromJSON,
|
|
@@ -108,6 +113,10 @@ export interface GetVideoContentRequest {
|
|
|
108
113
|
id: string;
|
|
109
114
|
}
|
|
110
115
|
|
|
116
|
+
export interface InferencePreflightRequest {
|
|
117
|
+
model: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
111
120
|
export interface ListModelsRequest {
|
|
112
121
|
modality?: ListModelsModalityEnum;
|
|
113
122
|
}
|
|
@@ -570,6 +579,64 @@ export class InferenceApi extends runtime.BaseAPI {
|
|
|
570
579
|
return await response.value();
|
|
571
580
|
}
|
|
572
581
|
|
|
582
|
+
/**
|
|
583
|
+
* Creates request options for inferencePreflight without sending the request
|
|
584
|
+
*/
|
|
585
|
+
async inferencePreflightRequestOpts(requestParameters: InferencePreflightRequest): Promise<runtime.RequestOpts> {
|
|
586
|
+
if (requestParameters['model'] == null) {
|
|
587
|
+
throw new runtime.RequiredError(
|
|
588
|
+
'model',
|
|
589
|
+
'Required parameter "model" was null or undefined when calling inferencePreflight().'
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
const queryParameters: any = {};
|
|
594
|
+
|
|
595
|
+
if (requestParameters['model'] != null) {
|
|
596
|
+
queryParameters['model'] = requestParameters['model'];
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
600
|
+
|
|
601
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
602
|
+
const token = this.configuration.accessToken;
|
|
603
|
+
const tokenString = await token("bearerAuth", []);
|
|
604
|
+
|
|
605
|
+
if (tokenString) {
|
|
606
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
let urlPath = `/inference/preflight`;
|
|
611
|
+
|
|
612
|
+
return {
|
|
613
|
+
path: urlPath,
|
|
614
|
+
method: 'GET',
|
|
615
|
+
headers: headerParameters,
|
|
616
|
+
query: queryParameters,
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* 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.
|
|
622
|
+
* Check whether a model request would be served, and at whose expense
|
|
623
|
+
*/
|
|
624
|
+
async inferencePreflightRaw(requestParameters: InferencePreflightRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<InferencePreflight>> {
|
|
625
|
+
const requestOptions = await this.inferencePreflightRequestOpts(requestParameters);
|
|
626
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
627
|
+
|
|
628
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => InferencePreflightFromJSON(jsonValue));
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* 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.
|
|
633
|
+
* Check whether a model request would be served, and at whose expense
|
|
634
|
+
*/
|
|
635
|
+
async inferencePreflight(requestParameters: InferencePreflightRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InferencePreflight> {
|
|
636
|
+
const response = await this.inferencePreflightRaw(requestParameters, initOverrides);
|
|
637
|
+
return await response.value();
|
|
638
|
+
}
|
|
639
|
+
|
|
573
640
|
/**
|
|
574
641
|
* Creates request options for listModels without sending the request
|
|
575
642
|
*/
|