@acedatacloud/sdk 2026.910.0 → 2026.1005.0
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/README.md +25 -0
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +81 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/resources/kling.ts +38 -2
- package/src/resources/providers/flux.ts +58 -0
- package/src/resources/providers/seedance.ts +9 -3
- package/src/resources/providers/seedream.ts +1 -1
- package/src/resources/providers/suno.ts +33 -0
package/package.json
CHANGED
package/src/resources/kling.ts
CHANGED
|
@@ -10,6 +10,7 @@ export const KLING_MODELS = [
|
|
|
10
10
|
'kling-v2-5-turbo',
|
|
11
11
|
'kling-v2-6',
|
|
12
12
|
'kling-v3',
|
|
13
|
+
'kling-v3-turbo',
|
|
13
14
|
'kling-v3-omni',
|
|
14
15
|
'kling-o1',
|
|
15
16
|
] as const;
|
|
@@ -58,6 +59,11 @@ export interface KlingGenerateOptions {
|
|
|
58
59
|
videoList?: KlingReferenceVideo[];
|
|
59
60
|
negativePrompt?: string;
|
|
60
61
|
startImageUrl?: string;
|
|
62
|
+
multiShot?: boolean;
|
|
63
|
+
shotType?: 'intelligence' | 'customize';
|
|
64
|
+
multiPrompt?: Array<{ index: number; prompt: string; duration: number }>;
|
|
65
|
+
elementList?: Array<Record<string, unknown>>;
|
|
66
|
+
voiceList?: Array<Record<string, unknown>>;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
function isHttpUrl(value: string): boolean {
|
|
@@ -73,7 +79,16 @@ function validateGenerateOptions(opts: KlingGenerateOptions): void {
|
|
|
73
79
|
if (!KLING_MODELS.includes(opts.model)) {
|
|
74
80
|
throw new Error(`model must be one of: ${KLING_MODELS.join(', ')}`);
|
|
75
81
|
}
|
|
76
|
-
const
|
|
82
|
+
const isTurbo = opts.model === 'kling-v3-turbo';
|
|
83
|
+
const isV3 = opts.model === 'kling-v3' || opts.model === 'kling-v3-omni' || isTurbo;
|
|
84
|
+
if (isTurbo) {
|
|
85
|
+
if ((opts.mode !== undefined && !['std', 'pro'].includes(opts.mode)) || opts.generateAudio === false) {
|
|
86
|
+
throw new Error('Turbo supports std/pro with included audio');
|
|
87
|
+
}
|
|
88
|
+
if ([opts.endImageUrl, opts.cameraControl, opts.cfgScale, opts.negativePrompt, opts.imageList, opts.videoList, opts.elementList, opts.voiceList].some(value => value !== undefined) || opts.multiShot || opts.multiPrompt) {
|
|
89
|
+
throw new Error('Turbo does not support tail frames, camera controls, Omni references or storyboards');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
77
92
|
const hasReferences = Boolean(opts.imageList?.length || opts.videoList?.length);
|
|
78
93
|
|
|
79
94
|
if (opts.imageList !== undefined && opts.imageList.length === 0) {
|
|
@@ -83,7 +98,7 @@ function validateGenerateOptions(opts: KlingGenerateOptions): void {
|
|
|
83
98
|
throw new Error('videoList must be non-empty or omitted');
|
|
84
99
|
}
|
|
85
100
|
|
|
86
|
-
if ((opts.action === 'text2video' || opts.action === 'image2video') && !opts.prompt) {
|
|
101
|
+
if ((opts.action === 'text2video' || opts.action === 'image2video') && !opts.prompt && !opts.multiPrompt?.length) {
|
|
87
102
|
throw new Error('prompt is required for text2video and image2video');
|
|
88
103
|
}
|
|
89
104
|
if (opts.action === 'image2video' && !opts.startImageUrl) {
|
|
@@ -217,6 +232,11 @@ export class Kling {
|
|
|
217
232
|
startImageUrl,
|
|
218
233
|
} = opts;
|
|
219
234
|
const body: Record<string, unknown> = { action };
|
|
235
|
+
if (opts.multiShot !== undefined) body.multi_shot = opts.multiShot;
|
|
236
|
+
if (opts.shotType !== undefined) body.shot_type = opts.shotType;
|
|
237
|
+
if (opts.multiPrompt !== undefined) body.multi_prompt = opts.multiPrompt;
|
|
238
|
+
if (opts.elementList !== undefined) body.element_list = opts.elementList;
|
|
239
|
+
if (opts.voiceList !== undefined) body.voice_list = opts.voiceList;
|
|
220
240
|
if (mode !== undefined) body.mode = mode;
|
|
221
241
|
if (model !== undefined) body.model = model;
|
|
222
242
|
if (prompt !== undefined) body.prompt = prompt;
|
|
@@ -278,4 +298,20 @@ export class Kling {
|
|
|
278
298
|
if (opts.async !== undefined) body.async = opts.async;
|
|
279
299
|
return this.transport.request('POST', '/kling/motion', { json: body });
|
|
280
300
|
}
|
|
301
|
+
|
|
302
|
+
async lipSync(request: Record<string, unknown>): Promise<Record<string, unknown>> {
|
|
303
|
+
return this.transport.request('POST', '/kling/lip-sync', { json: request });
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
async talkingPhoto(request: Record<string, unknown>): Promise<Record<string, unknown>> {
|
|
307
|
+
return this.transport.request('POST', '/kling/talking-photo', { json: request });
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
async goodsStudio(request: Record<string, unknown>): Promise<Record<string, unknown>> {
|
|
311
|
+
return this.transport.request('POST', '/kling/goods-studio', { json: request });
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async videoCommerce(request: Record<string, unknown>): Promise<Record<string, unknown>> {
|
|
315
|
+
return this.transport.request('POST', '/kling/video-commerce', { json: request });
|
|
316
|
+
}
|
|
281
317
|
}
|
|
@@ -40,6 +40,32 @@ export interface FluxGenerateOptions {
|
|
|
40
40
|
[key: string]: unknown;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
export interface FluxVideosOptions {
|
|
44
|
+
mode: "t2v" | "i2v" | "v2v" | "draft_enhance";
|
|
45
|
+
action?: "generate";
|
|
46
|
+
prompt?: string;
|
|
47
|
+
aspectRatio?: "21:9" | "2:1" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "9:21" | "auto";
|
|
48
|
+
duration?: number | "auto";
|
|
49
|
+
resolution?: "hd" | "fhd" | "qhd" | "uhd";
|
|
50
|
+
version?: "latest";
|
|
51
|
+
generateAudio?: boolean;
|
|
52
|
+
safetyTolerance?: number;
|
|
53
|
+
draft?: boolean;
|
|
54
|
+
model?: "flux-3";
|
|
55
|
+
keyframes?: string | unknown[] | string[];
|
|
56
|
+
startVideo?: string;
|
|
57
|
+
draftTaskId?: string;
|
|
58
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
59
|
+
async?: boolean;
|
|
60
|
+
/** Wait for completion before returning the handle. */
|
|
61
|
+
wait?: boolean;
|
|
62
|
+
pollInterval?: number;
|
|
63
|
+
maxWait?: number;
|
|
64
|
+
callbackUrl?: string;
|
|
65
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
68
|
+
|
|
43
69
|
/** flux client. */
|
|
44
70
|
export class Flux {
|
|
45
71
|
constructor(private transport: Transport) {}
|
|
@@ -68,4 +94,36 @@ export class Flux {
|
|
|
68
94
|
return handle;
|
|
69
95
|
}
|
|
70
96
|
|
|
97
|
+
/** Flux Generate Summary */
|
|
98
|
+
async videos(options: FluxVideosOptions): Promise<TaskHandle> {
|
|
99
|
+
const body: Record<string, unknown> = {};
|
|
100
|
+
body["mode"] = options.mode;
|
|
101
|
+
body["action"] = options.action ?? "generate";
|
|
102
|
+
if (options.prompt !== undefined) body["prompt"] = options.prompt;
|
|
103
|
+
body["aspect_ratio"] = options.aspectRatio ?? "auto";
|
|
104
|
+
if (options.duration !== undefined) body["duration"] = options.duration;
|
|
105
|
+
body["resolution"] = options.resolution ?? "hd";
|
|
106
|
+
body["version"] = options.version ?? "latest";
|
|
107
|
+
if (options.generateAudio !== undefined) body["generate_audio"] = options.generateAudio;
|
|
108
|
+
body["safety_tolerance"] = options.safetyTolerance ?? 2;
|
|
109
|
+
if (options.draft !== undefined) body["draft"] = options.draft;
|
|
110
|
+
body["model"] = options.model ?? "flux-3";
|
|
111
|
+
if (options.keyframes !== undefined) body["keyframes"] = options.keyframes;
|
|
112
|
+
if (options.startVideo !== undefined) body["start_video"] = options.startVideo;
|
|
113
|
+
if (options.draftTaskId !== undefined) body["draft_task_id"] = options.draftTaskId;
|
|
114
|
+
for (const [key, value] of Object.entries(options)) {
|
|
115
|
+
if (!["action", "aspectRatio", "async", "callbackUrl", "draft", "draftTaskId", "duration", "generateAudio", "keyframes", "maxWait", "mode", "model", "pollInterval", "prompt", "resolution", "safetyTolerance", "startVideo", "version", "wait"].includes(key) && value !== undefined) {
|
|
116
|
+
body[key] = value;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
120
|
+
body.async = options.async ?? true;
|
|
121
|
+
const result = (await this.transport.request('POST', "/flux/videos", { json: body })) as Record<string, unknown>;
|
|
122
|
+
const handle = new TaskHandle(taskId(result), "/flux/tasks", this.transport, result);
|
|
123
|
+
if (options.wait) {
|
|
124
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
125
|
+
}
|
|
126
|
+
return handle;
|
|
127
|
+
}
|
|
128
|
+
|
|
71
129
|
}
|
|
@@ -41,12 +41,16 @@ export interface SeedanceGenerateOptions {
|
|
|
41
41
|
returnLastFrame?: boolean;
|
|
42
42
|
/** $t(seedance_videos_execution_expires_after) */
|
|
43
43
|
executionExpiresAfter?: number;
|
|
44
|
-
/**
|
|
45
|
-
omniReferenceTaskType?: "auto" | "edit" | "extend";
|
|
44
|
+
/** Seedance Videos Omni Reference Task Type */
|
|
45
|
+
omniReferenceTaskType?: "auto" | "reference" | "edit" | "extend";
|
|
46
46
|
/** $t(seedance_videos_output_format) */
|
|
47
47
|
outputFormat?: "mp4" | "mov";
|
|
48
48
|
/** $t(seedance_videos_tools) */
|
|
49
49
|
tools?: Array<Record<string, unknown>>;
|
|
50
|
+
/** Seedance Videos Priority */
|
|
51
|
+
priority?: number;
|
|
52
|
+
/** Seedance Videos Safety Identifier */
|
|
53
|
+
safetyIdentifier?: string;
|
|
50
54
|
/** Submit asynchronously and poll. Defaults to true. */
|
|
51
55
|
async?: boolean;
|
|
52
56
|
/** Wait for completion before returning the handle. */
|
|
@@ -80,8 +84,10 @@ export class Seedance {
|
|
|
80
84
|
if (options.omniReferenceTaskType !== undefined) body["omni_reference_task_type"] = options.omniReferenceTaskType;
|
|
81
85
|
if (options.outputFormat !== undefined) body["output_format"] = options.outputFormat;
|
|
82
86
|
if (options.tools !== undefined) body["tools"] = options.tools;
|
|
87
|
+
body["priority"] = options.priority ?? 0;
|
|
88
|
+
if (options.safetyIdentifier !== undefined) body["safety_identifier"] = options.safetyIdentifier;
|
|
83
89
|
for (const [key, value] of Object.entries(options)) {
|
|
84
|
-
if (!["async", "callbackUrl", "camerafixed", "content", "duration", "executionExpiresAfter", "frames", "generateAudio", "maxWait", "model", "omniReferenceTaskType", "outputFormat", "pollInterval", "ratio", "resolution", "returnLastFrame", "seed", "tools", "wait", "watermark"].includes(key) && value !== undefined) {
|
|
90
|
+
if (!["async", "callbackUrl", "camerafixed", "content", "duration", "executionExpiresAfter", "frames", "generateAudio", "maxWait", "model", "omniReferenceTaskType", "outputFormat", "pollInterval", "priority", "ratio", "resolution", "returnLastFrame", "safetyIdentifier", "seed", "tools", "wait", "watermark"].includes(key) && value !== undefined) {
|
|
85
91
|
body[key] = value;
|
|
86
92
|
}
|
|
87
93
|
}
|
|
@@ -18,7 +18,7 @@ function taskId(result: Record<string, unknown>): string {
|
|
|
18
18
|
|
|
19
19
|
export interface SeedreamGenerateOptions {
|
|
20
20
|
/** Full model ID. Seedream 5.0 Pro supports single-image generation, precise editing, transparent backgrounds, and layer decomposition; Seedream 5.0 Lite supports single or sequential images, streaming, and web search. */
|
|
21
|
-
model: "doubao-seedream-5-0-pro-260628" | "doubao-seedream-5-0-
|
|
21
|
+
model: "doubao-seedream-5-0-pro-260628" | "doubao-seedream-5-0-lite-260128" | "doubao-seedream-4-0-250828" | "doubao-seedream-4-5-251128";
|
|
22
22
|
/** Generation or editing prompt. Optional only for Seedream 5.0 Pro layer decomposition, where omission automatically decomposes the main elements. */
|
|
23
23
|
prompt?: string;
|
|
24
24
|
/** One reference image URL/base64 string or an array. Pro accepts up to 10 images in regular mode and exactly one for decomposition; Lite/4.x accept up to 14. Each image must be at most 30 MB. */
|
|
@@ -214,6 +214,20 @@ export interface SunoUploadOptions {
|
|
|
214
214
|
[key: string]: unknown;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
export interface SunoMp3Options {
|
|
218
|
+
/** Suno Mp3 Audio Id */
|
|
219
|
+
audioId: string;
|
|
220
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
221
|
+
async?: boolean;
|
|
222
|
+
/** Wait for completion before returning the handle. */
|
|
223
|
+
wait?: boolean;
|
|
224
|
+
pollInterval?: number;
|
|
225
|
+
maxWait?: number;
|
|
226
|
+
callbackUrl?: string;
|
|
227
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
228
|
+
[key: string]: unknown;
|
|
229
|
+
}
|
|
230
|
+
|
|
217
231
|
/** suno client. */
|
|
218
232
|
export class Suno {
|
|
219
233
|
constructor(private transport: Transport) {}
|
|
@@ -437,4 +451,23 @@ export class Suno {
|
|
|
437
451
|
return (await this.transport.request('POST', "/suno/upload", { json: body })) as Record<string, unknown>;
|
|
438
452
|
}
|
|
439
453
|
|
|
454
|
+
/** Suno Mp3 */
|
|
455
|
+
async mp3(options: SunoMp3Options): Promise<TaskHandle> {
|
|
456
|
+
const body: Record<string, unknown> = {};
|
|
457
|
+
body["audio_id"] = options.audioId;
|
|
458
|
+
for (const [key, value] of Object.entries(options)) {
|
|
459
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
460
|
+
body[key] = value;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
464
|
+
body.async = options.async ?? true;
|
|
465
|
+
const result = (await this.transport.request('POST', "/suno/mp3", { json: body })) as Record<string, unknown>;
|
|
466
|
+
const handle = new TaskHandle(taskId(result), "/suno/tasks", this.transport, result);
|
|
467
|
+
if (options.wait) {
|
|
468
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
469
|
+
}
|
|
470
|
+
return handle;
|
|
471
|
+
}
|
|
472
|
+
|
|
440
473
|
}
|