@acedatacloud/sdk 2026.722.0 → 2026.727.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.d.mts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +998 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +998 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +3 -0
- package/src/resources/providers/digitalhuman.ts +123 -0
- package/src/resources/providers/dreamina.ts +68 -0
- package/src/resources/providers/fish.ts +146 -0
- package/src/resources/providers/flux.ts +71 -0
- package/src/resources/providers/hailuo.ts +65 -0
- package/src/resources/providers/happyhorse.ts +89 -0
- package/src/resources/providers/index.ts +53 -0
- package/src/resources/providers/localization.ts +45 -0
- package/src/resources/providers/luma.ts +83 -0
- package/src/resources/providers/maestro.ts +84 -0
- package/src/resources/providers/nano-banana.ts +74 -0
- package/src/resources/providers/producer.ts +182 -0
- package/src/resources/providers/seedance.ts +89 -0
- package/src/resources/providers/seedream.ts +95 -0
- package/src/resources/providers/suno.ts +437 -0
- package/src/resources/providers/wan.ts +92 -0
- package/src/runtime/tasks.ts +165 -11
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seedream (seedream) — 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 SeedreamGenerateOptions {
|
|
20
|
+
/** Models used for generating images. If not specified, the default is `doubao-seedream-5.0-lite`. `doubao-seedream-5.0-pro` is the latest flagship single image model (only generates single images, does not support group images, streaming, or online search). */
|
|
21
|
+
model: "doubao-seedream-5-0-pro-260628" | "doubao-seedream-5-0-260128" | "doubao-seedream-4-0-250828" | "doubao-seedream-4-5-251128" | "doubao-seedream-3-0-t2i-250415" | "doubao-seededit-3-0-i2i-250628";
|
|
22
|
+
/** Prompts for generating images. */
|
|
23
|
+
prompt: string;
|
|
24
|
+
/** Generate a random seed for image generation. The supported range is [-1, 2147483647], with a default value of `-1`. **Only `doubao-seedream-3.0-t2i` supports this parameter** (according to the official Volcengine documentation), other models do not accept this parameter. */
|
|
25
|
+
seed?: number;
|
|
26
|
+
/** Generate image dimensions or aspect ratios. Supports preset options (`1K`/`2K`/`3K`/`4K`), `adaptive` (adaptive reference image size), or explicit `<width>x<height>` format (e.g., `1024x1024`). **Different models support different preset options**: `doubao-seedream-5.0-pro` supports `1K`/`2K`; `doubao-seedream-5.0-lite` supports `2K`/`3K`/`4K`; `doubao-seedream-4.5` only supports `2K`/`4K`; `doubao-seedream-4.0` supports `1K`/`2K`/`4K`; `doubao-seedream-3.0-t2i` and `doubao-seedream-3.0-i2i` **do not support** any preset options and must receive explicit `<width>x<height>` values. */
|
|
27
|
+
size?: "1K" | "2K" | "3K" | "4K" | "adaptive";
|
|
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
|
+
image?: string[];
|
|
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[];
|
|
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
|
+
stream?: boolean;
|
|
34
|
+
/** Whether to add AI-generated watermark, default is `true`. */
|
|
35
|
+
watermark?: boolean;
|
|
36
|
+
/** The output image file format is `jpeg` by default. Only `doubao-seedream-5.0-pro` and `doubao-seedream-5.0-lite` are supported. */
|
|
37
|
+
outputFormat?: "jpeg" | "png";
|
|
38
|
+
/** Prompt word weight, the larger the value, the more relevant the generated result is to the prompt word. Only supports `doubao-seedream-3.0-t2i` (default value 2.5) and `doubao-seededit-3.0-i2i` (default value 5.5), both ranges are [1, 10]. */
|
|
39
|
+
guidanceScale?: unknown;
|
|
40
|
+
/** The response format defaults to `url`, and also supports `b64_json`. */
|
|
41
|
+
responseFormat?: string;
|
|
42
|
+
/** Optional prompt word optimization configuration. Only supports `doubao-seedream-5.0-lite`, `doubao-seedream-4.5` (only in `standard` mode), and `doubao-seedream-4.0`. */
|
|
43
|
+
optimizePromptOptions?: Record<string, unknown>;
|
|
44
|
+
/** The default value is `disabled`. Setting it to `auto` allows the model to generate a set of stylistically coherent related images (multi-image consistency, sharing characters, styles, and details across frames). Only `doubao-seedream-5.0-lite`, `doubao-seedream-4.5`, and `doubao-seedream-4.0` are supported. */
|
|
45
|
+
sequentialImageGeneration?: "auto" | "disabled";
|
|
46
|
+
/** Adjustable parameters for batch image generation. Effective only when `sequential_image_generation=auto`. Only supports `doubao-seedream-5.0-lite`, `doubao-seedream-4.5`, and `doubao-seedream-4.0`. */
|
|
47
|
+
sequentialImageGenerationOptions?: Record<string, unknown>;
|
|
48
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
49
|
+
async?: boolean;
|
|
50
|
+
/** Wait for completion before returning the handle. */
|
|
51
|
+
wait?: boolean;
|
|
52
|
+
pollInterval?: number;
|
|
53
|
+
maxWait?: number;
|
|
54
|
+
callbackUrl?: string;
|
|
55
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** seedream client. */
|
|
60
|
+
export class Seedream {
|
|
61
|
+
constructor(private transport: Transport) {}
|
|
62
|
+
|
|
63
|
+
/** ByteDance Seedream high-quality image generation and editing API. Supports text-to-image models doubao-seedream-3-0-t2i-250415, doubao-seedream-4-0-250828, doubao-seedream-4-5-251128, doubao-seedream- */
|
|
64
|
+
async generate(options: SeedreamGenerateOptions): Promise<TaskHandle> {
|
|
65
|
+
const body: Record<string, unknown> = {};
|
|
66
|
+
body["model"] = options.model;
|
|
67
|
+
body["prompt"] = options.prompt;
|
|
68
|
+
if (options.seed !== undefined) body["seed"] = options.seed;
|
|
69
|
+
body["size"] = options.size ?? "2K";
|
|
70
|
+
if (options.image !== undefined) body["image"] = options.image;
|
|
71
|
+
if (options.tools !== undefined) body["tools"] = options.tools;
|
|
72
|
+
if (options.stream !== undefined) body["stream"] = options.stream;
|
|
73
|
+
if (options.watermark !== undefined) body["watermark"] = options.watermark;
|
|
74
|
+
if (options.outputFormat !== undefined) body["output_format"] = options.outputFormat;
|
|
75
|
+
if (options.guidanceScale !== undefined) body["guidance_scale"] = options.guidanceScale;
|
|
76
|
+
if (options.responseFormat !== undefined) body["response_format"] = options.responseFormat;
|
|
77
|
+
if (options.optimizePromptOptions !== undefined) body["optimize_prompt_options"] = options.optimizePromptOptions;
|
|
78
|
+
if (options.sequentialImageGeneration !== undefined) body["sequential_image_generation"] = options.sequentialImageGeneration;
|
|
79
|
+
if (options.sequentialImageGenerationOptions !== undefined) body["sequential_image_generation_options"] = options.sequentialImageGenerationOptions;
|
|
80
|
+
for (const [key, value] of Object.entries(options)) {
|
|
81
|
+
if (!["async", "callbackUrl", "guidanceScale", "image", "maxWait", "model", "optimizePromptOptions", "outputFormat", "pollInterval", "prompt", "responseFormat", "seed", "sequentialImageGeneration", "sequentialImageGenerationOptions", "size", "stream", "tools", "wait", "watermark"].includes(key) && value !== undefined) {
|
|
82
|
+
body[key] = value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
86
|
+
body.async = options.async ?? true;
|
|
87
|
+
const result = (await this.transport.request('POST', "/seedream/images", { json: body })) as Record<string, unknown>;
|
|
88
|
+
const handle = new TaskHandle(taskId(result), "/seedream/tasks", this.transport, result);
|
|
89
|
+
if (options.wait) {
|
|
90
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
91
|
+
}
|
|
92
|
+
return handle;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
}
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suno (suno) — 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 SunoGenerateOptions {
|
|
20
|
+
/** Lyrics for generating music under custom mode (`custom` is `true`). `chirp-v3-5` and `chirp-v4` have a maximum of 3000 characters; `chirp-v4-5` and above (including `chirp-v5`, `chirp-v5-5`) have a maximum of 5000 characters. */
|
|
21
|
+
lyric?: string;
|
|
22
|
+
/** The model used for generating music has a default value of `chirp-v4`. */
|
|
23
|
+
model?: "chirp-v5-5" | "chirp-v5" | "chirp-v4-5-plus" | "chirp-v4-5" | "chirp-v4" | "chirp-v3-5" | "chirp-v3-0";
|
|
24
|
+
/** Music style description. `chirp-v3-5` and `chirp-v4` up to 200 characters; `chirp-v4-5` and above (including `chirp-v5`, `chirp-v5-5`) up to 1000 characters. */
|
|
25
|
+
style?: string;
|
|
26
|
+
/** Music Title (Custom Mode). `chirp-v3-5` and `chirp-v4` up to 80 characters; `chirp-v4-5` and above (including `chirp-v5`, `chirp-v5-5`) up to 100 characters. */
|
|
27
|
+
title?: string;
|
|
28
|
+
/** Types of operations for generating music. `generate`: Generate audio based on prompts; `extend`: Continue generating based on existing audio; `concat`: Stitch existing audio clips into a complete track; `cover`: Copy the musical style of an existing track and reinterpret it; `upload_cover`: Style cover of uploaded audio; `upload_extend`: Extend and continue generating uploaded audio; `artist_consistency`: Sing new songs in the style of a specified artist (Persona); `artist_consistency_vox`: Sing new songs in the style of a specified artist using VOX mode; `stems`: Separate the song into vocal and accompaniment tracks; `all_stems`: Separate the song into all independent tracks (vocals, drums, bass, other instruments); `replace_section`: Replace segments within a specified time period; `underpainting`: Generate and add AI accompaniment to the uploaded vocal track; `overpainting`: Generate and add AI vocals to the uploaded accompaniment track; `samples`: Add AI samples to the uploaded audio within a specified time period; `remaster`: Remaster existing audio to enhance sound quality; `mashup`: Mix and stitch multiple songs into one track; `inspo`: Generate new music inspired by 1 to 4 reference audio segments. */
|
|
29
|
+
action?: "generate" | "extend" | "upload_extend" | "upload_cover" | "concat" | "cover" | "artist_consistency" | "artist_consistency_vox" | "stems" | "all_stems" | "replace_section" | "underpainting" | "overpainting" | "remaster" | "mashup" | "samples" | "inspo";
|
|
30
|
+
/** Whether to enable the custom mode flag. If `true`, the audio will be generated based on the lyrics; otherwise, it will be generated based on the prompts. */
|
|
31
|
+
custom?: boolean;
|
|
32
|
+
/** The prompt words for generating music in inspiration mode (when `custom` is set to `false`) must not exceed 500 characters. For custom mode, please use `lyric` and `style`. */
|
|
33
|
+
prompt?: Record<string, unknown>;
|
|
34
|
+
/** Audio ID used for generating additional audio based on existing audio. This field is required when `action` is `extend` or `concat`. */
|
|
35
|
+
audioId?: string;
|
|
36
|
+
/** The "Weirdness" advanced parameter in the Suno official custom mode has a value range of 0 to 1, with higher values resulting in more creative and experimental outputs. It is only effective in custom mode. */
|
|
37
|
+
weirdness?: number;
|
|
38
|
+
/** A list of reference audio URLs for inspiration, requiring 1 to 4 publicly accessible audio addresses. This field is mandatory when `action` is `inspo`. */
|
|
39
|
+
audioUrls?: string[];
|
|
40
|
+
/** Generate the singer Persona ID used when creating songs based on the unique style characteristics of the specified singer. */
|
|
41
|
+
personaId?: string;
|
|
42
|
+
/** Continue generating from the specified time point (seconds) of the existing audio. For example, 213.5 means to continue from 3 minutes and 33.5 seconds. */
|
|
43
|
+
continueAt?: number;
|
|
44
|
+
/** Add the end time of the sample for the uploaded audio, which must be less than the total duration of the song. */
|
|
45
|
+
samplesEnd?: number;
|
|
46
|
+
/** The weight of the uploaded reference audio, with a value range from 0 to 1, where a higher value indicates greater reliance on the reference audio. This only takes effect during the cover operation. */
|
|
47
|
+
audioWeight?: number;
|
|
48
|
+
/** Pure accompaniment mode (no lyrics), default is `false`. When set to `true`, the lyrics filled in above will be ignored. */
|
|
49
|
+
instrumental?: boolean;
|
|
50
|
+
/** Prompts for automatically generating lyrics, effective only when `custom` is `true` and `lyric` is empty. */
|
|
51
|
+
lyricPrompt?: Record<string, unknown>;
|
|
52
|
+
/** Voice gender preference, selectable values are `'m'` (male voice) or `'f'` (female voice). Models `chirp-v4-5` and above are effective; this parameter is a preference item that can increase the probability of the target gender, but it does not guarantee strict adherence. */
|
|
53
|
+
vocalGender?: string;
|
|
54
|
+
/** Add a default start time for the uploaded audio sample, with a default value of 0. */
|
|
55
|
+
samplesStart?: number;
|
|
56
|
+
/** Styles of description that are not desired in music generation. */
|
|
57
|
+
styleNegative?: string;
|
|
58
|
+
/** The "Style Influence" advanced parameter in the Suno official custom mode has a value range of 0 to 1, with higher values being closer to the selected style. It is only effective in custom mode. */
|
|
59
|
+
styleInfluence?: number;
|
|
60
|
+
/** Audio ID list for mixing and mashup. This field is required when `action` is `mashup`. */
|
|
61
|
+
mashupAudioIds?: string[];
|
|
62
|
+
/** Add the end time of the AI voice to the uploaded audio, which must be less than the total duration of the song. */
|
|
63
|
+
overpaintingEnd?: number;
|
|
64
|
+
/** Add the end time for the AI accompaniment to the uploaded audio, which must be less than the total duration of the song. */
|
|
65
|
+
underpaintingEnd?: number;
|
|
66
|
+
/** Set the default start time for the AI voice of the uploaded audio to 0. */
|
|
67
|
+
overpaintingStart?: number;
|
|
68
|
+
/** `variation_category` only supports version v5 and above, with only three optional values: `high`, `normal`, `subtle`. */
|
|
69
|
+
variationCategory?: string;
|
|
70
|
+
/** When `action` is `replace_section`, specify the end time (in seconds) of the segment to be replaced. */
|
|
71
|
+
replaceSectionEnd?: number;
|
|
72
|
+
/** Set the default start time for the AI accompaniment added to the uploaded audio, with a default value of 0. */
|
|
73
|
+
underpaintingStart?: number;
|
|
74
|
+
/** When `action` is `replace_section`, specify the start time (in seconds) of the segment to be replaced. */
|
|
75
|
+
replaceSectionStart?: number;
|
|
76
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
77
|
+
async?: boolean;
|
|
78
|
+
/** Wait for completion before returning the handle. */
|
|
79
|
+
wait?: boolean;
|
|
80
|
+
pollInterval?: number;
|
|
81
|
+
maxWait?: number;
|
|
82
|
+
callbackUrl?: string;
|
|
83
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface SunoPersonaOptions {
|
|
88
|
+
/** Names of singer styles. */
|
|
89
|
+
name: string;
|
|
90
|
+
/** Used to create generated song IDs in the style of the singer. */
|
|
91
|
+
audioId: string;
|
|
92
|
+
/** The end time of the vocal segment in the audio (seconds). */
|
|
93
|
+
vocalEnd?: number;
|
|
94
|
+
/** A textual description of the singer's style. */
|
|
95
|
+
description?: string;
|
|
96
|
+
/** The starting time (in seconds) of the vocal segment in the audio. */
|
|
97
|
+
vocalStart?: number;
|
|
98
|
+
/** Used to generate audio IDs in the style of new singers (vocal reference audio). */
|
|
99
|
+
voxAudioId?: string;
|
|
100
|
+
callbackUrl?: string;
|
|
101
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface SunoMp4Options {
|
|
106
|
+
/** Used to obtain the song ID for the corresponding MP4 of the song. */
|
|
107
|
+
audioId: string;
|
|
108
|
+
callbackUrl?: string;
|
|
109
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
110
|
+
[key: string]: unknown;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface SunoVoicesOptions {
|
|
114
|
+
/** Publicly accessible URL for audio files used to create sound. Must be in MP3 or WAV format, at least 10 seconds long, and must contain clear human voice of a single speaker, without background noise or background music. */
|
|
115
|
+
audioUrl: string;
|
|
116
|
+
/** Custom voice personality name. */
|
|
117
|
+
name?: string;
|
|
118
|
+
/** Description information for custom voice personality. */
|
|
119
|
+
description?: string;
|
|
120
|
+
callbackUrl?: string;
|
|
121
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
122
|
+
[key: string]: unknown;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface SunoTimingOptions {
|
|
126
|
+
/** Need to obtain the audio ID for timing/caption data, which is the generated Suno song ID. */
|
|
127
|
+
audioId: string;
|
|
128
|
+
callbackUrl?: string;
|
|
129
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
130
|
+
[key: string]: unknown;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface SunoVoxOptions {
|
|
134
|
+
/** The source audio ID used to extract human voice, which is the unique identifier of the Suno audio segment to be processed. */
|
|
135
|
+
audioId: string;
|
|
136
|
+
/** End time point for vocal extraction (unit: seconds). */
|
|
137
|
+
vocalEnd?: number;
|
|
138
|
+
/** The starting time point for vocal extraction (unit: seconds). */
|
|
139
|
+
vocalStart?: number;
|
|
140
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
141
|
+
async?: boolean;
|
|
142
|
+
/** Wait for completion before returning the handle. */
|
|
143
|
+
wait?: boolean;
|
|
144
|
+
pollInterval?: number;
|
|
145
|
+
maxWait?: number;
|
|
146
|
+
callbackUrl?: string;
|
|
147
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
148
|
+
[key: string]: unknown;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface SunoWavOptions {
|
|
152
|
+
/** Used to obtain the existing audio ID of WAV format audio. */
|
|
153
|
+
audioId: string;
|
|
154
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
155
|
+
async?: boolean;
|
|
156
|
+
/** Wait for completion before returning the handle. */
|
|
157
|
+
wait?: boolean;
|
|
158
|
+
pollInterval?: number;
|
|
159
|
+
maxWait?: number;
|
|
160
|
+
callbackUrl?: string;
|
|
161
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
162
|
+
[key: string]: unknown;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface SunoMidiOptions {
|
|
166
|
+
/** The source audio ID for generating MIDI will extract MIDI content based on the existing audio. */
|
|
167
|
+
audioId: string;
|
|
168
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
169
|
+
async?: boolean;
|
|
170
|
+
/** Wait for completion before returning the handle. */
|
|
171
|
+
wait?: boolean;
|
|
172
|
+
pollInterval?: number;
|
|
173
|
+
maxWait?: number;
|
|
174
|
+
callbackUrl?: string;
|
|
175
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface SunoStyleOptions {
|
|
180
|
+
/** Style prompts that need optimization. */
|
|
181
|
+
prompt: string;
|
|
182
|
+
callbackUrl?: string;
|
|
183
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
184
|
+
[key: string]: unknown;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface SunoLyricsOptions {
|
|
188
|
+
/** The model used for generating lyrics has a default value of `default`, with optional values including `default` and `remi-v1`. */
|
|
189
|
+
model: "default" | "remi-v1";
|
|
190
|
+
/** Prompts for generating lyrics, describing the desired theme or style of the lyrics. */
|
|
191
|
+
prompt: Record<string, unknown>;
|
|
192
|
+
callbackUrl?: string;
|
|
193
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface SunoMashupLyricsOptions {
|
|
198
|
+
/** The first paragraph of lyrics content used for mixed generation. */
|
|
199
|
+
lyricsA: string;
|
|
200
|
+
/** The content of the second verse for mixed-generated lyrics. */
|
|
201
|
+
lyricsB: string;
|
|
202
|
+
callbackUrl?: string;
|
|
203
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
204
|
+
[key: string]: unknown;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface SunoUploadOptions {
|
|
208
|
+
/** The CDN address (URL) for the custom audio file to be uploaded. */
|
|
209
|
+
audioUrl: string;
|
|
210
|
+
callbackUrl?: string;
|
|
211
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
212
|
+
[key: string]: unknown;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** suno client. */
|
|
216
|
+
export class Suno {
|
|
217
|
+
constructor(private transport: Transport) {}
|
|
218
|
+
|
|
219
|
+
/** Suno AI music generation API, generates 2 songs per request with extension support. */
|
|
220
|
+
async generate(options: SunoGenerateOptions = {}): Promise<TaskHandle> {
|
|
221
|
+
const body: Record<string, unknown> = {};
|
|
222
|
+
if (options.lyric !== undefined) body["lyric"] = options.lyric;
|
|
223
|
+
body["model"] = options.model ?? "chirp-v5-5";
|
|
224
|
+
if (options.style !== undefined) body["style"] = options.style;
|
|
225
|
+
if (options.title !== undefined) body["title"] = options.title;
|
|
226
|
+
body["action"] = options.action ?? "generate";
|
|
227
|
+
if (options.custom !== undefined) body["custom"] = options.custom;
|
|
228
|
+
body["prompt"] = options.prompt ?? "A song for Christmas";
|
|
229
|
+
if (options.audioId !== undefined) body["audio_id"] = options.audioId;
|
|
230
|
+
if (options.weirdness !== undefined) body["weirdness"] = options.weirdness;
|
|
231
|
+
body["audio_urls"] = options.audioUrls ?? ["https://cdn1.suno.ai/b481b17a-bf50-4e10-8adc-4d5635050893.mp3"];
|
|
232
|
+
if (options.personaId !== undefined) body["persona_id"] = options.personaId;
|
|
233
|
+
if (options.continueAt !== undefined) body["continue_at"] = options.continueAt;
|
|
234
|
+
if (options.samplesEnd !== undefined) body["samples_end"] = options.samplesEnd;
|
|
235
|
+
if (options.audioWeight !== undefined) body["audio_weight"] = options.audioWeight;
|
|
236
|
+
if (options.instrumental !== undefined) body["instrumental"] = options.instrumental;
|
|
237
|
+
if (options.lyricPrompt !== undefined) body["lyric_prompt"] = options.lyricPrompt;
|
|
238
|
+
if (options.vocalGender !== undefined) body["vocal_gender"] = options.vocalGender;
|
|
239
|
+
if (options.samplesStart !== undefined) body["samples_start"] = options.samplesStart;
|
|
240
|
+
if (options.styleNegative !== undefined) body["style_negative"] = options.styleNegative;
|
|
241
|
+
if (options.styleInfluence !== undefined) body["style_influence"] = options.styleInfluence;
|
|
242
|
+
if (options.mashupAudioIds !== undefined) body["mashup_audio_ids"] = options.mashupAudioIds;
|
|
243
|
+
if (options.overpaintingEnd !== undefined) body["overpainting_end"] = options.overpaintingEnd;
|
|
244
|
+
if (options.underpaintingEnd !== undefined) body["underpainting_end"] = options.underpaintingEnd;
|
|
245
|
+
if (options.overpaintingStart !== undefined) body["overpainting_start"] = options.overpaintingStart;
|
|
246
|
+
if (options.variationCategory !== undefined) body["variation_category"] = options.variationCategory;
|
|
247
|
+
if (options.replaceSectionEnd !== undefined) body["replace_section_end"] = options.replaceSectionEnd;
|
|
248
|
+
if (options.underpaintingStart !== undefined) body["underpainting_start"] = options.underpaintingStart;
|
|
249
|
+
if (options.replaceSectionStart !== undefined) body["replace_section_start"] = options.replaceSectionStart;
|
|
250
|
+
for (const [key, value] of Object.entries(options)) {
|
|
251
|
+
if (!["action", "async", "audioId", "audioUrls", "audioWeight", "callbackUrl", "continueAt", "custom", "instrumental", "lyric", "lyricPrompt", "mashupAudioIds", "maxWait", "model", "overpaintingEnd", "overpaintingStart", "personaId", "pollInterval", "prompt", "replaceSectionEnd", "replaceSectionStart", "samplesEnd", "samplesStart", "style", "styleInfluence", "styleNegative", "title", "underpaintingEnd", "underpaintingStart", "variationCategory", "vocalGender", "wait", "weirdness"].includes(key) && value !== undefined) {
|
|
252
|
+
body[key] = value;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
256
|
+
body.async = options.async ?? true;
|
|
257
|
+
const result = (await this.transport.request('POST', "/suno/audios", { json: body })) as Record<string, unknown>;
|
|
258
|
+
const handle = new TaskHandle(taskId(result), "/suno/tasks", this.transport, result);
|
|
259
|
+
if (options.wait) {
|
|
260
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
261
|
+
}
|
|
262
|
+
return handle;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** Suno singer style API, set song style based on a generated song ID. */
|
|
266
|
+
async persona(options: SunoPersonaOptions): Promise<Record<string, unknown>> {
|
|
267
|
+
const body: Record<string, unknown> = {};
|
|
268
|
+
body["name"] = options.name;
|
|
269
|
+
body["audio_id"] = options.audioId;
|
|
270
|
+
if (options.vocalEnd !== undefined) body["vocal_end"] = options.vocalEnd;
|
|
271
|
+
if (options.description !== undefined) body["description"] = options.description;
|
|
272
|
+
if (options.vocalStart !== undefined) body["vocal_start"] = options.vocalStart;
|
|
273
|
+
if (options.voxAudioId !== undefined) body["vox_audio_id"] = options.voxAudioId;
|
|
274
|
+
for (const [key, value] of Object.entries(options)) {
|
|
275
|
+
if (!["async", "audioId", "callbackUrl", "description", "maxWait", "name", "pollInterval", "vocalEnd", "vocalStart", "voxAudioId", "wait"].includes(key) && value !== undefined) {
|
|
276
|
+
body[key] = value;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
280
|
+
return (await this.transport.request('POST', "/suno/persona", { json: body })) as Record<string, unknown>;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Suno MP4 API, get MP4 file link via audio_id. */
|
|
284
|
+
async mp4(options: SunoMp4Options): Promise<Record<string, unknown>> {
|
|
285
|
+
const body: Record<string, unknown> = {};
|
|
286
|
+
body["audio_id"] = options.audioId;
|
|
287
|
+
for (const [key, value] of Object.entries(options)) {
|
|
288
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
289
|
+
body[key] = value;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
293
|
+
return (await this.transport.request('POST', "/suno/mp4", { json: body })) as Record<string, unknown>;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** Suno Voice Clone API. Create a custom voice persona from an uploaded audio file for voice cloning in music generation. */
|
|
297
|
+
async voices(options: SunoVoicesOptions): Promise<Record<string, unknown>> {
|
|
298
|
+
const body: Record<string, unknown> = {};
|
|
299
|
+
body["audio_url"] = options.audioUrl;
|
|
300
|
+
if (options.name !== undefined) body["name"] = options.name;
|
|
301
|
+
if (options.description !== undefined) body["description"] = options.description;
|
|
302
|
+
for (const [key, value] of Object.entries(options)) {
|
|
303
|
+
if (!["async", "audioUrl", "callbackUrl", "description", "maxWait", "name", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
304
|
+
body[key] = value;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
308
|
+
return (await this.transport.request('POST', "/suno/voices", { json: body })) as Record<string, unknown>;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Suno timeline API, get lyrics and audio timeline of generated music. */
|
|
312
|
+
async timing(options: SunoTimingOptions): Promise<Record<string, unknown>> {
|
|
313
|
+
const body: Record<string, unknown> = {};
|
|
314
|
+
body["audio_id"] = options.audioId;
|
|
315
|
+
for (const [key, value] of Object.entries(options)) {
|
|
316
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
317
|
+
body[key] = value;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
321
|
+
return (await this.transport.request('POST', "/suno/timing", { json: body })) as Record<string, unknown>;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** Suno vocal/instrumental stems API. Pass an audio_id to asynchronously produce vocal-only and instrumental-only stem files for remixing and creative reuse. */
|
|
325
|
+
async vox(options: SunoVoxOptions): Promise<TaskHandle> {
|
|
326
|
+
const body: Record<string, unknown> = {};
|
|
327
|
+
body["audio_id"] = options.audioId;
|
|
328
|
+
if (options.vocalEnd !== undefined) body["vocal_end"] = options.vocalEnd;
|
|
329
|
+
if (options.vocalStart !== undefined) body["vocal_start"] = options.vocalStart;
|
|
330
|
+
for (const [key, value] of Object.entries(options)) {
|
|
331
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "vocalEnd", "vocalStart", "wait"].includes(key) && value !== undefined) {
|
|
332
|
+
body[key] = value;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
336
|
+
body.async = options.async ?? true;
|
|
337
|
+
const result = (await this.transport.request('POST', "/suno/vox", { json: body })) as Record<string, unknown>;
|
|
338
|
+
const handle = new TaskHandle(taskId(result), "/suno/tasks", this.transport, result);
|
|
339
|
+
if (options.wait) {
|
|
340
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
341
|
+
}
|
|
342
|
+
return handle;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** SUNO allows generating higher quality wav files based on the existing audio_id. */
|
|
346
|
+
async wav(options: SunoWavOptions): Promise<TaskHandle> {
|
|
347
|
+
const body: Record<string, unknown> = {};
|
|
348
|
+
body["audio_id"] = options.audioId;
|
|
349
|
+
for (const [key, value] of Object.entries(options)) {
|
|
350
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
351
|
+
body[key] = value;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
355
|
+
body.async = options.async ?? true;
|
|
356
|
+
const result = (await this.transport.request('POST', "/suno/wav", { json: body })) as Record<string, unknown>;
|
|
357
|
+
const handle = new TaskHandle(taskId(result), "/suno/tasks", this.transport, result);
|
|
358
|
+
if (options.wait) {
|
|
359
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
360
|
+
}
|
|
361
|
+
return handle;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** Suno MIDI API, retrieve MIDI data from generated music. */
|
|
365
|
+
async midi(options: SunoMidiOptions): Promise<TaskHandle> {
|
|
366
|
+
const body: Record<string, unknown> = {};
|
|
367
|
+
body["audio_id"] = options.audioId;
|
|
368
|
+
for (const [key, value] of Object.entries(options)) {
|
|
369
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
370
|
+
body[key] = value;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
374
|
+
body.async = options.async ?? true;
|
|
375
|
+
const result = (await this.transport.request('POST', "/suno/midi", { json: body })) as Record<string, unknown>;
|
|
376
|
+
const handle = new TaskHandle(taskId(result), "/suno/tasks", this.transport, result);
|
|
377
|
+
if (options.wait) {
|
|
378
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
379
|
+
}
|
|
380
|
+
return handle;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** SUNO allows us to input prompts to generate enhanced song styles. */
|
|
384
|
+
async style(options: SunoStyleOptions): Promise<Record<string, unknown>> {
|
|
385
|
+
const body: Record<string, unknown> = {};
|
|
386
|
+
body["prompt"] = options.prompt;
|
|
387
|
+
for (const [key, value] of Object.entries(options)) {
|
|
388
|
+
if (!["async", "callbackUrl", "maxWait", "pollInterval", "prompt", "wait"].includes(key) && value !== undefined) {
|
|
389
|
+
body[key] = value;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
393
|
+
return (await this.transport.request('POST', "/suno/style", { json: body })) as Record<string, unknown>;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** Suno lyrics generation API. Generates structured song lyrics from a prompt; supports the default and remi-v1 models. */
|
|
397
|
+
async lyrics(options: SunoLyricsOptions): Promise<Record<string, unknown>> {
|
|
398
|
+
const body: Record<string, unknown> = {};
|
|
399
|
+
body["model"] = options.model;
|
|
400
|
+
body["prompt"] = options.prompt;
|
|
401
|
+
for (const [key, value] of Object.entries(options)) {
|
|
402
|
+
if (!["async", "callbackUrl", "maxWait", "model", "pollInterval", "prompt", "wait"].includes(key) && value !== undefined) {
|
|
403
|
+
body[key] = value;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
407
|
+
return (await this.transport.request('POST', "/suno/lyrics", { json: body })) as Record<string, unknown>;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** Suno mashup lyrics API, merge two lyrics into a blended version. */
|
|
411
|
+
async mashup_lyrics(options: SunoMashupLyricsOptions): Promise<Record<string, unknown>> {
|
|
412
|
+
const body: Record<string, unknown> = {};
|
|
413
|
+
body["lyrics_a"] = options.lyricsA;
|
|
414
|
+
body["lyrics_b"] = options.lyricsB;
|
|
415
|
+
for (const [key, value] of Object.entries(options)) {
|
|
416
|
+
if (!["async", "callbackUrl", "lyricsA", "lyricsB", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
417
|
+
body[key] = value;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
421
|
+
return (await this.transport.request('POST', "/suno/mashup-lyrics", { json: body })) as Record<string, unknown>;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Suno reference audio upload API, upload audio to get an audio_id for extended generation. */
|
|
425
|
+
async upload(options: SunoUploadOptions): Promise<Record<string, unknown>> {
|
|
426
|
+
const body: Record<string, unknown> = {};
|
|
427
|
+
body["audio_url"] = options.audioUrl;
|
|
428
|
+
for (const [key, value] of Object.entries(options)) {
|
|
429
|
+
if (!["async", "audioUrl", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
430
|
+
body[key] = value;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
434
|
+
return (await this.transport.request('POST', "/suno/upload", { json: body })) as Record<string, unknown>;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wan (wan) — 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 WanGenerateOptions {
|
|
20
|
+
/** Models for generating videos include optional values such as `wan2.6-t2v` (text-to-video), `wan2.6-i2v` (image-to-video), `wan2.6-i2v-flash` (fast version of image-to-video), and `wan2.6-r2v` (reference video generation). */
|
|
21
|
+
model: "wan2.6-i2v" | "wan2.6-r2v" | "wan2.6-i2v-flash" | "wan2.6-t2v";
|
|
22
|
+
/** Operation types. `text2video` indicates text-to-video, and `image2video` indicates image-to-video. */
|
|
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. */
|
|
29
|
+
audio?: boolean;
|
|
30
|
+
/** Specify the duration of the video to be generated (in seconds), with optional values of `5`, `10`, or `15`. */
|
|
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. */
|
|
41
|
+
promptExtend?: boolean;
|
|
42
|
+
/** Reverse prompt words, used to describe content that is not desired to appear in the video footage, can be used to limit the video visuals. Supports both Chinese and English, with a length not exceeding 500 characters; any excess will be automatically truncated. */
|
|
43
|
+
negativePrompt?: string;
|
|
44
|
+
/** An array of URLs for reference video files, used to extract the character images (and vocal tones, if any) from the reference videos to generate videos that match the reference features. */
|
|
45
|
+
referenceVideoUrls?: string[];
|
|
46
|
+
/** Submit asynchronously and poll. Defaults to true. */
|
|
47
|
+
async?: boolean;
|
|
48
|
+
/** Wait for completion before returning the handle. */
|
|
49
|
+
wait?: boolean;
|
|
50
|
+
pollInterval?: number;
|
|
51
|
+
maxWait?: number;
|
|
52
|
+
callbackUrl?: string;
|
|
53
|
+
/** Any parameter added upstream before the SDK is regenerated. */
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** wan client. */
|
|
58
|
+
export class Wan {
|
|
59
|
+
constructor(private transport: Transport) {}
|
|
60
|
+
|
|
61
|
+
/** Generate videos based on prompt and image frames */
|
|
62
|
+
async generate(options: WanGenerateOptions): Promise<TaskHandle> {
|
|
63
|
+
const body: Record<string, unknown> = {};
|
|
64
|
+
body["model"] = options.model;
|
|
65
|
+
body["action"] = options.action;
|
|
66
|
+
body["prompt"] = options.prompt;
|
|
67
|
+
if (options.size !== undefined) body["size"] = options.size;
|
|
68
|
+
body["audio"] = options.audio ?? false;
|
|
69
|
+
if (options.duration !== undefined) body["duration"] = options.duration;
|
|
70
|
+
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
|
+
if (options.referenceVideoUrls !== undefined) body["reference_video_urls"] = options.referenceVideoUrls;
|
|
77
|
+
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) {
|
|
79
|
+
body[key] = value;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
83
|
+
body.async = options.async ?? true;
|
|
84
|
+
const result = (await this.transport.request('POST', "/wan/videos", { json: body })) as Record<string, unknown>;
|
|
85
|
+
const handle = new TaskHandle(taskId(result), "/wan/tasks", this.transport, result);
|
|
86
|
+
if (options.wait) {
|
|
87
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
88
|
+
}
|
|
89
|
+
return handle;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
}
|