@acedatacloud/sdk 2026.814.0 → 2026.824.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/dist/index.js +102 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/resources/providers/digitalhuman.ts +1 -1
- package/src/resources/providers/fish.ts +2 -2
- package/src/resources/providers/flux.ts +3 -3
- package/src/resources/providers/hailuo.ts +1 -1
- package/src/resources/providers/happyhorse.ts +3 -3
- package/src/resources/providers/index.ts +3 -0
- package/src/resources/providers/luma.ts +3 -3
- package/src/resources/providers/minimax.ts +11 -9
- package/src/resources/providers/nano-banana.ts +1 -1
- package/src/resources/providers/qwen-image.ts +86 -0
- package/src/resources/providers/seedance.ts +1 -1
- package/src/resources/providers/seedream.ts +1 -1
- package/src/resources/providers/suno.ts +5 -5
- package/src/resources/providers/wan.ts +43 -31
package/package.json
CHANGED
|
@@ -74,7 +74,7 @@ export class Digitalhuman {
|
|
|
74
74
|
async generate(options: DigitalhumanGenerateOptions): Promise<TaskHandle> {
|
|
75
75
|
const body: Record<string, unknown> = {};
|
|
76
76
|
body["video_url"] = options.videoUrl;
|
|
77
|
-
body["text"] = options.text
|
|
77
|
+
if (options.text !== undefined) body["text"] = options.text;
|
|
78
78
|
body["speed"] = options.speed ?? 1.0;
|
|
79
79
|
body["steps"] = options.steps ?? 40;
|
|
80
80
|
body["engine"] = options.engine ?? "latentsync";
|
|
@@ -30,7 +30,7 @@ export interface FishGenerateOptions {
|
|
|
30
30
|
/** Is the input text subjected to text normalization processing by the upstream? */
|
|
31
31
|
normalize?: boolean;
|
|
32
32
|
/** Inline reference audio samples will be forwarded upstream as is, for zero-shot voice cloning. */
|
|
33
|
-
references?: unknown
|
|
33
|
+
references?: Array<Record<string, unknown>>;
|
|
34
34
|
/** MP3 bitrate when `format=mp3`. */
|
|
35
35
|
mp3Bitrate?: number;
|
|
36
36
|
/** Output the audio sampling rate (e.g., 16000, 22050, 44100). */
|
|
@@ -103,7 +103,7 @@ export class Fish {
|
|
|
103
103
|
if (options.temperature !== undefined) body["temperature"] = options.temperature;
|
|
104
104
|
if (options.chunkLength !== undefined) body["chunk_length"] = options.chunkLength;
|
|
105
105
|
if (options.opusBitrate !== undefined) body["opus_bitrate"] = options.opusBitrate;
|
|
106
|
-
body["reference_id"] = options.referenceId
|
|
106
|
+
if (options.referenceId !== undefined) body["reference_id"] = options.referenceId;
|
|
107
107
|
if (options.maxNewTokens !== undefined) body["max_new_tokens"] = options.maxNewTokens;
|
|
108
108
|
if (options.minChunkLength !== undefined) body["min_chunk_length"] = options.minChunkLength;
|
|
109
109
|
if (options.repetitionPenalty !== undefined) body["repetition_penalty"] = options.repetitionPenalty;
|
|
@@ -17,12 +17,12 @@ function taskId(result: Record<string, unknown>): string {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface FluxGenerateOptions {
|
|
20
|
+
/** Image size specifications. */
|
|
21
|
+
size: string;
|
|
20
22
|
/** Types of operations for generating images. If it is `generate`, a new image will be created based on the prompt; if it is `edit`, the original image will be edited according to the prompt and `image_url`. */
|
|
21
23
|
action: "generate" | "edit";
|
|
22
24
|
/** Prompts for generating images. */
|
|
23
25
|
prompt: string;
|
|
24
|
-
/** Image size specifications. */
|
|
25
|
-
size?: string;
|
|
26
26
|
/** Number of generated images. */
|
|
27
27
|
count?: number;
|
|
28
28
|
/** Model used for generating images. */
|
|
@@ -47,9 +47,9 @@ export class Flux {
|
|
|
47
47
|
/** Flux AI image generation API, generates 1 image per request. */
|
|
48
48
|
async generate(options: FluxGenerateOptions): Promise<TaskHandle> {
|
|
49
49
|
const body: Record<string, unknown> = {};
|
|
50
|
+
body["size"] = options.size;
|
|
50
51
|
body["action"] = options.action;
|
|
51
52
|
body["prompt"] = options.prompt;
|
|
52
|
-
body["size"] = options.size ?? "1024x1024";
|
|
53
53
|
if (options.count !== undefined) body["count"] = options.count;
|
|
54
54
|
if (options.model !== undefined) body["model"] = options.model;
|
|
55
55
|
if (options.imageUrl !== undefined) body["image_url"] = options.imageUrl;
|
|
@@ -45,7 +45,7 @@ export class Hailuo {
|
|
|
45
45
|
const body: Record<string, unknown> = {};
|
|
46
46
|
body["action"] = options.action;
|
|
47
47
|
if (options.model !== undefined) body["model"] = options.model;
|
|
48
|
-
body["prompt"] = options.prompt
|
|
48
|
+
if (options.prompt !== undefined) body["prompt"] = options.prompt;
|
|
49
49
|
if (options.firstImageUrl !== undefined) body["first_image_url"] = options.firstImageUrl;
|
|
50
50
|
for (const [key, value] of Object.entries(options)) {
|
|
51
51
|
if (!["action", "async", "callbackUrl", "firstImageUrl", "maxWait", "model", "pollInterval", "prompt", "wait"].includes(key) && value !== undefined) {
|
|
@@ -63,10 +63,10 @@ export class Happyhorse {
|
|
|
63
63
|
body["model"] = options.model ?? "happyhorse-1.1-t2v";
|
|
64
64
|
body["ratio"] = options.ratio ?? "16:9";
|
|
65
65
|
body["action"] = options.action ?? "generate";
|
|
66
|
-
body["prompt"] = options.prompt
|
|
66
|
+
if (options.prompt !== undefined) body["prompt"] = options.prompt;
|
|
67
67
|
body["duration"] = options.duration ?? 5;
|
|
68
|
-
body["image_url"] = options.imageUrl
|
|
69
|
-
body["video_url"] = options.videoUrl
|
|
68
|
+
if (options.imageUrl !== undefined) body["image_url"] = options.imageUrl;
|
|
69
|
+
if (options.videoUrl !== undefined) body["video_url"] = options.videoUrl;
|
|
70
70
|
body["watermark"] = options.watermark ?? false;
|
|
71
71
|
if (options.imageUrls !== undefined) body["image_urls"] = options.imageUrls;
|
|
72
72
|
body["resolution"] = options.resolution ?? "1080P";
|
|
@@ -12,6 +12,7 @@ export { Maestro } from './maestro';
|
|
|
12
12
|
export { Minimax } from './minimax';
|
|
13
13
|
export { NanoBanana } from './nano-banana';
|
|
14
14
|
export { Producer } from './producer';
|
|
15
|
+
export { QwenImage } from './qwen-image';
|
|
15
16
|
export { Seedance } from './seedance';
|
|
16
17
|
export { Seedream } from './seedream';
|
|
17
18
|
export { Suno } from './suno';
|
|
@@ -30,6 +31,7 @@ import { Maestro } from './maestro';
|
|
|
30
31
|
import { Minimax } from './minimax';
|
|
31
32
|
import { NanoBanana } from './nano-banana';
|
|
32
33
|
import { Producer } from './producer';
|
|
34
|
+
import { QwenImage } from './qwen-image';
|
|
33
35
|
import { Seedance } from './seedance';
|
|
34
36
|
import { Seedream } from './seedream';
|
|
35
37
|
import { Suno } from './suno';
|
|
@@ -49,6 +51,7 @@ export function attachProviders(client: Record<string, unknown>, transport: Tran
|
|
|
49
51
|
client.minimax = new Minimax(transport);
|
|
50
52
|
client.nanobanana = new NanoBanana(transport);
|
|
51
53
|
client.producer = new Producer(transport);
|
|
54
|
+
client.qwenimage = new QwenImage(transport);
|
|
52
55
|
client.seedance = new Seedance(transport);
|
|
53
56
|
client.seedream = new Seedream(transport);
|
|
54
57
|
client.suno = new Suno(transport);
|
|
@@ -57,14 +57,14 @@ export class Luma {
|
|
|
57
57
|
const body: Record<string, unknown> = {};
|
|
58
58
|
body["loop"] = options.loop ?? false;
|
|
59
59
|
body["action"] = options.action ?? "generate";
|
|
60
|
-
body["prompt"] = options.prompt
|
|
60
|
+
if (options.prompt !== undefined) body["prompt"] = options.prompt;
|
|
61
61
|
body["timeout"] = options.timeout ?? 300;
|
|
62
62
|
if (options.videoId !== undefined) body["video_id"] = options.videoId;
|
|
63
63
|
if (options.videoUrl !== undefined) body["video_url"] = options.videoUrl;
|
|
64
64
|
body["enhancement"] = options.enhancement ?? true;
|
|
65
65
|
if (options.aspectRatio !== undefined) body["aspect_ratio"] = options.aspectRatio;
|
|
66
|
-
body["end_image_url"] = options.endImageUrl
|
|
67
|
-
body["start_image_url"] = options.startImageUrl
|
|
66
|
+
if (options.endImageUrl !== undefined) body["end_image_url"] = options.endImageUrl;
|
|
67
|
+
if (options.startImageUrl !== undefined) body["start_image_url"] = options.startImageUrl;
|
|
68
68
|
for (const [key, value] of Object.entries(options)) {
|
|
69
69
|
if (!["action", "aspectRatio", "async", "callbackUrl", "endImageUrl", "enhancement", "loop", "maxWait", "pollInterval", "prompt", "startImageUrl", "timeout", "videoId", "videoUrl", "wait"].includes(key) && value !== undefined) {
|
|
70
70
|
body[key] = value;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { Transport } from '../../runtime/transport';
|
|
9
9
|
import { TaskHandle } from '../../runtime/tasks';
|
|
10
10
|
|
|
11
|
+
|
|
11
12
|
function taskId(result: Record<string, unknown>): string {
|
|
12
13
|
if (typeof result?.task_id === 'string') return result.task_id;
|
|
13
14
|
const data = result?.data as Record<string, unknown> | undefined;
|
|
@@ -15,19 +16,20 @@ function taskId(result: Record<string, unknown>): string {
|
|
|
15
16
|
return typeof result?.id === 'string' ? result.id : '';
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
|
|
19
19
|
export interface MinimaxGenerateOptions {
|
|
20
|
-
/**
|
|
20
|
+
/** Model name, currently only supports the official value `MiniMax-H3`. */
|
|
21
21
|
model: "MiniMax-H3";
|
|
22
|
-
/**
|
|
22
|
+
/** Official MiniMax H3 V2 multimodal input array. Each request must include a non-empty `text`; supports images at the beginning and end or multimodal reference materials, but the two types of scenes cannot be mixed. */
|
|
23
23
|
content: Array<Record<string, unknown>>;
|
|
24
|
-
/**
|
|
25
|
-
resolution: "768P" | "2K";
|
|
26
|
-
/** Minimax Videos Duration */
|
|
24
|
+
/** Video duration, required, integer between 4 and 15 seconds. */
|
|
27
25
|
duration: number;
|
|
28
|
-
/**
|
|
26
|
+
/** Video resolution, required, optional `768P` or `2K`. */
|
|
27
|
+
resolution: "768P" | "2K";
|
|
28
|
+
/** Video aspect ratio. Text-to-video is required and cannot be `adaptive`; image-to-video defaults to `adaptive`; multimodal reference is optional. */
|
|
29
29
|
ratio?: "adaptive" | "21:9" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
|
|
30
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
30
31
|
async?: boolean;
|
|
32
|
+
/** Wait for completion before returning the handle. */
|
|
31
33
|
wait?: boolean;
|
|
32
34
|
pollInterval?: number;
|
|
33
35
|
maxWait?: number;
|
|
@@ -40,13 +42,13 @@ export interface MinimaxGenerateOptions {
|
|
|
40
42
|
export class Minimax {
|
|
41
43
|
constructor(private transport: Transport) {}
|
|
42
44
|
|
|
43
|
-
/**
|
|
45
|
+
/** Call /minimax/videos. */
|
|
44
46
|
async generate(options: MinimaxGenerateOptions): Promise<TaskHandle> {
|
|
45
47
|
const body: Record<string, unknown> = {};
|
|
46
48
|
body["model"] = options.model;
|
|
47
49
|
body["content"] = options.content;
|
|
48
|
-
body["resolution"] = options.resolution;
|
|
49
50
|
body["duration"] = options.duration;
|
|
51
|
+
body["resolution"] = options.resolution;
|
|
50
52
|
if (options.ratio !== undefined) body["ratio"] = options.ratio;
|
|
51
53
|
for (const [key, value] of Object.entries(options)) {
|
|
52
54
|
if (!["async", "callbackUrl", "content", "duration", "maxWait", "model", "pollInterval", "ratio", "resolution", "wait"].includes(key) && value !== undefined) {
|
|
@@ -55,7 +55,7 @@ export class NanoBanana {
|
|
|
55
55
|
if (options.model !== undefined) body["model"] = options.model;
|
|
56
56
|
if (options.imageUrls !== undefined) body["image_urls"] = options.imageUrls;
|
|
57
57
|
if (options.resolution !== undefined) body["resolution"] = options.resolution;
|
|
58
|
-
body["aspect_ratio"] = options.aspectRatio
|
|
58
|
+
if (options.aspectRatio !== undefined) body["aspect_ratio"] = options.aspectRatio;
|
|
59
59
|
for (const [key, value] of Object.entries(options)) {
|
|
60
60
|
if (!["action", "aspectRatio", "async", "callbackUrl", "count", "imageUrls", "maxWait", "model", "pollInterval", "prompt", "resolution", "wait"].includes(key) && value !== undefined) {
|
|
61
61
|
body[key] = value;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QwenImage (qwen-image) — generated from the platform OpenAPI spec.
|
|
3
|
+
*
|
|
4
|
+
* Do not edit by hand: run `python scripts/generate_providers.py`. Parameter
|
|
5
|
+
* names, types, enums and required-ness all come from the live spec.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Transport } from '../../runtime/transport';
|
|
9
|
+
import { TaskHandle } from '../../runtime/tasks';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function taskId(result: Record<string, unknown>): string {
|
|
13
|
+
if (typeof result?.task_id === 'string') return result.task_id;
|
|
14
|
+
const data = result?.data as Record<string, unknown> | undefined;
|
|
15
|
+
if (data && typeof data.task_id === 'string') return data.task_id;
|
|
16
|
+
return typeof result?.id === 'string' ? result.id : '';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface QwenImageGenerateOptions {
|
|
20
|
+
/** $t(qwen_image_images_model) */
|
|
21
|
+
model: "qwen-image-3.0" | "qwen-image-3.0-pro";
|
|
22
|
+
/** $t(qwen_image_images_prompt) */
|
|
23
|
+
prompt: string;
|
|
24
|
+
/** $t(qwen_image_images_image_urls) */
|
|
25
|
+
imageUrls?: string[];
|
|
26
|
+
/** $t(qwen_image_images_n) */
|
|
27
|
+
n?: number;
|
|
28
|
+
/** $t(qwen_image_images_size) */
|
|
29
|
+
size?: string;
|
|
30
|
+
/** $t(qwen_image_images_prompt_extend) */
|
|
31
|
+
promptExtend?: boolean;
|
|
32
|
+
/** $t(qwen_image_images_prompt_extend_mode) */
|
|
33
|
+
promptExtendMode?: "direct" | "agent";
|
|
34
|
+
/** $t(qwen_image_images_enable_thinking) */
|
|
35
|
+
enableThinking?: boolean;
|
|
36
|
+
/** $t(qwen_image_images_negative_prompt) */
|
|
37
|
+
negativePrompt?: string;
|
|
38
|
+
/** $t(qwen_image_images_seed) */
|
|
39
|
+
seed?: number;
|
|
40
|
+
/** $t(qwen_image_images_watermark) */
|
|
41
|
+
watermark?: boolean;
|
|
42
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
43
|
+
async?: boolean;
|
|
44
|
+
/** Wait for completion before returning the handle. */
|
|
45
|
+
wait?: boolean;
|
|
46
|
+
pollInterval?: number;
|
|
47
|
+
maxWait?: number;
|
|
48
|
+
callbackUrl?: string;
|
|
49
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** qwen-image client. */
|
|
54
|
+
export class QwenImage {
|
|
55
|
+
constructor(private transport: Transport) {}
|
|
56
|
+
|
|
57
|
+
/** Call /qwen-image/images. */
|
|
58
|
+
async generate(options: QwenImageGenerateOptions): Promise<TaskHandle> {
|
|
59
|
+
const body: Record<string, unknown> = {};
|
|
60
|
+
body["model"] = options.model;
|
|
61
|
+
body["prompt"] = options.prompt;
|
|
62
|
+
if (options.imageUrls !== undefined) body["image_urls"] = options.imageUrls;
|
|
63
|
+
body["n"] = options.n ?? 1;
|
|
64
|
+
if (options.size !== undefined) body["size"] = options.size;
|
|
65
|
+
body["prompt_extend"] = options.promptExtend ?? true;
|
|
66
|
+
body["prompt_extend_mode"] = options.promptExtendMode ?? "direct";
|
|
67
|
+
body["enable_thinking"] = options.enableThinking ?? true;
|
|
68
|
+
if (options.negativePrompt !== undefined) body["negative_prompt"] = options.negativePrompt;
|
|
69
|
+
if (options.seed !== undefined) body["seed"] = options.seed;
|
|
70
|
+
body["watermark"] = options.watermark ?? false;
|
|
71
|
+
for (const [key, value] of Object.entries(options)) {
|
|
72
|
+
if (!["async", "callbackUrl", "enableThinking", "imageUrls", "maxWait", "model", "n", "negativePrompt", "pollInterval", "prompt", "promptExtend", "promptExtendMode", "seed", "size", "wait", "watermark"].includes(key) && value !== undefined) {
|
|
73
|
+
body[key] = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
77
|
+
body.async = options.async ?? true;
|
|
78
|
+
const result = (await this.transport.request('POST', "/qwen-image/images", { json: body })) as Record<string, unknown>;
|
|
79
|
+
const handle = new TaskHandle(taskId(result), "/qwen-image/tasks", this.transport, result);
|
|
80
|
+
if (options.wait) {
|
|
81
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
82
|
+
}
|
|
83
|
+
return handle;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
@@ -20,7 +20,7 @@ export interface SeedanceGenerateOptions {
|
|
|
20
20
|
/** $t(seedance_videos_model) */
|
|
21
21
|
model: "doubao-seedance-1-0-pro-250528" | "doubao-seedance-1-0-pro-fast-251015" | "doubao-seedance-1-5-pro-251215" | "doubao-seedance-1-0-lite-t2v-250428" | "doubao-seedance-1-0-lite-i2v-250428" | "doubao-seedance-2-0-260128" | "doubao-seedance-2-0-fast-260128" | "doubao-seedance-2-0-mini-260615" | "doubao-seedance-2-5-260628";
|
|
22
22
|
/** $t(seedance_videos) */
|
|
23
|
-
content: unknown
|
|
23
|
+
content: Array<Record<string, unknown>>;
|
|
24
24
|
/** $t(seedance_videos_resolution) */
|
|
25
25
|
resolution?: "480p" | "720p" | "1080p" | "4k";
|
|
26
26
|
/** $t(seedance_videos_ratio) */
|
|
@@ -28,7 +28,7 @@ export interface SeedreamGenerateOptions {
|
|
|
28
28
|
/** Reference image links for image editing are required, supporting accessible http/https URLs, or base64 encoded image strings in the format `data:image/png;base64,iVBORw0KG...`. Each image must not exceed 10MB in size. This parameter is mandatory when using image-to-image models (such as `doubao-seededit-3.0-i2i`). */
|
|
29
29
|
image?: string[];
|
|
30
30
|
/** List of tools that can be called by the model. Currently, only `web_search` is supported. Applicable only to `doubao-seedream-5.0-lite`. */
|
|
31
|
-
tools?: unknown
|
|
31
|
+
tools?: Array<Record<string, unknown>>;
|
|
32
32
|
/** Whether to return all images in a streaming manner, default is `false`. Only supports `doubao-seedream-5.0-lite`, `doubao-seedream-4.5`, and `doubao-seedream-4.0`. */
|
|
33
33
|
stream?: boolean;
|
|
34
34
|
/** Whether to add AI-generated watermark, default is `true`. */
|
|
@@ -222,16 +222,16 @@ export class Suno {
|
|
|
222
222
|
async generate(options: SunoGenerateOptions = {}): Promise<TaskHandle> {
|
|
223
223
|
const body: Record<string, unknown> = {};
|
|
224
224
|
if (options.lyric !== undefined) body["lyric"] = options.lyric;
|
|
225
|
-
body["model"] = options.model
|
|
225
|
+
if (options.model !== undefined) body["model"] = options.model;
|
|
226
226
|
if (options.style !== undefined) body["style"] = options.style;
|
|
227
227
|
if (options.title !== undefined) body["title"] = options.title;
|
|
228
|
-
body["action"] = options.action
|
|
228
|
+
if (options.action !== undefined) body["action"] = options.action;
|
|
229
229
|
if (options.custom !== undefined) body["custom"] = options.custom;
|
|
230
|
-
body["prompt"] = options.prompt
|
|
230
|
+
if (options.prompt !== undefined) body["prompt"] = options.prompt;
|
|
231
231
|
if (options.audioId !== undefined) body["audio_id"] = options.audioId;
|
|
232
232
|
if (options.duration !== undefined) body["duration"] = options.duration;
|
|
233
233
|
if (options.weirdness !== undefined) body["weirdness"] = options.weirdness;
|
|
234
|
-
body["audio_urls"] = options.audioUrls
|
|
234
|
+
if (options.audioUrls !== undefined) body["audio_urls"] = options.audioUrls;
|
|
235
235
|
if (options.personaId !== undefined) body["persona_id"] = options.personaId;
|
|
236
236
|
if (options.continueAt !== undefined) body["continue_at"] = options.continueAt;
|
|
237
237
|
if (options.samplesEnd !== undefined) body["samples_end"] = options.samplesEnd;
|
|
@@ -251,7 +251,7 @@ export class Suno {
|
|
|
251
251
|
if (options.underpaintingStart !== undefined) body["underpainting_start"] = options.underpaintingStart;
|
|
252
252
|
if (options.replaceSectionStart !== undefined) body["replace_section_start"] = options.replaceSectionStart;
|
|
253
253
|
for (const [key, value] of Object.entries(options)) {
|
|
254
|
-
if (!["action", "async", "audioId", "audioUrls", "audioWeight", "callbackUrl", "continueAt", "custom", "duration", "instrumental", "lyric", "lyricPrompt", "mashupAudioIds", "maxWait", "model", "overpaintingEnd", "overpaintingStart", "personaId", "pollInterval", "prompt", "replaceSectionEnd", "replaceSectionStart", "samplesEnd", "samplesStart", "style", "styleInfluence", "
|
|
254
|
+
if (!["action", "async", "audioId", "audioUrls", "audioWeight", "callbackUrl", "continueAt", "custom", "duration", "instrumental", "lyric", "lyricPrompt", "mashupAudioIds", "maxWait", "model", "negativeTags", "overpaintingEnd", "overpaintingStart", "personaId", "pollInterval", "prompt", "replaceSectionEnd", "replaceSectionStart", "samplesEnd", "samplesStart", "style", "styleInfluence", "title", "underpaintingEnd", "underpaintingStart", "variationCategory", "vocalGender", "wait", "weirdness"].includes(key) && value !== undefined) {
|
|
255
255
|
body[key] = value;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -17,32 +17,40 @@ function taskId(result: Record<string, unknown>): string {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface WanGenerateOptions {
|
|
20
|
-
/**
|
|
21
|
-
model: "wan2.6-i2v" | "wan2.6-r2v" | "wan2.6-i2v-flash" | "wan2.6-t2v";
|
|
22
|
-
/**
|
|
23
|
-
action: "text2video" | "image2video";
|
|
24
|
-
/** Prompts for generating videos. */
|
|
25
|
-
prompt: string;
|
|
26
|
-
/** Video size specifications. */
|
|
27
|
-
size?: string;
|
|
28
|
-
/** Specify whether the generated video contains sound. */
|
|
20
|
+
/** $t(wan_videos_model) */
|
|
21
|
+
model: "wan2.6-i2v" | "wan2.6-r2v" | "wan2.6-i2v-flash" | "wan2.6-t2v" | "wan3.0-video";
|
|
22
|
+
/** $t(wan_videos_audio) */
|
|
29
23
|
audio?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
duration?: number;
|
|
32
|
-
/** The URL of the audio file, the model will generate the corresponding video based on that audio. */
|
|
33
|
-
audioUrl?: string;
|
|
34
|
-
/** The URL of the starting frame image, which will serve as the first frame of the generated video. */
|
|
35
|
-
imageUrl?: string;
|
|
36
|
-
/** Specify the type of shots for the video, that is, whether the video consists of a single continuous shot (`single`) or multiple switching shots (`multi`). */
|
|
37
|
-
shotType?: "single" | "multi";
|
|
38
|
-
/** Specify the resolution level for generating the video, used to adjust the video clarity (total pixel count). The model will automatically scale to a similar total pixel count based on the selected resolution level, and the aspect ratio of the generated video will strive to remain consistent with the aspect ratio of the input image `image_url`. */
|
|
39
|
-
resolution?: "480P" | "720P" | "1080P";
|
|
40
|
-
/** Whether to enable intelligent rewriting of prompts. Once enabled, a large model will be used to intelligently expand the input prompts, which can significantly improve the generation effect of shorter prompts, but will increase processing time. */
|
|
24
|
+
/** $t(wan_videos_prompt_extend) */
|
|
41
25
|
promptExtend?: boolean;
|
|
42
|
-
/**
|
|
26
|
+
/** $t(wan_videos_action) */
|
|
27
|
+
action?: "text2video" | "image2video";
|
|
28
|
+
/** $t(wan_videos_resolution) */
|
|
29
|
+
resolution?: "480P" | "720P" | "1080P";
|
|
30
|
+
/** $t(wan_videos_shot_type) */
|
|
31
|
+
shotType?: "single" | "multi";
|
|
32
|
+
/** $t(wan_videos_duration) */
|
|
33
|
+
duration?: number;
|
|
34
|
+
/** $t(wan_videos_prompt) */
|
|
35
|
+
prompt?: string;
|
|
36
|
+
/** $t(wan_videos_negative_prompt) */
|
|
43
37
|
negativePrompt?: string;
|
|
44
|
-
/**
|
|
38
|
+
/** $t(wan_videos_size) */
|
|
39
|
+
size?: string;
|
|
40
|
+
/** $t(wan_videos_audio_url) */
|
|
41
|
+
audioUrl?: string;
|
|
42
|
+
/** $t(wan_videos_reference_video_urls) */
|
|
45
43
|
referenceVideoUrls?: string[];
|
|
44
|
+
/** $t(wan_videos_image_url) */
|
|
45
|
+
imageUrl?: string;
|
|
46
|
+
/** $t(wan_videos_media) */
|
|
47
|
+
media?: Array<Record<string, unknown>>;
|
|
48
|
+
/** $t(wan_videos_ratio) */
|
|
49
|
+
ratio?: "adaptive" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16";
|
|
50
|
+
/** $t(wan_videos_seed) */
|
|
51
|
+
seed?: number;
|
|
52
|
+
/** $t(wan_videos_watermark) */
|
|
53
|
+
watermark?: boolean;
|
|
46
54
|
/** Submit asynchronously and poll. Defaults to true. */
|
|
47
55
|
async?: boolean;
|
|
48
56
|
/** Wait for completion before returning the handle. */
|
|
@@ -62,20 +70,24 @@ export class Wan {
|
|
|
62
70
|
async generate(options: WanGenerateOptions): Promise<TaskHandle> {
|
|
63
71
|
const body: Record<string, unknown> = {};
|
|
64
72
|
body["model"] = options.model;
|
|
65
|
-
body["action"] = options.action;
|
|
66
|
-
body["prompt"] = options.prompt;
|
|
67
|
-
if (options.size !== undefined) body["size"] = options.size;
|
|
68
73
|
body["audio"] = options.audio ?? false;
|
|
74
|
+
body["prompt_extend"] = options.promptExtend ?? false;
|
|
75
|
+
body["action"] = options.action ?? "text2video";
|
|
76
|
+
if (options.resolution !== undefined) body["resolution"] = options.resolution;
|
|
77
|
+
if (options.shotType !== undefined) body["shot_type"] = options.shotType;
|
|
69
78
|
if (options.duration !== undefined) body["duration"] = options.duration;
|
|
79
|
+
if (options.prompt !== undefined) body["prompt"] = options.prompt;
|
|
80
|
+
if (options.negativePrompt !== undefined) body["negative_prompt"] = options.negativePrompt;
|
|
81
|
+
if (options.size !== undefined) body["size"] = options.size;
|
|
70
82
|
if (options.audioUrl !== undefined) body["audio_url"] = options.audioUrl;
|
|
71
|
-
body["image_url"] = options.imageUrl ?? "https://cdn.acedata.cloud/r9vsv9.png";
|
|
72
|
-
if (options.shotType !== undefined) body["shot_type"] = options.shotType;
|
|
73
|
-
if (options.resolution !== undefined) body["resolution"] = options.resolution;
|
|
74
|
-
body["prompt_extend"] = options.promptExtend ?? false;
|
|
75
|
-
body["negative_prompt"] = options.negativePrompt ?? "Astronauts shuttle from space to volcano";
|
|
76
83
|
if (options.referenceVideoUrls !== undefined) body["reference_video_urls"] = options.referenceVideoUrls;
|
|
84
|
+
if (options.imageUrl !== undefined) body["image_url"] = options.imageUrl;
|
|
85
|
+
if (options.media !== undefined) body["media"] = options.media;
|
|
86
|
+
if (options.ratio !== undefined) body["ratio"] = options.ratio;
|
|
87
|
+
if (options.seed !== undefined) body["seed"] = options.seed;
|
|
88
|
+
body["watermark"] = options.watermark ?? false;
|
|
77
89
|
for (const [key, value] of Object.entries(options)) {
|
|
78
|
-
if (!["action", "async", "audio", "audioUrl", "callbackUrl", "duration", "imageUrl", "maxWait", "model", "negativePrompt", "pollInterval", "prompt", "promptExtend", "referenceVideoUrls", "resolution", "shotType", "size", "wait"].includes(key) && value !== undefined) {
|
|
90
|
+
if (!["action", "async", "audio", "audioUrl", "callbackUrl", "duration", "imageUrl", "maxWait", "media", "model", "negativePrompt", "pollInterval", "prompt", "promptExtend", "ratio", "referenceVideoUrls", "resolution", "seed", "shotType", "size", "wait", "watermark"].includes(key) && value !== undefined) {
|
|
79
91
|
body[key] = value;
|
|
80
92
|
}
|
|
81
93
|
}
|