@leaflow/sdk 0.0.0-dev.519.g9e3ae08 → 0.0.0-dev.523.gcaeef48
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/dist/canopy/v1/generated/functions.d.ts +73 -1
- package/dist/canopy/v1/generated/functions.js +92 -6
- package/dist/canopy/v1/generated/models.d.ts +148 -12
- package/dist/canopy/v1/generated/models.js +13 -0
- package/dist/canopy/v1/generated/schemas.zod.d.ts +49 -0
- package/dist/canopy/v1/generated/schemas.zod.js +28 -0
- package/dist/canopy/v1/generated/validators/cursorPageRequestResource.zod.d.ts +10 -0
- package/dist/canopy/v1/generated/validators/getVideoContentHeaders.zod.d.ts +46 -0
- package/dist/canopy/v1/generated/validators/getVideoContentHeaders.zod.js +44 -0
- package/dist/canopy/v1/generated/validators/mediaUsageDetails.zod.d.ts +61 -0
- package/dist/canopy/v1/generated/validators/mediaUsageDetails.zod.js +67 -0
- package/dist/canopy/v1/generated/validators/requestResource.zod.d.ts +10 -0
- package/dist/canopy/v1/generated/validators/requestResource.zod.js +2 -0
- package/dist/canopy/v1/generated/validators/videoCreateRequest.zod.d.ts +67 -0
- package/dist/canopy/v1/generated/validators/videoCreateRequest.zod.js +70 -0
- package/dist/canopy/v1/generated/validators/videoReferenceMedia.zod.d.ts +53 -0
- package/dist/canopy/v1/generated/validators/videoReferenceMedia.zod.js +53 -0
- package/dist/canopy/v1/generated/validators/videoTask.zod.d.ts +71 -0
- package/dist/canopy/v1/generated/validators/videoTask.zod.js +64 -0
- package/dist/canopy/v1/generated/validators/videoUsage.zod.d.ts +54 -0
- package/dist/canopy/v1/generated/validators/videoUsage.zod.js +62 -0
- package/dist/routes.d.ts +24 -0
- package/dist/routes.js +27 -0
- package/package.json +1 -1
|
@@ -38,13 +38,85 @@
|
|
|
38
38
|
* - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
|
|
39
39
|
* OpenAPI spec version: 1.0.0
|
|
40
40
|
*/
|
|
41
|
-
import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, NativeRequest, NativeResponse, RequestResource, ResponseCreate, ResponseDeleted, ResponseResource, ServiceResource, StreamGenerateContentParams, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody } from "./models.js";
|
|
41
|
+
import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, GetVideoContentHeaders, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, NativeRequest, NativeResponse, RequestResource, ResponseCreate, ResponseDeleted, ResponseResource, ServiceResource, StreamGenerateContentParams, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody, VideoCreateRequest, VideoTask } from "./models.js";
|
|
42
42
|
export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
|
|
43
43
|
export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
|
|
44
44
|
export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
|
|
45
45
|
export type HTTPStatusCode4xx = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451;
|
|
46
46
|
export type HTTPStatusCode5xx = 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
|
|
47
47
|
export type HTTPStatusCodes = HTTPStatusCode1xx | HTTPStatusCode2xx | HTTPStatusCode3xx | HTTPStatusCode4xx | HTTPStatusCode5xx;
|
|
48
|
+
export type createVideoResponse200 = {
|
|
49
|
+
data: VideoTask;
|
|
50
|
+
status: 200;
|
|
51
|
+
};
|
|
52
|
+
export type createVideoResponseDefault = {
|
|
53
|
+
data: InferenceError;
|
|
54
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
55
|
+
};
|
|
56
|
+
export type createVideoResponseSuccess = createVideoResponse200 & {
|
|
57
|
+
headers: Headers;
|
|
58
|
+
};
|
|
59
|
+
export type createVideoResponseError = createVideoResponseDefault & {
|
|
60
|
+
headers: Headers;
|
|
61
|
+
};
|
|
62
|
+
export type createVideoResponse = createVideoResponseSuccess | createVideoResponseError;
|
|
63
|
+
export declare const getCreateVideoUrl: () => string;
|
|
64
|
+
/**
|
|
65
|
+
* Create an asynchronous video task in the verified project. Model and upstream support
|
|
66
|
+
* determine the accepted duration, resolution and references. Poll the returned task id.
|
|
67
|
+
* `reference_media` is a Canopy extension for ordered, typed image, video and audio URLs.
|
|
68
|
+
* Existing `input_reference` remains a first frame.
|
|
69
|
+
* The runtime also accepts OpenAI multipart uploads; send reference_media as a JSON text field.
|
|
70
|
+
* No remote reference is downloaded or retained by Canopy during request preparation.
|
|
71
|
+
* @summary Create a video
|
|
72
|
+
*/
|
|
73
|
+
export declare const createVideo: (videoCreateRequest: VideoCreateRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createVideoResponse>;
|
|
74
|
+
export type getVideoResponse200 = {
|
|
75
|
+
data: VideoTask;
|
|
76
|
+
status: 200;
|
|
77
|
+
};
|
|
78
|
+
export type getVideoResponseDefault = {
|
|
79
|
+
data: InferenceError;
|
|
80
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
81
|
+
};
|
|
82
|
+
export type getVideoResponseSuccess = getVideoResponse200 & {
|
|
83
|
+
headers: Headers;
|
|
84
|
+
};
|
|
85
|
+
export type getVideoResponseError = getVideoResponseDefault & {
|
|
86
|
+
headers: Headers;
|
|
87
|
+
};
|
|
88
|
+
export type getVideoResponse = getVideoResponseSuccess | getVideoResponseError;
|
|
89
|
+
export declare const getGetVideoUrl: (video: string) => string;
|
|
90
|
+
/**
|
|
91
|
+
* Read an existing task owned by the verified project; does not create another video.
|
|
92
|
+
* @summary Get a video task
|
|
93
|
+
*/
|
|
94
|
+
export declare const getVideo: (video: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getVideoResponse>;
|
|
95
|
+
export type getVideoContentResponse200 = {
|
|
96
|
+
data: Blob;
|
|
97
|
+
status: 200;
|
|
98
|
+
};
|
|
99
|
+
export type getVideoContentResponse206 = {
|
|
100
|
+
data: Blob;
|
|
101
|
+
status: 206;
|
|
102
|
+
};
|
|
103
|
+
export type getVideoContentResponseDefault = {
|
|
104
|
+
data: InferenceError;
|
|
105
|
+
status: Exclude<HTTPStatusCodes, 200 | 206>;
|
|
106
|
+
};
|
|
107
|
+
export type getVideoContentResponseSuccess = (getVideoContentResponse200 | getVideoContentResponse206) & {
|
|
108
|
+
headers: Headers;
|
|
109
|
+
};
|
|
110
|
+
export type getVideoContentResponseError = getVideoContentResponseDefault & {
|
|
111
|
+
headers: Headers;
|
|
112
|
+
};
|
|
113
|
+
export type getVideoContentResponse = getVideoContentResponseSuccess | getVideoContentResponseError;
|
|
114
|
+
export declare const getGetVideoContentUrl: (video: string) => string;
|
|
115
|
+
/**
|
|
116
|
+
* Stream a completed video owned by the verified project. Supports HTTP Range.
|
|
117
|
+
* @summary Get generated video content
|
|
118
|
+
*/
|
|
119
|
+
export declare const getVideoContent: (video: string, headers?: GetVideoContentHeaders, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getVideoContentResponse>;
|
|
48
120
|
export type createResponseResponse200ApplicationJson = {
|
|
49
121
|
data: ResponseResource;
|
|
50
122
|
status: 200;
|
|
@@ -1,3 +1,93 @@
|
|
|
1
|
+
export const getCreateVideoUrl = () => {
|
|
2
|
+
return `https://canopy.leaflow.cloud/v1/videos`;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Create an asynchronous video task in the verified project. Model and upstream support
|
|
6
|
+
* determine the accepted duration, resolution and references. Poll the returned task id.
|
|
7
|
+
* `reference_media` is a Canopy extension for ordered, typed image, video and audio URLs.
|
|
8
|
+
* Existing `input_reference` remains a first frame.
|
|
9
|
+
* The runtime also accepts OpenAI multipart uploads; send reference_media as a JSON text field.
|
|
10
|
+
* No remote reference is downloaded or retained by Canopy during request preparation.
|
|
11
|
+
* @summary Create a video
|
|
12
|
+
*/
|
|
13
|
+
export const createVideo = async (videoCreateRequest, options, fetchFn) => {
|
|
14
|
+
const getHeaders = (h) => {
|
|
15
|
+
if (!h)
|
|
16
|
+
return {};
|
|
17
|
+
if (h instanceof Headers)
|
|
18
|
+
return Object.fromEntries(h.entries());
|
|
19
|
+
if (Symbol.iterator in h) {
|
|
20
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
21
|
+
}
|
|
22
|
+
const headers = {};
|
|
23
|
+
for (const [name, value] of Object.entries(h)) {
|
|
24
|
+
if (value !== undefined)
|
|
25
|
+
headers[name] = value;
|
|
26
|
+
}
|
|
27
|
+
return headers;
|
|
28
|
+
};
|
|
29
|
+
const res = await (fetchFn ?? fetch)(getCreateVideoUrl(), {
|
|
30
|
+
...options,
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
33
|
+
body: JSON.stringify(videoCreateRequest),
|
|
34
|
+
});
|
|
35
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
36
|
+
const data = body ? JSON.parse(body) : {};
|
|
37
|
+
return { data, status: res.status, headers: res.headers };
|
|
38
|
+
};
|
|
39
|
+
export const getGetVideoUrl = (video) => {
|
|
40
|
+
return `https://canopy.leaflow.cloud/v1/videos/${encodeURIComponent(String(video))}`;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Read an existing task owned by the verified project; does not create another video.
|
|
44
|
+
* @summary Get a video task
|
|
45
|
+
*/
|
|
46
|
+
export const getVideo = async (video, options, fetchFn) => {
|
|
47
|
+
const res = await (fetchFn ?? fetch)(getGetVideoUrl(video), {
|
|
48
|
+
...options,
|
|
49
|
+
method: "GET",
|
|
50
|
+
});
|
|
51
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
52
|
+
const data = body ? JSON.parse(body) : {};
|
|
53
|
+
return { data, status: res.status, headers: res.headers };
|
|
54
|
+
};
|
|
55
|
+
export const getGetVideoContentUrl = (video) => {
|
|
56
|
+
return `https://canopy.leaflow.cloud/v1/videos/${encodeURIComponent(String(video))}/content`;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Stream a completed video owned by the verified project. Supports HTTP Range.
|
|
60
|
+
* @summary Get generated video content
|
|
61
|
+
*/
|
|
62
|
+
export const getVideoContent = async (video, headers, options, fetchFn) => {
|
|
63
|
+
const getHeaders = (h) => {
|
|
64
|
+
if (!h)
|
|
65
|
+
return {};
|
|
66
|
+
if (h instanceof Headers)
|
|
67
|
+
return Object.fromEntries(h.entries());
|
|
68
|
+
if (Symbol.iterator in h) {
|
|
69
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
70
|
+
}
|
|
71
|
+
const headers = {};
|
|
72
|
+
for (const [name, value] of Object.entries(h)) {
|
|
73
|
+
if (value !== undefined)
|
|
74
|
+
headers[name] = value;
|
|
75
|
+
}
|
|
76
|
+
return headers;
|
|
77
|
+
};
|
|
78
|
+
const res = await (fetchFn ?? fetch)(getGetVideoContentUrl(video), {
|
|
79
|
+
...options,
|
|
80
|
+
method: "GET",
|
|
81
|
+
headers: { ...headers, ...getHeaders(options?.headers) },
|
|
82
|
+
});
|
|
83
|
+
const body = [204, 205, 304].includes(res.status)
|
|
84
|
+
? null
|
|
85
|
+
: res.headers.get("content-type")?.includes("application/json")
|
|
86
|
+
? JSON.parse(await res.text())
|
|
87
|
+
: await res.blob();
|
|
88
|
+
const data = body;
|
|
89
|
+
return { data, status: res.status, headers: res.headers };
|
|
90
|
+
};
|
|
1
91
|
export const getCreateResponseUrl = () => {
|
|
2
92
|
return `https://canopy.leaflow.cloud/v1/responses`;
|
|
3
93
|
};
|
|
@@ -27,11 +117,7 @@ export const createResponse = async (responseCreate, options, fetchFn) => {
|
|
|
27
117
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
28
118
|
body: JSON.stringify(responseCreate),
|
|
29
119
|
});
|
|
30
|
-
const body = [204, 205, 304].includes(res.status)
|
|
31
|
-
? null
|
|
32
|
-
: res.headers.get("content-type")?.includes("application/json")
|
|
33
|
-
? JSON.parse(await res.text())
|
|
34
|
-
: await res.blob();
|
|
120
|
+
const body = [204, 205, 304].includes(res.status) ? null : res.headers.get("content-type")?.includes("application/json") ? JSON.parse(await res.text()) : await res.blob();
|
|
35
121
|
const data = body;
|
|
36
122
|
return { data, status: res.status, headers: res.headers };
|
|
37
123
|
};
|
|
@@ -94,7 +180,7 @@ export const createChatCompletion = async (chatCompletionRequest, options, fetch
|
|
|
94
180
|
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
95
181
|
body: JSON.stringify(chatCompletionRequest),
|
|
96
182
|
});
|
|
97
|
-
const body = [204, 205, 304].includes(res.status) ? null :
|
|
183
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.blob();
|
|
98
184
|
const data = body;
|
|
99
185
|
return { data, status: res.status, headers: res.headers };
|
|
100
186
|
};
|
|
@@ -637,6 +637,36 @@ export interface MediaUsage {
|
|
|
637
637
|
export interface ModelListResponseBody {
|
|
638
638
|
items: ModelResource[];
|
|
639
639
|
}
|
|
640
|
+
export type MediaUsageDetailsReferenceCounts = {
|
|
641
|
+
[key: string]: number;
|
|
642
|
+
};
|
|
643
|
+
/**
|
|
644
|
+
* Per-request media measurements. Omitted values are unknown, not zero.
|
|
645
|
+
* Reference counts are audit data, not an additional billable quantity.
|
|
646
|
+
* video_quantity is the exact decimal quantity for the existing video_seconds
|
|
647
|
+
* meter; video_seconds in the summary remains a rounded compatibility counter.
|
|
648
|
+
* No monetary price or refund is calculated by Canopy.
|
|
649
|
+
*/
|
|
650
|
+
export interface MediaUsageDetails {
|
|
651
|
+
/** @minimum 0 */
|
|
652
|
+
input_video_seconds?: number;
|
|
653
|
+
/** @minimum 0 */
|
|
654
|
+
output_video_seconds?: number;
|
|
655
|
+
/** @minimum 0 */
|
|
656
|
+
input_audio_seconds?: number;
|
|
657
|
+
/**
|
|
658
|
+
* Recorded input quantity for the input_images meter, independent of its Billing price. Absent when unmeasured or not separately metered.
|
|
659
|
+
* @pattern ^[0-9]+$
|
|
660
|
+
*/
|
|
661
|
+
input_image_quantity?: string;
|
|
662
|
+
/** @minimum 0 */
|
|
663
|
+
input_images?: number;
|
|
664
|
+
/** @minimum 0 */
|
|
665
|
+
output_images?: number;
|
|
666
|
+
/** @pattern ^[0-9]+([.][0-9]+)?$ */
|
|
667
|
+
video_quantity?: string;
|
|
668
|
+
reference_counts?: MediaUsageDetailsReferenceCounts;
|
|
669
|
+
}
|
|
640
670
|
export type RequestResourceStatus = (typeof RequestResourceStatus)[keyof typeof RequestResourceStatus];
|
|
641
671
|
export declare const RequestResourceStatus: {
|
|
642
672
|
readonly in_flight: "in_flight";
|
|
@@ -716,6 +746,7 @@ export interface RequestResource {
|
|
|
716
746
|
reasoning: ReasoningDiagnostics | null;
|
|
717
747
|
/** Media quantities and their rate dimensions. Null for a token-only request. */
|
|
718
748
|
media?: MediaUsage | null;
|
|
749
|
+
media_details?: MediaUsageDetails;
|
|
719
750
|
}
|
|
720
751
|
export interface CursorPageRequestResource {
|
|
721
752
|
/** The items in this page */
|
|
@@ -987,6 +1018,120 @@ export interface CreateServiceResponseBody {
|
|
|
987
1018
|
*/
|
|
988
1019
|
order_id: string | null;
|
|
989
1020
|
}
|
|
1021
|
+
export type VideoReferenceMediaType = (typeof VideoReferenceMediaType)[keyof typeof VideoReferenceMediaType];
|
|
1022
|
+
export declare const VideoReferenceMediaType: {
|
|
1023
|
+
readonly first_frame: "first_frame";
|
|
1024
|
+
readonly last_frame: "last_frame";
|
|
1025
|
+
readonly reference_image: "reference_image";
|
|
1026
|
+
readonly reference_video: "reference_video";
|
|
1027
|
+
readonly reference_audio: "reference_audio";
|
|
1028
|
+
};
|
|
1029
|
+
/**
|
|
1030
|
+
* A typed reference asset. Order is preserved, including order within each media type.
|
|
1031
|
+
* Wan 3.0 accepts at most one first frame, one last frame, ten reference images,
|
|
1032
|
+
* five reference videos and five reference audio clips. A last frame needs a first frame.
|
|
1033
|
+
* First/last frames cannot be combined with reference_image, reference_video or reference_audio.
|
|
1034
|
+
* Reference images, videos and audio may be combined. Other models can accept fewer roles.
|
|
1035
|
+
* Images accept public HTTP(S) or base64 image data URLs. Video and audio accept public
|
|
1036
|
+
* HTTP(S) URLs only. Wan 3.0 limits reference videos and audio to 1-15 seconds each and
|
|
1037
|
+
* 15 seconds total per media type; input video plus output duration must not exceed 30 seconds.
|
|
1038
|
+
* The upstream validates remote asset size, format and duration. Canopy does not fetch them.
|
|
1039
|
+
*/
|
|
1040
|
+
export interface VideoReferenceMedia {
|
|
1041
|
+
type: VideoReferenceMediaType;
|
|
1042
|
+
/** @minLength 1 */
|
|
1043
|
+
url: string;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Provide a prompt, reference media, or both. Extra fields depend on the selected model and adapter.
|
|
1047
|
+
*/
|
|
1048
|
+
export interface VideoCreateRequest {
|
|
1049
|
+
/** @minLength 1 */
|
|
1050
|
+
model: string;
|
|
1051
|
+
prompt?: string;
|
|
1052
|
+
/** @minimum 1 */
|
|
1053
|
+
seconds?: number;
|
|
1054
|
+
size?: string;
|
|
1055
|
+
resolution?: string;
|
|
1056
|
+
/**
|
|
1057
|
+
* Backward-compatible first-frame image URL. May be combined with a last_frame, not another first_frame.
|
|
1058
|
+
* @minLength 1
|
|
1059
|
+
*/
|
|
1060
|
+
input_reference?: string;
|
|
1061
|
+
/**
|
|
1062
|
+
* @minItems 1
|
|
1063
|
+
* @maxItems 20
|
|
1064
|
+
*/
|
|
1065
|
+
reference_media?: VideoReferenceMedia[];
|
|
1066
|
+
/** Whether the output has audio; separate from a reference_audio input. */
|
|
1067
|
+
audio?: boolean;
|
|
1068
|
+
prompt_extend?: boolean;
|
|
1069
|
+
watermark?: boolean;
|
|
1070
|
+
seed?: number;
|
|
1071
|
+
negative_prompt?: string;
|
|
1072
|
+
[key: string]: unknown;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Provider measurements on a task; only completed tasks are settled.
|
|
1076
|
+
*/
|
|
1077
|
+
export interface VideoUsage {
|
|
1078
|
+
/**
|
|
1079
|
+
* Output duration, kept for compatibility.
|
|
1080
|
+
* @minimum 0
|
|
1081
|
+
*/
|
|
1082
|
+
seconds?: number;
|
|
1083
|
+
resolution?: string;
|
|
1084
|
+
/** @minimum 0 */
|
|
1085
|
+
input_seconds?: number;
|
|
1086
|
+
/** @minimum 0 */
|
|
1087
|
+
output_seconds?: number;
|
|
1088
|
+
/**
|
|
1089
|
+
* Total measured input and output video duration, not a monetary quote.
|
|
1090
|
+
* @minimum 0
|
|
1091
|
+
*/
|
|
1092
|
+
billable_seconds?: number;
|
|
1093
|
+
[key: string]: unknown;
|
|
1094
|
+
}
|
|
1095
|
+
export type VideoTaskStatus = (typeof VideoTaskStatus)[keyof typeof VideoTaskStatus];
|
|
1096
|
+
export declare const VideoTaskStatus: {
|
|
1097
|
+
readonly queued: "queued";
|
|
1098
|
+
readonly in_progress: "in_progress";
|
|
1099
|
+
readonly completed: "completed";
|
|
1100
|
+
readonly failed: "failed";
|
|
1101
|
+
};
|
|
1102
|
+
export type VideoTaskError = {
|
|
1103
|
+
code?: string;
|
|
1104
|
+
message?: string;
|
|
1105
|
+
[key: string]: unknown;
|
|
1106
|
+
};
|
|
1107
|
+
export interface VideoTask {
|
|
1108
|
+
id: string;
|
|
1109
|
+
object: string;
|
|
1110
|
+
status: VideoTaskStatus;
|
|
1111
|
+
model?: string;
|
|
1112
|
+
usage?: VideoUsage;
|
|
1113
|
+
/** Output duration, not the duration of input references. */
|
|
1114
|
+
seconds?: string;
|
|
1115
|
+
size?: string;
|
|
1116
|
+
created_at?: number;
|
|
1117
|
+
completed_at?: number;
|
|
1118
|
+
expires_at?: number;
|
|
1119
|
+
progress?: number;
|
|
1120
|
+
error?: VideoTaskError;
|
|
1121
|
+
[key: string]: unknown;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* A request body in the endpoint's own protocol. Canopy reads only the model name and forwards the rest unchanged.
|
|
1125
|
+
*/
|
|
1126
|
+
export interface NativeRequest {
|
|
1127
|
+
[key: string]: unknown;
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* A response body in the endpoint's own protocol, as the upstream returned it.
|
|
1131
|
+
*/
|
|
1132
|
+
export interface NativeResponse {
|
|
1133
|
+
[key: string]: unknown;
|
|
1134
|
+
}
|
|
990
1135
|
export type ResponseCreateReasoning = {
|
|
991
1136
|
[key: string]: unknown;
|
|
992
1137
|
};
|
|
@@ -1019,18 +1164,6 @@ export interface ResponseDeleted {
|
|
|
1019
1164
|
object: string;
|
|
1020
1165
|
deleted: boolean;
|
|
1021
1166
|
}
|
|
1022
|
-
/**
|
|
1023
|
-
* A request body in the endpoint's own protocol. Canopy reads only the model name and forwards the rest unchanged.
|
|
1024
|
-
*/
|
|
1025
|
-
export interface NativeRequest {
|
|
1026
|
-
[key: string]: unknown;
|
|
1027
|
-
}
|
|
1028
|
-
/**
|
|
1029
|
-
* A response body in the endpoint's own protocol, as the upstream returned it.
|
|
1030
|
-
*/
|
|
1031
|
-
export interface NativeResponse {
|
|
1032
|
-
[key: string]: unknown;
|
|
1033
|
-
}
|
|
1034
1167
|
/**
|
|
1035
1168
|
* Pagination metadata for stable numbered pages. total_count is returned only when the operation can determine it without an unbounded scan.
|
|
1036
1169
|
*/
|
|
@@ -1055,6 +1188,9 @@ export interface CursorPagination {
|
|
|
1055
1188
|
* The request conflicts with the current state of the service. The codes are described where they apply.
|
|
1056
1189
|
*/
|
|
1057
1190
|
export type ConflictResponse = Error;
|
|
1191
|
+
export type GetVideoContentHeaders = {
|
|
1192
|
+
Range?: string;
|
|
1193
|
+
};
|
|
1058
1194
|
export type StreamGenerateContentParams = {
|
|
1059
1195
|
alt?: StreamGenerateContentAlt;
|
|
1060
1196
|
};
|
|
@@ -99,6 +99,19 @@ export const CheckoutMode = {
|
|
|
99
99
|
automatic: "automatic",
|
|
100
100
|
deferred: "deferred",
|
|
101
101
|
};
|
|
102
|
+
export const VideoReferenceMediaType = {
|
|
103
|
+
first_frame: "first_frame",
|
|
104
|
+
last_frame: "last_frame",
|
|
105
|
+
reference_image: "reference_image",
|
|
106
|
+
reference_video: "reference_video",
|
|
107
|
+
reference_audio: "reference_audio",
|
|
108
|
+
};
|
|
109
|
+
export const VideoTaskStatus = {
|
|
110
|
+
queued: "queued",
|
|
111
|
+
in_progress: "in_progress",
|
|
112
|
+
completed: "completed",
|
|
113
|
+
failed: "failed",
|
|
114
|
+
};
|
|
102
115
|
export const StreamGenerateContentAlt = {
|
|
103
116
|
sse: "sse",
|
|
104
117
|
};
|
|
@@ -39,6 +39,55 @@
|
|
|
39
39
|
* OpenAPI spec version: 1.0.0
|
|
40
40
|
*/
|
|
41
41
|
import * as zod from "zod";
|
|
42
|
+
/**
|
|
43
|
+
* Create an asynchronous video task in the verified project. Model and upstream support
|
|
44
|
+
* determine the accepted duration, resolution and references. Poll the returned task id.
|
|
45
|
+
* `reference_media` is a Canopy extension for ordered, typed image, video and audio URLs.
|
|
46
|
+
* Existing `input_reference` remains a first frame.
|
|
47
|
+
* The runtime also accepts OpenAI multipart uploads; send reference_media as a JSON text field.
|
|
48
|
+
* No remote reference is downloaded or retained by Canopy during request preparation.
|
|
49
|
+
* @summary Create a video
|
|
50
|
+
*/
|
|
51
|
+
export declare const CreateVideoBody: zod.ZodObject<{
|
|
52
|
+
model: zod.ZodString;
|
|
53
|
+
prompt: zod.ZodOptional<zod.ZodString>;
|
|
54
|
+
seconds: zod.ZodOptional<zod.ZodInt>;
|
|
55
|
+
size: zod.ZodOptional<zod.ZodString>;
|
|
56
|
+
resolution: zod.ZodOptional<zod.ZodString>;
|
|
57
|
+
input_reference: zod.ZodOptional<zod.ZodString>;
|
|
58
|
+
reference_media: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
59
|
+
type: zod.ZodEnum<{
|
|
60
|
+
first_frame: "first_frame";
|
|
61
|
+
last_frame: "last_frame";
|
|
62
|
+
reference_image: "reference_image";
|
|
63
|
+
reference_video: "reference_video";
|
|
64
|
+
reference_audio: "reference_audio";
|
|
65
|
+
}>;
|
|
66
|
+
url: zod.ZodString;
|
|
67
|
+
}, zod.z.core.$strict>>>;
|
|
68
|
+
audio: zod.ZodOptional<zod.ZodBoolean>;
|
|
69
|
+
prompt_extend: zod.ZodOptional<zod.ZodBoolean>;
|
|
70
|
+
watermark: zod.ZodOptional<zod.ZodBoolean>;
|
|
71
|
+
seed: zod.ZodOptional<zod.ZodInt>;
|
|
72
|
+
negative_prompt: zod.ZodOptional<zod.ZodString>;
|
|
73
|
+
}, zod.z.core.$strict>;
|
|
74
|
+
/**
|
|
75
|
+
* Read an existing task owned by the verified project; does not create another video.
|
|
76
|
+
* @summary Get a video task
|
|
77
|
+
*/
|
|
78
|
+
export declare const GetVideoParams: zod.ZodObject<{
|
|
79
|
+
video: zod.ZodString;
|
|
80
|
+
}, zod.z.core.$strict>;
|
|
81
|
+
/**
|
|
82
|
+
* Stream a completed video owned by the verified project. Supports HTTP Range.
|
|
83
|
+
* @summary Get generated video content
|
|
84
|
+
*/
|
|
85
|
+
export declare const GetVideoContentParams: zod.ZodObject<{
|
|
86
|
+
video: zod.ZodString;
|
|
87
|
+
}, zod.z.core.$strict>;
|
|
88
|
+
export declare const GetVideoContentHeader: zod.ZodObject<{
|
|
89
|
+
Range: zod.ZodOptional<zod.ZodString>;
|
|
90
|
+
}, zod.z.core.$strict>;
|
|
42
91
|
/**
|
|
43
92
|
* Supports JSON, SSE and native upstream response storage. Stored continuation is restricted to the current project and original provider credential. WebSocket clients connect with GET /v1/responses and send response.create events; one response may be active on a connection at a time. The connection stays on its initial model and provider credential.
|
|
44
93
|
* @summary Create a model response
|
|
@@ -46,6 +46,34 @@ import { EmbeddingRequest } from "./validators/embeddingRequest.zod.js";
|
|
|
46
46
|
import { NativeRequest } from "./validators/nativeRequest.zod.js";
|
|
47
47
|
import { ResponseCreate } from "./validators/responseCreate.zod.js";
|
|
48
48
|
import { UpdateAPIKeyRequestBody } from "./validators/updateAPIKeyRequestBody.zod.js";
|
|
49
|
+
import { VideoCreateRequest } from "./validators/videoCreateRequest.zod.js";
|
|
50
|
+
/**
|
|
51
|
+
* Create an asynchronous video task in the verified project. Model and upstream support
|
|
52
|
+
* determine the accepted duration, resolution and references. Poll the returned task id.
|
|
53
|
+
* `reference_media` is a Canopy extension for ordered, typed image, video and audio URLs.
|
|
54
|
+
* Existing `input_reference` remains a first frame.
|
|
55
|
+
* The runtime also accepts OpenAI multipart uploads; send reference_media as a JSON text field.
|
|
56
|
+
* No remote reference is downloaded or retained by Canopy during request preparation.
|
|
57
|
+
* @summary Create a video
|
|
58
|
+
*/
|
|
59
|
+
export const CreateVideoBody = VideoCreateRequest;
|
|
60
|
+
/**
|
|
61
|
+
* Read an existing task owned by the verified project; does not create another video.
|
|
62
|
+
* @summary Get a video task
|
|
63
|
+
*/
|
|
64
|
+
export const GetVideoParams = zod.strictObject({
|
|
65
|
+
video: zod.string().min(1),
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Stream a completed video owned by the verified project. Supports HTTP Range.
|
|
69
|
+
* @summary Get generated video content
|
|
70
|
+
*/
|
|
71
|
+
export const GetVideoContentParams = zod.strictObject({
|
|
72
|
+
video: zod.string().min(1),
|
|
73
|
+
});
|
|
74
|
+
export const GetVideoContentHeader = zod.strictObject({
|
|
75
|
+
Range: zod.string().optional(),
|
|
76
|
+
});
|
|
49
77
|
/**
|
|
50
78
|
* Supports JSON, SSE and native upstream response storage. Stored continuation is restricted to the current project and original provider credential. WebSocket clients connect with GET /v1/responses and send response.create events; one response may be active on a connection at a time. The connection stays on its initial model and provider credential.
|
|
51
79
|
* @summary Create a model response
|
|
@@ -83,6 +83,16 @@ export declare const CursorPageRequestResource: zod.ZodObject<{
|
|
|
83
83
|
quality: zod.ZodNullable<zod.ZodString>;
|
|
84
84
|
resolution: zod.ZodNullable<zod.ZodString>;
|
|
85
85
|
}, zod.z.core.$strict>, zod.ZodNull]>>;
|
|
86
|
+
media_details: zod.ZodOptional<zod.ZodObject<{
|
|
87
|
+
input_video_seconds: zod.ZodOptional<zod.ZodNumber>;
|
|
88
|
+
output_video_seconds: zod.ZodOptional<zod.ZodNumber>;
|
|
89
|
+
input_audio_seconds: zod.ZodOptional<zod.ZodNumber>;
|
|
90
|
+
input_image_quantity: zod.ZodOptional<zod.ZodString>;
|
|
91
|
+
input_images: zod.ZodOptional<zod.ZodInt>;
|
|
92
|
+
output_images: zod.ZodOptional<zod.ZodInt>;
|
|
93
|
+
video_quantity: zod.ZodOptional<zod.ZodString>;
|
|
94
|
+
reference_counts: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodInt>>;
|
|
95
|
+
}, zod.z.core.$strict>>;
|
|
86
96
|
}, zod.z.core.$strict>>;
|
|
87
97
|
next_cursor: zod.ZodString;
|
|
88
98
|
}, zod.z.core.$strict>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Canopy API
|
|
5
|
+
* Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
|
|
6
|
+
*
|
|
7
|
+
* Project inference is served on this host in each provider's own protocol:
|
|
8
|
+
*
|
|
9
|
+
* - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
|
|
10
|
+
* `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
|
|
11
|
+
* - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
|
|
12
|
+
* - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
|
|
13
|
+
*
|
|
14
|
+
* Canopy does not convert between protocols. A request is accepted only for a model whose
|
|
15
|
+
* `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
|
|
16
|
+
* the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
|
|
17
|
+
* through as written; a model's `capabilities` lists the values its upstream accepts.
|
|
18
|
+
*
|
|
19
|
+
* Management operations use `/api/v1`. The management model catalogue names how each model is billed in Billing;
|
|
20
|
+
* `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
|
|
21
|
+
*
|
|
22
|
+
* ## Authentication
|
|
23
|
+
*
|
|
24
|
+
* Every request carries a scoped token; see the `bearerAuth` security scheme.
|
|
25
|
+
*
|
|
26
|
+
* Management and project inference accept the same verified IAM scoped token. The token is the
|
|
27
|
+
* sole billing project authority; `OpenAI-Project` and historical identity headers cannot
|
|
28
|
+
* override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
|
|
29
|
+
* accepts Canopy API keys and serves the same endpoints.
|
|
30
|
+
*
|
|
31
|
+
* ## Conventions
|
|
32
|
+
*
|
|
33
|
+
* - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
|
|
34
|
+
* - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
|
|
35
|
+
* - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
|
|
36
|
+
* - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
|
|
37
|
+
* - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
|
|
38
|
+
* - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
|
|
39
|
+
* OpenAPI spec version: 1.0.0
|
|
40
|
+
*/
|
|
41
|
+
import * as zod from "zod";
|
|
42
|
+
export declare const GetVideoContentHeaders: zod.ZodObject<{
|
|
43
|
+
Range: zod.ZodOptional<zod.ZodString>;
|
|
44
|
+
}, zod.z.core.$strict>;
|
|
45
|
+
export type GetVideoContentHeaders = zod.input<typeof GetVideoContentHeaders>;
|
|
46
|
+
export type GetVideoContentHeadersOutput = zod.output<typeof GetVideoContentHeaders>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow Canopy API
|
|
5
|
+
* Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
|
|
6
|
+
*
|
|
7
|
+
* Project inference is served on this host in each provider's own protocol:
|
|
8
|
+
*
|
|
9
|
+
* - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
|
|
10
|
+
* `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
|
|
11
|
+
* - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
|
|
12
|
+
* - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
|
|
13
|
+
*
|
|
14
|
+
* Canopy does not convert between protocols. A request is accepted only for a model whose
|
|
15
|
+
* `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
|
|
16
|
+
* the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
|
|
17
|
+
* through as written; a model's `capabilities` lists the values its upstream accepts.
|
|
18
|
+
*
|
|
19
|
+
* Management operations use `/api/v1`. The management model catalogue names how each model is billed in Billing;
|
|
20
|
+
* `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
|
|
21
|
+
*
|
|
22
|
+
* ## Authentication
|
|
23
|
+
*
|
|
24
|
+
* Every request carries a scoped token; see the `bearerAuth` security scheme.
|
|
25
|
+
*
|
|
26
|
+
* Management and project inference accept the same verified IAM scoped token. The token is the
|
|
27
|
+
* sole billing project authority; `OpenAI-Project` and historical identity headers cannot
|
|
28
|
+
* override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
|
|
29
|
+
* accepts Canopy API keys and serves the same endpoints.
|
|
30
|
+
*
|
|
31
|
+
* ## Conventions
|
|
32
|
+
*
|
|
33
|
+
* - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
|
|
34
|
+
* - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
|
|
35
|
+
* - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
|
|
36
|
+
* - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
|
|
37
|
+
* - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
|
|
38
|
+
* - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
|
|
39
|
+
* OpenAPI spec version: 1.0.0
|
|
40
|
+
*/
|
|
41
|
+
import * as zod from "zod";
|
|
42
|
+
export const GetVideoContentHeaders = zod.strictObject({
|
|
43
|
+
Range: zod.string().optional(),
|
|
44
|
+
});
|