@acedatacloud/sdk 2026.810.0 → 2026.811.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 +53 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/resources/providers/maestro.ts +43 -41
package/package.json
CHANGED
|
@@ -6,37 +6,45 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Transport } from '../../runtime/transport';
|
|
9
|
+
import { TaskHandle } from '../../runtime/tasks';
|
|
9
10
|
|
|
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
|
+
|
|
11
19
|
export interface MaestroGenerateOptions {
|
|
12
20
|
/** Natural-language brief describing the video to produce (the topic, what to show, tone, audience). The agent decides the script, visuals, voiceover and edit. */
|
|
13
21
|
prompt: string;
|
|
14
|
-
/**
|
|
22
|
+
/** Production action. Lite supports generate/edit; Standard adds remix; Pro adds extend. remix/edit/extend require `ref_task_id`. */
|
|
23
|
+
action?: "generate" | "remix" | "edit" | "extend";
|
|
24
|
+
/** Required when `action` is remix / edit / extend: the task_id of the previous video to start from. */
|
|
25
|
+
refTaskId?: string;
|
|
26
|
+
/** Optional reference media (image / video / audio URLs) the agent can use — e.g. a product shot or logo to feature, footage to caption. */
|
|
27
|
+
fileUrls?: string[];
|
|
28
|
+
/** Output languages. Lite supports 1, Standard up to 2, and Pro up to 4. The first is primary; each additional delivered language is billed +6 credits. */
|
|
15
29
|
langs?: string[];
|
|
30
|
+
/** Required output aspect ratio. Lite renders 720p/24fps; Standard and Pro render 1080p/30fps. */
|
|
31
|
+
aspect?: "9:16" | "16:9" | "1:1";
|
|
32
|
+
/** Target video length in seconds. Lite: 5–30; Standard: 5–120; Pro: 5–300. Successful jobs are billed by actual delivered duration, never above the requested duration. */
|
|
33
|
+
duration?: number;
|
|
34
|
+
/** Production SKU. `lite` = fast 720p short video at 0.20 credits/s (up to 30s); `standard` = balanced 1080p at 0.60 credits/s (up to 120s); `pro` = advanced production at 1.20 credits/s (up to 300s). Default: standard. */
|
|
35
|
+
quality?: "lite" | "standard" | "pro";
|
|
36
|
+
/** Production route. Lite supports auto/narrated/captions; Standard adds avatar; Pro adds drama. `captions` requires source video in `file_urls`; `avatar` requires a portrait. avatar bills at 1.15× and drama at 1.35×. */
|
|
37
|
+
scenario?: "auto" | "narrated" | "captions" | "avatar" | "drama";
|
|
16
38
|
/** Optional visual-style preset — expressed through typography, palette, motion, image treatment and pacing. Orthogonal to `scenario` (it does NOT change routing). `auto` (default) lets the director pick; every other value adopts a real named look: `cinematic` = dark film-noir (black + blood-red, Oswald); `glass` = Apple / iOS-26 frosted liquid glass; `luxury` = timeless near-black + indigo, huge whitespace; `swiss` = precise grid + electric blue + oversized numerals; `modern` = clean light SaaS; `editorial` = cream magazine + serif; `warm` = intimate cream + amber; `vibrant` = festive folk colour; `neon` = electric neon glow; `mono` = grayscale, type-led; `pastel` = soft candy pastels; `bold` = huge poster type; `industrial` = raw glitch + rust; `futuristic` = particle glow. A freeform string is also accepted as a soft hint. */
|
|
17
39
|
style?: "auto" | "cinematic" | "glass" | "luxury" | "swiss" | "modern" | "editorial" | "warm" | "vibrant" | "neon" | "mono" | "pastel" | "bold" | "industrial" | "futuristic" | "retro";
|
|
18
40
|
/** Optional narration voice — the **timbre** of the voiceover, independent of language. `auto` (default) lets the director pick a fitting voice. Every preset is cross-lingual: the same voice speaks whatever language(s) you set in `langs`, so choose purely by character — `warm-female`, `bright-female`, `anchor-female`, `clean-female`, `calm-male`, `deep-male`, `documentary-male`, `energetic-male`, `storyteller-male`. Advanced: a raw 32-character Fish `reference_id` is also accepted. For `drama` / `avatar` this sets the primary / narrator timbre; distinct characters may still get their own. */
|
|
19
41
|
voice?: "auto" | "warm-female" | "bright-female" | "anchor-female" | "clean-female" | "calm-male" | "deep-male" | "documentary-male" | "energetic-male" | "storyteller-male";
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/** Target video length in seconds (1–600, i.e. up to 10 minutes). Billed by duration: credits ≈ 0.85 × duration × quality multiplier × scenario multiplier, so a longer or video-native workflow costs proportionally more. */
|
|
27
|
-
duration?: number;
|
|
28
|
-
/** How to route the video — a hint; the AI director still decides the final structure. `auto` (default) = the director chooses from your brief. `narrated` = multi-scene narrated video with real photos + voiceover + data cards (people / brands / explainers / history / products). `drama` = acted short drama with characters + dialogue (短剧) and bills at 1.35×. `avatar` = talking-head / digital human (needs a portrait image via `file_urls`, or a chosen digital human) and bills at 1.15×. `motion` = abstract kinetic-typography / data / logo motion graphic. `slideshow` = presentation deck / pitch. Legacy values `general` / `explainer` / `product` / `website` / `changelog` / `captions` are still accepted (mapped to `auto`), and `slides` maps to `slideshow`. */
|
|
29
|
-
scenario?: "auto" | "narrated" | "drama" | "avatar" | "motion" | "slideshow";
|
|
30
|
-
/** Optional reference media (image / video / audio URLs) the agent can use — e.g. a product shot or logo to feature, footage to caption. */
|
|
31
|
-
fileUrls?: string[];
|
|
32
|
-
/** Required when `action` is remix / edit / extend: the task_id of the previous video to start from. */
|
|
33
|
-
refTaskId?: string;
|
|
34
|
-
callbackUrl?: string;
|
|
35
|
-
/** Any parameter added upstream before the SDK is regenerated. */
|
|
36
|
-
[key: string]: unknown;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface MaestroEstimatesOptions {
|
|
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;
|
|
40
48
|
callbackUrl?: string;
|
|
41
49
|
/** Any parameter added upstream before the SDK is regenerated. */
|
|
42
50
|
[key: string]: unknown;
|
|
@@ -46,39 +54,33 @@ export interface MaestroEstimatesOptions {
|
|
|
46
54
|
export class Maestro {
|
|
47
55
|
constructor(private transport: Transport) {}
|
|
48
56
|
|
|
49
|
-
/**
|
|
50
|
-
async generate(options: MaestroGenerateOptions): Promise<
|
|
57
|
+
/** Call /maestro/videos. */
|
|
58
|
+
async generate(options: MaestroGenerateOptions): Promise<TaskHandle> {
|
|
51
59
|
const body: Record<string, unknown> = {};
|
|
52
60
|
body["prompt"] = options.prompt;
|
|
53
|
-
body["langs"] = options.langs ?? ["zh-cn"];
|
|
54
|
-
body["style"] = options.style ?? "auto";
|
|
55
|
-
body["voice"] = options.voice ?? "auto";
|
|
56
61
|
body["action"] = options.action ?? "generate";
|
|
62
|
+
if (options.refTaskId !== undefined) body["ref_task_id"] = options.refTaskId;
|
|
63
|
+
if (options.fileUrls !== undefined) body["file_urls"] = options.fileUrls;
|
|
64
|
+
body["langs"] = options.langs ?? ["zh-cn"];
|
|
57
65
|
body["aspect"] = options.aspect ?? "9:16";
|
|
58
|
-
body["quality"] = options.quality ?? "standard";
|
|
59
66
|
body["duration"] = options.duration ?? 30;
|
|
67
|
+
body["quality"] = options.quality ?? "standard";
|
|
60
68
|
body["scenario"] = options.scenario ?? "auto";
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
body["style"] = options.style ?? "auto";
|
|
70
|
+
body["voice"] = options.voice ?? "auto";
|
|
63
71
|
for (const [key, value] of Object.entries(options)) {
|
|
64
72
|
if (!["action", "aspect", "async", "callbackUrl", "duration", "fileUrls", "langs", "maxWait", "pollInterval", "prompt", "quality", "refTaskId", "scenario", "style", "voice", "wait"].includes(key) && value !== undefined) {
|
|
65
73
|
body[key] = value;
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
76
|
if (options.callbackUrl !== undefined) body.callback_url = options.callbackUrl;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const body: Record<string, unknown> = {};
|
|
75
|
-
for (const [key, value] of Object.entries(options)) {
|
|
76
|
-
if (!["async", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== undefined) {
|
|
77
|
-
body[key] = value;
|
|
78
|
-
}
|
|
77
|
+
body.async = options.async ?? true;
|
|
78
|
+
const result = (await this.transport.request('POST', "/maestro/videos", { json: body })) as Record<string, unknown>;
|
|
79
|
+
const handle = new TaskHandle(taskId(result), "/maestro/tasks", this.transport, result);
|
|
80
|
+
if (options.wait) {
|
|
81
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
79
82
|
}
|
|
80
|
-
|
|
81
|
-
return (await this.transport.request('POST', "/maestro/estimates", { json: body })) as Record<string, unknown>;
|
|
83
|
+
return handle;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
}
|