@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
package/dist/index.mjs
CHANGED
|
@@ -443,25 +443,110 @@ var Chat = class {
|
|
|
443
443
|
};
|
|
444
444
|
|
|
445
445
|
// src/runtime/tasks.ts
|
|
446
|
+
var DONE = /* @__PURE__ */ new Set(["succeed", "succeeded", "success", "completed", "complete", "finished"]);
|
|
447
|
+
var FAILED = /* @__PURE__ */ new Set(["failed", "failure", "error", "cancelled", "canceled", "rejected"]);
|
|
448
|
+
function statusWords(node, depth = 0) {
|
|
449
|
+
if (depth > 6) return [];
|
|
450
|
+
const out = [];
|
|
451
|
+
if (Array.isArray(node)) {
|
|
452
|
+
for (const item of node) out.push(...statusWords(item, depth + 1));
|
|
453
|
+
} else if (node && typeof node === "object") {
|
|
454
|
+
for (const [key, value] of Object.entries(node)) {
|
|
455
|
+
if ((key === "state" || key === "status") && typeof value === "string") {
|
|
456
|
+
out.push(value.toLowerCase());
|
|
457
|
+
} else {
|
|
458
|
+
out.push(...statusWords(value, depth + 1));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return out;
|
|
463
|
+
}
|
|
464
|
+
function collectUrls(node, out, depth = 0) {
|
|
465
|
+
if (depth > 6) return;
|
|
466
|
+
if (Array.isArray(node)) {
|
|
467
|
+
for (const item of node) collectUrls(item, out, depth + 1);
|
|
468
|
+
} else if (node && typeof node === "object") {
|
|
469
|
+
for (const [key, value] of Object.entries(node)) {
|
|
470
|
+
const looksLikeUrl = key.endsWith("_url") || key === "url" || key.endsWith("_urls");
|
|
471
|
+
if (typeof value === "string" && value.startsWith("http") && looksLikeUrl) {
|
|
472
|
+
out.push(value);
|
|
473
|
+
} else {
|
|
474
|
+
collectUrls(value, out, depth + 1);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function artifactUrls(state) {
|
|
480
|
+
if (!state) return [];
|
|
481
|
+
const found = [];
|
|
482
|
+
collectUrls(state.response ?? state, found);
|
|
483
|
+
return [...new Set(found)];
|
|
484
|
+
}
|
|
485
|
+
function taskProgress(state) {
|
|
486
|
+
if (!state) return null;
|
|
487
|
+
for (const value of findKeys(state.response ?? state, ["progress", "percent", "percentage"])) {
|
|
488
|
+
if (typeof value === "boolean") continue;
|
|
489
|
+
if (typeof value === "number") {
|
|
490
|
+
const pct = value > 0 && value <= 1 ? Math.round(value * 100) : Math.round(value);
|
|
491
|
+
return Math.max(0, Math.min(100, pct));
|
|
492
|
+
}
|
|
493
|
+
if (typeof value === "string") {
|
|
494
|
+
const parsed = Number.parseFloat(value.trim().replace(/%$/, ""));
|
|
495
|
+
if (!Number.isNaN(parsed)) return Math.max(0, Math.min(100, Math.round(parsed)));
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
function* findKeys(node, names, depth = 0) {
|
|
501
|
+
if (depth > 6) return;
|
|
502
|
+
if (Array.isArray(node)) {
|
|
503
|
+
for (const item of node) yield* findKeys(item, names, depth + 1);
|
|
504
|
+
} else if (node && typeof node === "object") {
|
|
505
|
+
for (const [key, value] of Object.entries(node)) {
|
|
506
|
+
if (names.includes(key)) yield value;
|
|
507
|
+
else yield* findKeys(value, names, depth + 1);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
446
511
|
function taskStatus(state) {
|
|
447
512
|
const response = state.response ?? state;
|
|
448
|
-
if (response
|
|
449
|
-
|
|
513
|
+
if (!response || typeof response !== "object") return "";
|
|
514
|
+
const words = statusWords(response);
|
|
515
|
+
if (words.some((w) => FAILED.has(w))) return "failed";
|
|
516
|
+
if (words.some((w) => DONE.has(w))) {
|
|
517
|
+
return artifactUrls(state).length > 0 ? "succeeded" : "failed";
|
|
518
|
+
}
|
|
519
|
+
if (words.length > 0) return "";
|
|
450
520
|
const finished = response.finished_at !== void 0 && response.finished_at !== null || state.finished_at !== void 0 && state.finished_at !== null;
|
|
451
|
-
if (
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
521
|
+
if (finished) {
|
|
522
|
+
if (response.success === true) return "succeeded";
|
|
523
|
+
if (response.success === false) return "failed";
|
|
524
|
+
if (artifactUrls(state).length > 0) return "succeeded";
|
|
525
|
+
}
|
|
526
|
+
return artifactUrls(state).length > 0 ? "succeeded" : "";
|
|
455
527
|
}
|
|
456
528
|
var TaskHandle = class {
|
|
457
529
|
id;
|
|
458
530
|
pollEndpoint;
|
|
459
531
|
transport;
|
|
460
532
|
_result = null;
|
|
461
|
-
constructor(
|
|
462
|
-
this.id =
|
|
533
|
+
constructor(taskId14, pollEndpoint, transport, submitted) {
|
|
534
|
+
this.id = taskId14;
|
|
463
535
|
this.pollEndpoint = pollEndpoint;
|
|
464
536
|
this.transport = transport;
|
|
537
|
+
if (submitted && artifactUrls({ response: submitted }).length > 0) {
|
|
538
|
+
this._result = { response: submitted };
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
get done() {
|
|
542
|
+
return this._result !== null;
|
|
543
|
+
}
|
|
544
|
+
/** Artifact URLs, once completed. */
|
|
545
|
+
urls() {
|
|
546
|
+
return artifactUrls(this._result);
|
|
547
|
+
}
|
|
548
|
+
progress() {
|
|
549
|
+
return taskProgress(this._result);
|
|
465
550
|
}
|
|
466
551
|
async get() {
|
|
467
552
|
return this.transport.request("POST", this.pollEndpoint, {
|
|
@@ -469,11 +554,12 @@ var TaskHandle = class {
|
|
|
469
554
|
});
|
|
470
555
|
}
|
|
471
556
|
async isCompleted() {
|
|
472
|
-
|
|
473
|
-
const status = taskStatus(
|
|
557
|
+
if (this.done) return true;
|
|
558
|
+
const status = taskStatus(await this.get());
|
|
474
559
|
return status === "succeeded" || status === "failed";
|
|
475
560
|
}
|
|
476
561
|
async wait(opts = {}) {
|
|
562
|
+
if (this._result !== null) return this._result;
|
|
477
563
|
const pollInterval = opts.pollInterval ?? 3e3;
|
|
478
564
|
const maxWait = opts.maxWait ?? 6e5;
|
|
479
565
|
const start = Date.now();
|
|
@@ -512,9 +598,9 @@ var Images = class {
|
|
|
512
598
|
if (callbackUrl !== void 0) body.callback_url = callbackUrl;
|
|
513
599
|
const endpoint = `/${provider}/images`;
|
|
514
600
|
const result = await this.transport.request("POST", endpoint, { json: body });
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
517
|
-
const handle = new TaskHandle(
|
|
601
|
+
const taskId14 = result.task_id;
|
|
602
|
+
if (!taskId14 || result.data && !shouldWait) return result;
|
|
603
|
+
const handle = new TaskHandle(taskId14, `/${provider}/tasks`, this.transport);
|
|
518
604
|
if (shouldWait) return handle.wait({ pollInterval, maxWait });
|
|
519
605
|
return handle;
|
|
520
606
|
}
|
|
@@ -560,9 +646,9 @@ var Audio = class {
|
|
|
560
646
|
if (callbackUrl !== void 0) body.callback_url = callbackUrl;
|
|
561
647
|
result = await this.transport.request("POST", `/${provider}/audios`, { json: body });
|
|
562
648
|
}
|
|
563
|
-
const
|
|
564
|
-
if (!
|
|
565
|
-
const handle = new TaskHandle(
|
|
649
|
+
const taskId14 = result.task_id;
|
|
650
|
+
if (!taskId14 || result.data && !shouldWait) return result;
|
|
651
|
+
const handle = new TaskHandle(taskId14, `/${provider}/tasks`, this.transport);
|
|
566
652
|
if (shouldWait) return handle.wait({ pollInterval, maxWait });
|
|
567
653
|
return handle;
|
|
568
654
|
}
|
|
@@ -581,9 +667,9 @@ var Video = class {
|
|
|
581
667
|
if (imageUrl !== void 0) body.image_url = imageUrl;
|
|
582
668
|
if (callbackUrl !== void 0) body.callback_url = callbackUrl;
|
|
583
669
|
const result = await this.transport.request("POST", `/${provider}/videos`, { json: body });
|
|
584
|
-
const
|
|
585
|
-
if (!
|
|
586
|
-
const handle = new TaskHandle(
|
|
670
|
+
const taskId14 = result.task_id;
|
|
671
|
+
if (!taskId14 || result.data && !shouldWait) return result;
|
|
672
|
+
const handle = new TaskHandle(taskId14, `/${provider}/tasks`, this.transport);
|
|
587
673
|
if (shouldWait) return handle.wait({ pollInterval, maxWait });
|
|
588
674
|
return handle;
|
|
589
675
|
}
|
|
@@ -629,17 +715,17 @@ var Tasks = class {
|
|
|
629
715
|
this.transport = transport;
|
|
630
716
|
}
|
|
631
717
|
transport;
|
|
632
|
-
async get(
|
|
718
|
+
async get(taskId14, opts = {}) {
|
|
633
719
|
const service = opts.service ?? "suno";
|
|
634
720
|
const endpoint = SERVICE_TASK_ENDPOINTS[service] ?? `/${service}/tasks`;
|
|
635
721
|
return this.transport.request("POST", endpoint, {
|
|
636
|
-
json: { id:
|
|
722
|
+
json: { id: taskId14, action: "retrieve" }
|
|
637
723
|
});
|
|
638
724
|
}
|
|
639
|
-
async wait(
|
|
725
|
+
async wait(taskId14, opts = {}) {
|
|
640
726
|
const service = opts.service ?? "suno";
|
|
641
727
|
const endpoint = SERVICE_TASK_ENDPOINTS[service] ?? `/${service}/tasks`;
|
|
642
|
-
const handle = new TaskHandle(
|
|
728
|
+
const handle = new TaskHandle(taskId14, endpoint, this.transport);
|
|
643
729
|
return handle.wait({ pollInterval: opts.pollInterval, maxWait: opts.maxWait });
|
|
644
730
|
}
|
|
645
731
|
};
|
|
@@ -1257,6 +1343,894 @@ var ShortUrl = class {
|
|
|
1257
1343
|
}
|
|
1258
1344
|
};
|
|
1259
1345
|
|
|
1346
|
+
// src/resources/providers/digitalhuman.ts
|
|
1347
|
+
function taskId(result) {
|
|
1348
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1349
|
+
const data = result?.data;
|
|
1350
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1351
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1352
|
+
}
|
|
1353
|
+
var Digitalhuman = class {
|
|
1354
|
+
constructor(transport) {
|
|
1355
|
+
this.transport = transport;
|
|
1356
|
+
}
|
|
1357
|
+
transport;
|
|
1358
|
+
/** Digital Human video generation API — turn a portrait plus audio or text into a talking-head video. */
|
|
1359
|
+
async generate(options) {
|
|
1360
|
+
const body = {};
|
|
1361
|
+
body["video_url"] = options.videoUrl;
|
|
1362
|
+
body["text"] = options.text ?? "\u5927\u5BB6\u597D\uFF0C\u8FD9\u662F\u79BB\u7EBF\u751F\u6210\u7684\u6570\u5B57\u4EBA\u3002";
|
|
1363
|
+
body["speed"] = options.speed ?? 1;
|
|
1364
|
+
body["steps"] = options.steps ?? 40;
|
|
1365
|
+
body["engine"] = options.engine ?? "latentsync";
|
|
1366
|
+
body["guidance"] = options.guidance ?? 2;
|
|
1367
|
+
body["seam_fix"] = options.seamFix ?? true;
|
|
1368
|
+
if (options.voiceId !== void 0) body["voice_id"] = options.voiceId;
|
|
1369
|
+
if (options.audioUrl !== void 0) body["audio_url"] = options.audioUrl;
|
|
1370
|
+
if (options.imageUrl !== void 0) body["image_url"] = options.imageUrl;
|
|
1371
|
+
body["resolution"] = options.resolution ?? "720p";
|
|
1372
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1373
|
+
if (!["async", "audioUrl", "callbackUrl", "engine", "guidance", "imageUrl", "maxWait", "pollInterval", "resolution", "seamFix", "speed", "steps", "text", "videoUrl", "voiceId", "wait"].includes(key) && value !== void 0) {
|
|
1374
|
+
body[key] = value;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1378
|
+
body.async = options.async ?? true;
|
|
1379
|
+
const result = await this.transport.request("POST", "/digital-human/videos", { json: body });
|
|
1380
|
+
const handle = new TaskHandle(taskId(result), "/digital-human/tasks", this.transport, result);
|
|
1381
|
+
if (options.wait) {
|
|
1382
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1383
|
+
}
|
|
1384
|
+
return handle;
|
|
1385
|
+
}
|
|
1386
|
+
/** Digital Human voice-clone API — upload an audio sample to clone a custom voice for speech synthesis. */
|
|
1387
|
+
async voices(options) {
|
|
1388
|
+
const body = {};
|
|
1389
|
+
body["audio_url"] = options.audioUrl;
|
|
1390
|
+
body["lang"] = options.lang ?? "zh";
|
|
1391
|
+
if (options.name !== void 0) body["name"] = options.name;
|
|
1392
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1393
|
+
if (!["async", "audioUrl", "callbackUrl", "lang", "maxWait", "name", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
1394
|
+
body[key] = value;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1398
|
+
body.async = options.async ?? true;
|
|
1399
|
+
const result = await this.transport.request("POST", "/digital-human/voices", { json: body });
|
|
1400
|
+
const handle = new TaskHandle(taskId(result), "/digital-human/tasks", this.transport, result);
|
|
1401
|
+
if (options.wait) {
|
|
1402
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1403
|
+
}
|
|
1404
|
+
return handle;
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1408
|
+
// src/resources/providers/dreamina.ts
|
|
1409
|
+
function taskId2(result) {
|
|
1410
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1411
|
+
const data = result?.data;
|
|
1412
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1413
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1414
|
+
}
|
|
1415
|
+
var Dreamina = class {
|
|
1416
|
+
constructor(transport) {
|
|
1417
|
+
this.transport = transport;
|
|
1418
|
+
}
|
|
1419
|
+
transport;
|
|
1420
|
+
/** Audio-driven talking-photo digital human video generation (OmniHuman 1.5) */
|
|
1421
|
+
async generate(options) {
|
|
1422
|
+
const body = {};
|
|
1423
|
+
body["audio_url"] = options.audioUrl;
|
|
1424
|
+
body["image_url"] = options.imageUrl;
|
|
1425
|
+
body["model"] = options.model ?? "omnihuman-1.5";
|
|
1426
|
+
if (options.prompt !== void 0) body["prompt"] = options.prompt;
|
|
1427
|
+
if (options.maskUrl !== void 0) body["mask_url"] = options.maskUrl;
|
|
1428
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1429
|
+
if (!["async", "audioUrl", "callbackUrl", "imageUrl", "maskUrl", "maxWait", "model", "pollInterval", "prompt", "wait"].includes(key) && value !== void 0) {
|
|
1430
|
+
body[key] = value;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1434
|
+
body.async = options.async ?? true;
|
|
1435
|
+
const result = await this.transport.request("POST", "/dreamina/videos", { json: body });
|
|
1436
|
+
const handle = new TaskHandle(taskId2(result), "/dreamina/tasks", this.transport, result);
|
|
1437
|
+
if (options.wait) {
|
|
1438
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1439
|
+
}
|
|
1440
|
+
return handle;
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
// src/resources/providers/fish.ts
|
|
1445
|
+
function taskId3(result) {
|
|
1446
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1447
|
+
const data = result?.data;
|
|
1448
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1449
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1450
|
+
}
|
|
1451
|
+
var Fish = class {
|
|
1452
|
+
constructor(transport) {
|
|
1453
|
+
this.transport = transport;
|
|
1454
|
+
}
|
|
1455
|
+
transport;
|
|
1456
|
+
/** Fish Audio text-to-speech API — convert text into natural speech using a chosen voice model. */
|
|
1457
|
+
async generate(options) {
|
|
1458
|
+
const body = {};
|
|
1459
|
+
body["text"] = options.text;
|
|
1460
|
+
if (options.topP !== void 0) body["top_p"] = options.topP;
|
|
1461
|
+
if (options.format !== void 0) body["format"] = options.format;
|
|
1462
|
+
if (options.latency !== void 0) body["latency"] = options.latency;
|
|
1463
|
+
if (options.prosody !== void 0) body["prosody"] = options.prosody;
|
|
1464
|
+
if (options.normalize !== void 0) body["normalize"] = options.normalize;
|
|
1465
|
+
if (options.references !== void 0) body["references"] = options.references;
|
|
1466
|
+
if (options.mp3Bitrate !== void 0) body["mp3_bitrate"] = options.mp3Bitrate;
|
|
1467
|
+
if (options.sampleRate !== void 0) body["sample_rate"] = options.sampleRate;
|
|
1468
|
+
if (options.temperature !== void 0) body["temperature"] = options.temperature;
|
|
1469
|
+
if (options.chunkLength !== void 0) body["chunk_length"] = options.chunkLength;
|
|
1470
|
+
if (options.opusBitrate !== void 0) body["opus_bitrate"] = options.opusBitrate;
|
|
1471
|
+
body["reference_id"] = options.referenceId ?? "d7900c21663f485ab63ebdb7e5905036";
|
|
1472
|
+
if (options.maxNewTokens !== void 0) body["max_new_tokens"] = options.maxNewTokens;
|
|
1473
|
+
if (options.minChunkLength !== void 0) body["min_chunk_length"] = options.minChunkLength;
|
|
1474
|
+
if (options.repetitionPenalty !== void 0) body["repetition_penalty"] = options.repetitionPenalty;
|
|
1475
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1476
|
+
if (!["async", "callbackUrl", "chunkLength", "format", "latency", "maxNewTokens", "maxWait", "minChunkLength", "mp3Bitrate", "normalize", "opusBitrate", "pollInterval", "prosody", "referenceId", "references", "repetitionPenalty", "sampleRate", "temperature", "text", "topP", "wait"].includes(key) && value !== void 0) {
|
|
1477
|
+
body[key] = value;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1481
|
+
body.async = options.async ?? true;
|
|
1482
|
+
const result = await this.transport.request("POST", "/fish/tts", { json: body });
|
|
1483
|
+
const handle = new TaskHandle(taskId3(result), "/fish/tasks", this.transport, result);
|
|
1484
|
+
if (options.wait) {
|
|
1485
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1486
|
+
}
|
|
1487
|
+
return handle;
|
|
1488
|
+
}
|
|
1489
|
+
/** Fish Audio model creation API — upload reference audio to create a custom voice-clone model. */
|
|
1490
|
+
async model(options) {
|
|
1491
|
+
const body = {};
|
|
1492
|
+
body["title"] = options.title;
|
|
1493
|
+
body["voices"] = options.voices;
|
|
1494
|
+
if (options.tags !== void 0) body["tags"] = options.tags;
|
|
1495
|
+
if (options.texts !== void 0) body["texts"] = options.texts;
|
|
1496
|
+
if (options.visibility !== void 0) body["visibility"] = options.visibility;
|
|
1497
|
+
if (options.coverImage !== void 0) body["cover_image"] = options.coverImage;
|
|
1498
|
+
if (options.description !== void 0) body["description"] = options.description;
|
|
1499
|
+
if (options.generateSample !== void 0) body["generate_sample"] = options.generateSample;
|
|
1500
|
+
if (options.enhanceAudioQuality !== void 0) body["enhance_audio_quality"] = options.enhanceAudioQuality;
|
|
1501
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1502
|
+
if (!["async", "callbackUrl", "coverImage", "description", "enhanceAudioQuality", "generateSample", "maxWait", "pollInterval", "tags", "texts", "title", "visibility", "voices", "wait"].includes(key) && value !== void 0) {
|
|
1503
|
+
body[key] = value;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1507
|
+
return await this.transport.request("POST", "/fish/model", { json: body });
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1510
|
+
|
|
1511
|
+
// src/resources/providers/flux.ts
|
|
1512
|
+
function taskId4(result) {
|
|
1513
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1514
|
+
const data = result?.data;
|
|
1515
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1516
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1517
|
+
}
|
|
1518
|
+
var Flux = class {
|
|
1519
|
+
constructor(transport) {
|
|
1520
|
+
this.transport = transport;
|
|
1521
|
+
}
|
|
1522
|
+
transport;
|
|
1523
|
+
/** Flux AI image generation API, generates 1 image per request. */
|
|
1524
|
+
async generate(options) {
|
|
1525
|
+
const body = {};
|
|
1526
|
+
body["action"] = options.action;
|
|
1527
|
+
body["prompt"] = options.prompt;
|
|
1528
|
+
body["size"] = options.size ?? "1024x1024";
|
|
1529
|
+
if (options.count !== void 0) body["count"] = options.count;
|
|
1530
|
+
if (options.model !== void 0) body["model"] = options.model;
|
|
1531
|
+
if (options.imageUrl !== void 0) body["image_url"] = options.imageUrl;
|
|
1532
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1533
|
+
if (!["action", "async", "callbackUrl", "count", "imageUrl", "maxWait", "model", "pollInterval", "prompt", "size", "wait"].includes(key) && value !== void 0) {
|
|
1534
|
+
body[key] = value;
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1538
|
+
body.async = options.async ?? true;
|
|
1539
|
+
const result = await this.transport.request("POST", "/flux/images", { json: body });
|
|
1540
|
+
const handle = new TaskHandle(taskId4(result), "/flux/tasks", this.transport, result);
|
|
1541
|
+
if (options.wait) {
|
|
1542
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1543
|
+
}
|
|
1544
|
+
return handle;
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
// src/resources/providers/hailuo.ts
|
|
1549
|
+
function taskId5(result) {
|
|
1550
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1551
|
+
const data = result?.data;
|
|
1552
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1553
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1554
|
+
}
|
|
1555
|
+
var Hailuo = class {
|
|
1556
|
+
constructor(transport) {
|
|
1557
|
+
this.transport = transport;
|
|
1558
|
+
}
|
|
1559
|
+
transport;
|
|
1560
|
+
/** Minimax Hailuo AI video generation API. Supports minimax-t2v for text-to-video, minimax-i2v for image-to-video, and minimax-i2v-director for director mode with camera/movement instructions. */
|
|
1561
|
+
async generate(options) {
|
|
1562
|
+
const body = {};
|
|
1563
|
+
body["action"] = options.action;
|
|
1564
|
+
if (options.model !== void 0) body["model"] = options.model;
|
|
1565
|
+
body["prompt"] = options.prompt ?? "\u706B\u6C14";
|
|
1566
|
+
if (options.firstImageUrl !== void 0) body["first_image_url"] = options.firstImageUrl;
|
|
1567
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1568
|
+
if (!["action", "async", "callbackUrl", "firstImageUrl", "maxWait", "model", "pollInterval", "prompt", "wait"].includes(key) && value !== void 0) {
|
|
1569
|
+
body[key] = value;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1573
|
+
body.async = options.async ?? true;
|
|
1574
|
+
const result = await this.transport.request("POST", "/hailuo/videos", { json: body });
|
|
1575
|
+
const handle = new TaskHandle(taskId5(result), "/hailuo/tasks", this.transport, result);
|
|
1576
|
+
if (options.wait) {
|
|
1577
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1578
|
+
}
|
|
1579
|
+
return handle;
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
// src/resources/providers/happyhorse.ts
|
|
1584
|
+
function taskId6(result) {
|
|
1585
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1586
|
+
const data = result?.data;
|
|
1587
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1588
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1589
|
+
}
|
|
1590
|
+
var Happyhorse = class {
|
|
1591
|
+
constructor(transport) {
|
|
1592
|
+
this.transport = transport;
|
|
1593
|
+
}
|
|
1594
|
+
transport;
|
|
1595
|
+
/** Call /happyhorse/videos. */
|
|
1596
|
+
async generate(options = {}) {
|
|
1597
|
+
const body = {};
|
|
1598
|
+
if (options.seed !== void 0) body["seed"] = options.seed;
|
|
1599
|
+
body["model"] = options.model ?? "happyhorse-1.1-t2v";
|
|
1600
|
+
body["ratio"] = options.ratio ?? "16:9";
|
|
1601
|
+
body["action"] = options.action ?? "generate";
|
|
1602
|
+
body["prompt"] = options.prompt ?? "A cinematic white horse lifts its head, the mane moves gently in the sunrise wind, slow camera push in, warm film lighting";
|
|
1603
|
+
body["duration"] = options.duration ?? 5;
|
|
1604
|
+
body["image_url"] = options.imageUrl ?? "https://cdn.acedata.cloud/b1c82e4937.png";
|
|
1605
|
+
body["video_url"] = options.videoUrl ?? "https://platform2.cdn.acedata.cloud/happyhorse/27837f92-d1c1-4db4-ad9a-4e6e81d9f6c1.mp4";
|
|
1606
|
+
body["watermark"] = options.watermark ?? false;
|
|
1607
|
+
if (options.imageUrls !== void 0) body["image_urls"] = options.imageUrls;
|
|
1608
|
+
body["resolution"] = options.resolution ?? "1080P";
|
|
1609
|
+
body["audio_setting"] = options.audioSetting ?? "auto";
|
|
1610
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1611
|
+
if (!["action", "async", "audioSetting", "callbackUrl", "duration", "imageUrl", "imageUrls", "maxWait", "model", "pollInterval", "prompt", "ratio", "resolution", "seed", "videoUrl", "wait", "watermark"].includes(key) && value !== void 0) {
|
|
1612
|
+
body[key] = value;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1616
|
+
body.async = options.async ?? true;
|
|
1617
|
+
const result = await this.transport.request("POST", "/happyhorse/videos", { json: body });
|
|
1618
|
+
const handle = new TaskHandle(taskId6(result), "/happyhorse/tasks", this.transport, result);
|
|
1619
|
+
if (options.wait) {
|
|
1620
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1621
|
+
}
|
|
1622
|
+
return handle;
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
|
|
1626
|
+
// src/resources/providers/localization.ts
|
|
1627
|
+
var Localization = class {
|
|
1628
|
+
constructor(transport) {
|
|
1629
|
+
this.transport = transport;
|
|
1630
|
+
}
|
|
1631
|
+
transport;
|
|
1632
|
+
/** Translate a JSON input into any localized file */
|
|
1633
|
+
async translate(options) {
|
|
1634
|
+
const body = {};
|
|
1635
|
+
body["input"] = options.input;
|
|
1636
|
+
body["locale"] = options.locale;
|
|
1637
|
+
body["extension"] = options.extension;
|
|
1638
|
+
if (options.model !== void 0) body["model"] = options.model;
|
|
1639
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1640
|
+
if (!["async", "callbackUrl", "extension", "input", "locale", "maxWait", "model", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
1641
|
+
body[key] = value;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1645
|
+
return await this.transport.request("POST", "/localization/translate", { json: body });
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
|
|
1649
|
+
// src/resources/providers/luma.ts
|
|
1650
|
+
function taskId7(result) {
|
|
1651
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1652
|
+
const data = result?.data;
|
|
1653
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1654
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1655
|
+
}
|
|
1656
|
+
var Luma = class {
|
|
1657
|
+
constructor(transport) {
|
|
1658
|
+
this.transport = transport;
|
|
1659
|
+
}
|
|
1660
|
+
transport;
|
|
1661
|
+
/** Generate videos based on prompt and image frames */
|
|
1662
|
+
async generate(options = {}) {
|
|
1663
|
+
const body = {};
|
|
1664
|
+
body["loop"] = options.loop ?? false;
|
|
1665
|
+
body["action"] = options.action ?? "generate";
|
|
1666
|
+
body["prompt"] = options.prompt ?? "Astronauts shuttle from space to volcano";
|
|
1667
|
+
body["timeout"] = options.timeout ?? 300;
|
|
1668
|
+
if (options.videoId !== void 0) body["video_id"] = options.videoId;
|
|
1669
|
+
if (options.videoUrl !== void 0) body["video_url"] = options.videoUrl;
|
|
1670
|
+
body["enhancement"] = options.enhancement ?? true;
|
|
1671
|
+
if (options.aspectRatio !== void 0) body["aspect_ratio"] = options.aspectRatio;
|
|
1672
|
+
body["end_image_url"] = options.endImageUrl ?? "https://cdn.acedata.cloud/0iad3k.png";
|
|
1673
|
+
body["start_image_url"] = options.startImageUrl ?? "https://cdn.acedata.cloud/r9vsv9.png";
|
|
1674
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1675
|
+
if (!["action", "aspectRatio", "async", "callbackUrl", "endImageUrl", "enhancement", "loop", "maxWait", "pollInterval", "prompt", "startImageUrl", "timeout", "videoId", "videoUrl", "wait"].includes(key) && value !== void 0) {
|
|
1676
|
+
body[key] = value;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1680
|
+
body.async = options.async ?? true;
|
|
1681
|
+
const result = await this.transport.request("POST", "/luma/videos", { json: body });
|
|
1682
|
+
const handle = new TaskHandle(taskId7(result), "/luma/tasks", this.transport, result);
|
|
1683
|
+
if (options.wait) {
|
|
1684
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1685
|
+
}
|
|
1686
|
+
return handle;
|
|
1687
|
+
}
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1690
|
+
// src/resources/providers/maestro.ts
|
|
1691
|
+
var Maestro = class {
|
|
1692
|
+
constructor(transport) {
|
|
1693
|
+
this.transport = transport;
|
|
1694
|
+
}
|
|
1695
|
+
transport;
|
|
1696
|
+
/** Maestro Video Generation API */
|
|
1697
|
+
async generate(options) {
|
|
1698
|
+
const body = {};
|
|
1699
|
+
body["prompt"] = options.prompt;
|
|
1700
|
+
body["langs"] = options.langs ?? ["zh-cn"];
|
|
1701
|
+
body["style"] = options.style ?? "auto";
|
|
1702
|
+
body["voice"] = options.voice ?? "auto";
|
|
1703
|
+
body["action"] = options.action ?? "generate";
|
|
1704
|
+
body["aspect"] = options.aspect ?? "9:16";
|
|
1705
|
+
body["quality"] = options.quality ?? "standard";
|
|
1706
|
+
body["duration"] = options.duration ?? 30;
|
|
1707
|
+
body["scenario"] = options.scenario ?? "auto";
|
|
1708
|
+
if (options.fileUrls !== void 0) body["file_urls"] = options.fileUrls;
|
|
1709
|
+
if (options.refTaskId !== void 0) body["ref_task_id"] = options.refTaskId;
|
|
1710
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1711
|
+
if (!["action", "aspect", "async", "callbackUrl", "duration", "fileUrls", "langs", "maxWait", "pollInterval", "prompt", "quality", "refTaskId", "scenario", "style", "voice", "wait"].includes(key) && value !== void 0) {
|
|
1712
|
+
body[key] = value;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1716
|
+
return await this.transport.request("POST", "/maestro/videos", { json: body });
|
|
1717
|
+
}
|
|
1718
|
+
/** Call /maestro/estimates. */
|
|
1719
|
+
async estimates(options = {}) {
|
|
1720
|
+
const body = {};
|
|
1721
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1722
|
+
if (!["async", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
1723
|
+
body[key] = value;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1727
|
+
return await this.transport.request("POST", "/maestro/estimates", { json: body });
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
// src/resources/providers/nano-banana.ts
|
|
1732
|
+
function taskId8(result) {
|
|
1733
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1734
|
+
const data = result?.data;
|
|
1735
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1736
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1737
|
+
}
|
|
1738
|
+
var NanoBanana = class {
|
|
1739
|
+
constructor(transport) {
|
|
1740
|
+
this.transport = transport;
|
|
1741
|
+
}
|
|
1742
|
+
transport;
|
|
1743
|
+
/** Google Nano Banana image generation and editing API. Supports nano-banana, nano-banana-2, and nano-banana-pro for text-to-image generation and reference-image editing. */
|
|
1744
|
+
async generate(options) {
|
|
1745
|
+
const body = {};
|
|
1746
|
+
body["action"] = options.action;
|
|
1747
|
+
body["prompt"] = options.prompt;
|
|
1748
|
+
body["count"] = options.count ?? 1;
|
|
1749
|
+
if (options.model !== void 0) body["model"] = options.model;
|
|
1750
|
+
if (options.imageUrls !== void 0) body["image_urls"] = options.imageUrls;
|
|
1751
|
+
if (options.resolution !== void 0) body["resolution"] = options.resolution;
|
|
1752
|
+
body["aspect_ratio"] = options.aspectRatio ?? "1:1";
|
|
1753
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1754
|
+
if (!["action", "aspectRatio", "async", "callbackUrl", "count", "imageUrls", "maxWait", "model", "pollInterval", "prompt", "resolution", "wait"].includes(key) && value !== void 0) {
|
|
1755
|
+
body[key] = value;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1759
|
+
body.async = options.async ?? true;
|
|
1760
|
+
const result = await this.transport.request("POST", "/nano-banana/images", { json: body });
|
|
1761
|
+
const handle = new TaskHandle(taskId8(result), "/nano-banana/tasks", this.transport, result);
|
|
1762
|
+
if (options.wait) {
|
|
1763
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1764
|
+
}
|
|
1765
|
+
return handle;
|
|
1766
|
+
}
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
// src/resources/providers/producer.ts
|
|
1770
|
+
function taskId9(result) {
|
|
1771
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1772
|
+
const data = result?.data;
|
|
1773
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1774
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1775
|
+
}
|
|
1776
|
+
var Producer = class {
|
|
1777
|
+
constructor(transport) {
|
|
1778
|
+
this.transport = transport;
|
|
1779
|
+
}
|
|
1780
|
+
transport;
|
|
1781
|
+
/** Producer reference audio upload API, upload audio to get an audio_id for generation. */
|
|
1782
|
+
async upload(options) {
|
|
1783
|
+
const body = {};
|
|
1784
|
+
body["audio_url"] = options.audioUrl;
|
|
1785
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1786
|
+
if (!["async", "audioUrl", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
1787
|
+
body[key] = value;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1791
|
+
return await this.transport.request("POST", "/producer/upload", { json: body });
|
|
1792
|
+
}
|
|
1793
|
+
/** AceData Producer MP4 retrieval API. Pass an audio_id to receive an MP4 video download link with cover art. */
|
|
1794
|
+
async generate(options) {
|
|
1795
|
+
const body = {};
|
|
1796
|
+
body["audio_id"] = options.audioId;
|
|
1797
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1798
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
1799
|
+
body[key] = value;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1803
|
+
return await this.transport.request("POST", "/producer/videos", { json: body });
|
|
1804
|
+
}
|
|
1805
|
+
/** AceData Producer WAV (lossless) retrieval API. Pass an audio_id to receive a WAV-format download link. */
|
|
1806
|
+
async wav(options) {
|
|
1807
|
+
const body = {};
|
|
1808
|
+
body["audio_id"] = options.audioId;
|
|
1809
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1810
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
1811
|
+
body[key] = value;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1815
|
+
return await this.transport.request("POST", "/producer/wav", { json: body });
|
|
1816
|
+
}
|
|
1817
|
+
/** Producer AI music generation API, generates 1 song per request. */
|
|
1818
|
+
async producer_audios(options) {
|
|
1819
|
+
const body = {};
|
|
1820
|
+
body["lyric"] = options.lyric;
|
|
1821
|
+
body["action"] = options.action;
|
|
1822
|
+
body["prompt"] = options.prompt;
|
|
1823
|
+
if (options.seed !== void 0) body["seed"] = options.seed;
|
|
1824
|
+
if (options.model !== void 0) body["model"] = options.model;
|
|
1825
|
+
if (options.title !== void 0) body["title"] = options.title;
|
|
1826
|
+
if (options.custom !== void 0) body["custom"] = options.custom;
|
|
1827
|
+
if (options.audioId !== void 0) body["audio_id"] = options.audioId;
|
|
1828
|
+
body["weirdness"] = options.weirdness ?? false;
|
|
1829
|
+
body["continue_at"] = options.continueAt ?? false;
|
|
1830
|
+
body["instrumental"] = options.instrumental ?? false;
|
|
1831
|
+
body["sound_strength"] = options.soundStrength ?? false;
|
|
1832
|
+
body["lyrics_strength"] = options.lyricsStrength ?? false;
|
|
1833
|
+
body["replace_section_end"] = options.replaceSectionEnd ?? false;
|
|
1834
|
+
body["replace_section_start"] = options.replaceSectionStart ?? false;
|
|
1835
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1836
|
+
if (!["action", "async", "audioId", "callbackUrl", "continueAt", "custom", "instrumental", "lyric", "lyricsStrength", "maxWait", "model", "pollInterval", "prompt", "replaceSectionEnd", "replaceSectionStart", "seed", "soundStrength", "title", "wait", "weirdness"].includes(key) && value !== void 0) {
|
|
1837
|
+
body[key] = value;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1841
|
+
body.async = options.async ?? true;
|
|
1842
|
+
const result = await this.transport.request("POST", "/producer/audios", { json: body });
|
|
1843
|
+
const handle = new TaskHandle(taskId9(result), "/producer/tasks", this.transport, result);
|
|
1844
|
+
if (options.wait) {
|
|
1845
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1846
|
+
}
|
|
1847
|
+
return handle;
|
|
1848
|
+
}
|
|
1849
|
+
/** Producer AI lyrics generation API, input a prompt to generate lyrics. */
|
|
1850
|
+
async lyrics(options) {
|
|
1851
|
+
const body = {};
|
|
1852
|
+
body["prompt"] = options.prompt;
|
|
1853
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1854
|
+
if (!["async", "callbackUrl", "maxWait", "pollInterval", "prompt", "wait"].includes(key) && value !== void 0) {
|
|
1855
|
+
body[key] = value;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1859
|
+
return await this.transport.request("POST", "/producer/lyrics", { json: body });
|
|
1860
|
+
}
|
|
1861
|
+
};
|
|
1862
|
+
|
|
1863
|
+
// src/resources/providers/seedance.ts
|
|
1864
|
+
function taskId10(result) {
|
|
1865
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1866
|
+
const data = result?.data;
|
|
1867
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1868
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1869
|
+
}
|
|
1870
|
+
var Seedance = class {
|
|
1871
|
+
constructor(transport) {
|
|
1872
|
+
this.transport = transport;
|
|
1873
|
+
}
|
|
1874
|
+
transport;
|
|
1875
|
+
/** ByteDance Seedance video generation API. Supports 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, and doubao-s */
|
|
1876
|
+
async generate(options) {
|
|
1877
|
+
const body = {};
|
|
1878
|
+
body["model"] = options.model;
|
|
1879
|
+
body["content"] = options.content;
|
|
1880
|
+
if (options.seed !== void 0) body["seed"] = options.seed;
|
|
1881
|
+
body["ratio"] = options.ratio ?? "16:9";
|
|
1882
|
+
if (options.frames !== void 0) body["frames"] = options.frames;
|
|
1883
|
+
if (options.duration !== void 0) body["duration"] = options.duration;
|
|
1884
|
+
if (options.watermark !== void 0) body["watermark"] = options.watermark;
|
|
1885
|
+
if (options.resolution !== void 0) body["resolution"] = options.resolution;
|
|
1886
|
+
if (options.camerafixed !== void 0) body["camerafixed"] = options.camerafixed;
|
|
1887
|
+
body["generate_audio"] = options.generateAudio ?? false;
|
|
1888
|
+
body["return_last_frame"] = options.returnLastFrame ?? false;
|
|
1889
|
+
body["execution_expires_after"] = options.executionExpiresAfter ?? 172800;
|
|
1890
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1891
|
+
if (!["async", "callbackUrl", "camerafixed", "content", "duration", "executionExpiresAfter", "frames", "generateAudio", "maxWait", "model", "pollInterval", "ratio", "resolution", "returnLastFrame", "seed", "wait", "watermark"].includes(key) && value !== void 0) {
|
|
1892
|
+
body[key] = value;
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1896
|
+
body.async = options.async ?? true;
|
|
1897
|
+
const result = await this.transport.request("POST", "/seedance/videos", { json: body });
|
|
1898
|
+
const handle = new TaskHandle(taskId10(result), "/seedance/tasks", this.transport, result);
|
|
1899
|
+
if (options.wait) {
|
|
1900
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1901
|
+
}
|
|
1902
|
+
return handle;
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1906
|
+
// src/resources/providers/seedream.ts
|
|
1907
|
+
function taskId11(result) {
|
|
1908
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1909
|
+
const data = result?.data;
|
|
1910
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1911
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1912
|
+
}
|
|
1913
|
+
var Seedream = class {
|
|
1914
|
+
constructor(transport) {
|
|
1915
|
+
this.transport = transport;
|
|
1916
|
+
}
|
|
1917
|
+
transport;
|
|
1918
|
+
/** 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- */
|
|
1919
|
+
async generate(options) {
|
|
1920
|
+
const body = {};
|
|
1921
|
+
body["model"] = options.model;
|
|
1922
|
+
body["prompt"] = options.prompt;
|
|
1923
|
+
if (options.seed !== void 0) body["seed"] = options.seed;
|
|
1924
|
+
body["size"] = options.size ?? "2K";
|
|
1925
|
+
if (options.image !== void 0) body["image"] = options.image;
|
|
1926
|
+
if (options.tools !== void 0) body["tools"] = options.tools;
|
|
1927
|
+
if (options.stream !== void 0) body["stream"] = options.stream;
|
|
1928
|
+
if (options.watermark !== void 0) body["watermark"] = options.watermark;
|
|
1929
|
+
if (options.outputFormat !== void 0) body["output_format"] = options.outputFormat;
|
|
1930
|
+
if (options.guidanceScale !== void 0) body["guidance_scale"] = options.guidanceScale;
|
|
1931
|
+
if (options.responseFormat !== void 0) body["response_format"] = options.responseFormat;
|
|
1932
|
+
if (options.optimizePromptOptions !== void 0) body["optimize_prompt_options"] = options.optimizePromptOptions;
|
|
1933
|
+
if (options.sequentialImageGeneration !== void 0) body["sequential_image_generation"] = options.sequentialImageGeneration;
|
|
1934
|
+
if (options.sequentialImageGenerationOptions !== void 0) body["sequential_image_generation_options"] = options.sequentialImageGenerationOptions;
|
|
1935
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1936
|
+
if (!["async", "callbackUrl", "guidanceScale", "image", "maxWait", "model", "optimizePromptOptions", "outputFormat", "pollInterval", "prompt", "responseFormat", "seed", "sequentialImageGeneration", "sequentialImageGenerationOptions", "size", "stream", "tools", "wait", "watermark"].includes(key) && value !== void 0) {
|
|
1937
|
+
body[key] = value;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
1941
|
+
body.async = options.async ?? true;
|
|
1942
|
+
const result = await this.transport.request("POST", "/seedream/images", { json: body });
|
|
1943
|
+
const handle = new TaskHandle(taskId11(result), "/seedream/tasks", this.transport, result);
|
|
1944
|
+
if (options.wait) {
|
|
1945
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
1946
|
+
}
|
|
1947
|
+
return handle;
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
// src/resources/providers/suno.ts
|
|
1952
|
+
function taskId12(result) {
|
|
1953
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
1954
|
+
const data = result?.data;
|
|
1955
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
1956
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
1957
|
+
}
|
|
1958
|
+
var Suno = class {
|
|
1959
|
+
constructor(transport) {
|
|
1960
|
+
this.transport = transport;
|
|
1961
|
+
}
|
|
1962
|
+
transport;
|
|
1963
|
+
/** Suno AI music generation API, generates 2 songs per request with extension support. */
|
|
1964
|
+
async generate(options = {}) {
|
|
1965
|
+
const body = {};
|
|
1966
|
+
if (options.lyric !== void 0) body["lyric"] = options.lyric;
|
|
1967
|
+
body["model"] = options.model ?? "chirp-v5-5";
|
|
1968
|
+
if (options.style !== void 0) body["style"] = options.style;
|
|
1969
|
+
if (options.title !== void 0) body["title"] = options.title;
|
|
1970
|
+
body["action"] = options.action ?? "generate";
|
|
1971
|
+
if (options.custom !== void 0) body["custom"] = options.custom;
|
|
1972
|
+
body["prompt"] = options.prompt ?? "A song for Christmas";
|
|
1973
|
+
if (options.audioId !== void 0) body["audio_id"] = options.audioId;
|
|
1974
|
+
if (options.weirdness !== void 0) body["weirdness"] = options.weirdness;
|
|
1975
|
+
body["audio_urls"] = options.audioUrls ?? ["https://cdn1.suno.ai/b481b17a-bf50-4e10-8adc-4d5635050893.mp3"];
|
|
1976
|
+
if (options.personaId !== void 0) body["persona_id"] = options.personaId;
|
|
1977
|
+
if (options.continueAt !== void 0) body["continue_at"] = options.continueAt;
|
|
1978
|
+
if (options.samplesEnd !== void 0) body["samples_end"] = options.samplesEnd;
|
|
1979
|
+
if (options.audioWeight !== void 0) body["audio_weight"] = options.audioWeight;
|
|
1980
|
+
if (options.instrumental !== void 0) body["instrumental"] = options.instrumental;
|
|
1981
|
+
if (options.lyricPrompt !== void 0) body["lyric_prompt"] = options.lyricPrompt;
|
|
1982
|
+
if (options.vocalGender !== void 0) body["vocal_gender"] = options.vocalGender;
|
|
1983
|
+
if (options.samplesStart !== void 0) body["samples_start"] = options.samplesStart;
|
|
1984
|
+
if (options.styleNegative !== void 0) body["style_negative"] = options.styleNegative;
|
|
1985
|
+
if (options.styleInfluence !== void 0) body["style_influence"] = options.styleInfluence;
|
|
1986
|
+
if (options.mashupAudioIds !== void 0) body["mashup_audio_ids"] = options.mashupAudioIds;
|
|
1987
|
+
if (options.overpaintingEnd !== void 0) body["overpainting_end"] = options.overpaintingEnd;
|
|
1988
|
+
if (options.underpaintingEnd !== void 0) body["underpainting_end"] = options.underpaintingEnd;
|
|
1989
|
+
if (options.overpaintingStart !== void 0) body["overpainting_start"] = options.overpaintingStart;
|
|
1990
|
+
if (options.variationCategory !== void 0) body["variation_category"] = options.variationCategory;
|
|
1991
|
+
if (options.replaceSectionEnd !== void 0) body["replace_section_end"] = options.replaceSectionEnd;
|
|
1992
|
+
if (options.underpaintingStart !== void 0) body["underpainting_start"] = options.underpaintingStart;
|
|
1993
|
+
if (options.replaceSectionStart !== void 0) body["replace_section_start"] = options.replaceSectionStart;
|
|
1994
|
+
for (const [key, value] of Object.entries(options)) {
|
|
1995
|
+
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 !== void 0) {
|
|
1996
|
+
body[key] = value;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2000
|
+
body.async = options.async ?? true;
|
|
2001
|
+
const result = await this.transport.request("POST", "/suno/audios", { json: body });
|
|
2002
|
+
const handle = new TaskHandle(taskId12(result), "/suno/tasks", this.transport, result);
|
|
2003
|
+
if (options.wait) {
|
|
2004
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
2005
|
+
}
|
|
2006
|
+
return handle;
|
|
2007
|
+
}
|
|
2008
|
+
/** Suno singer style API, set song style based on a generated song ID. */
|
|
2009
|
+
async persona(options) {
|
|
2010
|
+
const body = {};
|
|
2011
|
+
body["name"] = options.name;
|
|
2012
|
+
body["audio_id"] = options.audioId;
|
|
2013
|
+
if (options.vocalEnd !== void 0) body["vocal_end"] = options.vocalEnd;
|
|
2014
|
+
if (options.description !== void 0) body["description"] = options.description;
|
|
2015
|
+
if (options.vocalStart !== void 0) body["vocal_start"] = options.vocalStart;
|
|
2016
|
+
if (options.voxAudioId !== void 0) body["vox_audio_id"] = options.voxAudioId;
|
|
2017
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2018
|
+
if (!["async", "audioId", "callbackUrl", "description", "maxWait", "name", "pollInterval", "vocalEnd", "vocalStart", "voxAudioId", "wait"].includes(key) && value !== void 0) {
|
|
2019
|
+
body[key] = value;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2023
|
+
return await this.transport.request("POST", "/suno/persona", { json: body });
|
|
2024
|
+
}
|
|
2025
|
+
/** Suno MP4 API, get MP4 file link via audio_id. */
|
|
2026
|
+
async mp4(options) {
|
|
2027
|
+
const body = {};
|
|
2028
|
+
body["audio_id"] = options.audioId;
|
|
2029
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2030
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
2031
|
+
body[key] = value;
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2035
|
+
return await this.transport.request("POST", "/suno/mp4", { json: body });
|
|
2036
|
+
}
|
|
2037
|
+
/** Suno Voice Clone API. Create a custom voice persona from an uploaded audio file for voice cloning in music generation. */
|
|
2038
|
+
async voices(options) {
|
|
2039
|
+
const body = {};
|
|
2040
|
+
body["audio_url"] = options.audioUrl;
|
|
2041
|
+
if (options.name !== void 0) body["name"] = options.name;
|
|
2042
|
+
if (options.description !== void 0) body["description"] = options.description;
|
|
2043
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2044
|
+
if (!["async", "audioUrl", "callbackUrl", "description", "maxWait", "name", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
2045
|
+
body[key] = value;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2049
|
+
return await this.transport.request("POST", "/suno/voices", { json: body });
|
|
2050
|
+
}
|
|
2051
|
+
/** Suno timeline API, get lyrics and audio timeline of generated music. */
|
|
2052
|
+
async timing(options) {
|
|
2053
|
+
const body = {};
|
|
2054
|
+
body["audio_id"] = options.audioId;
|
|
2055
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2056
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
2057
|
+
body[key] = value;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2061
|
+
return await this.transport.request("POST", "/suno/timing", { json: body });
|
|
2062
|
+
}
|
|
2063
|
+
/** Suno vocal/instrumental stems API. Pass an audio_id to asynchronously produce vocal-only and instrumental-only stem files for remixing and creative reuse. */
|
|
2064
|
+
async vox(options) {
|
|
2065
|
+
const body = {};
|
|
2066
|
+
body["audio_id"] = options.audioId;
|
|
2067
|
+
if (options.vocalEnd !== void 0) body["vocal_end"] = options.vocalEnd;
|
|
2068
|
+
if (options.vocalStart !== void 0) body["vocal_start"] = options.vocalStart;
|
|
2069
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2070
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "vocalEnd", "vocalStart", "wait"].includes(key) && value !== void 0) {
|
|
2071
|
+
body[key] = value;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2075
|
+
body.async = options.async ?? true;
|
|
2076
|
+
const result = await this.transport.request("POST", "/suno/vox", { json: body });
|
|
2077
|
+
const handle = new TaskHandle(taskId12(result), "/suno/tasks", this.transport, result);
|
|
2078
|
+
if (options.wait) {
|
|
2079
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
2080
|
+
}
|
|
2081
|
+
return handle;
|
|
2082
|
+
}
|
|
2083
|
+
/** SUNO allows generating higher quality wav files based on the existing audio_id. */
|
|
2084
|
+
async wav(options) {
|
|
2085
|
+
const body = {};
|
|
2086
|
+
body["audio_id"] = options.audioId;
|
|
2087
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2088
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
2089
|
+
body[key] = value;
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2093
|
+
body.async = options.async ?? true;
|
|
2094
|
+
const result = await this.transport.request("POST", "/suno/wav", { json: body });
|
|
2095
|
+
const handle = new TaskHandle(taskId12(result), "/suno/tasks", this.transport, result);
|
|
2096
|
+
if (options.wait) {
|
|
2097
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
2098
|
+
}
|
|
2099
|
+
return handle;
|
|
2100
|
+
}
|
|
2101
|
+
/** Suno MIDI API, retrieve MIDI data from generated music. */
|
|
2102
|
+
async midi(options) {
|
|
2103
|
+
const body = {};
|
|
2104
|
+
body["audio_id"] = options.audioId;
|
|
2105
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2106
|
+
if (!["async", "audioId", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
2107
|
+
body[key] = value;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2111
|
+
body.async = options.async ?? true;
|
|
2112
|
+
const result = await this.transport.request("POST", "/suno/midi", { json: body });
|
|
2113
|
+
const handle = new TaskHandle(taskId12(result), "/suno/tasks", this.transport, result);
|
|
2114
|
+
if (options.wait) {
|
|
2115
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
2116
|
+
}
|
|
2117
|
+
return handle;
|
|
2118
|
+
}
|
|
2119
|
+
/** SUNO allows us to input prompts to generate enhanced song styles. */
|
|
2120
|
+
async style(options) {
|
|
2121
|
+
const body = {};
|
|
2122
|
+
body["prompt"] = options.prompt;
|
|
2123
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2124
|
+
if (!["async", "callbackUrl", "maxWait", "pollInterval", "prompt", "wait"].includes(key) && value !== void 0) {
|
|
2125
|
+
body[key] = value;
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2129
|
+
return await this.transport.request("POST", "/suno/style", { json: body });
|
|
2130
|
+
}
|
|
2131
|
+
/** Suno lyrics generation API. Generates structured song lyrics from a prompt; supports the default and remi-v1 models. */
|
|
2132
|
+
async lyrics(options) {
|
|
2133
|
+
const body = {};
|
|
2134
|
+
body["model"] = options.model;
|
|
2135
|
+
body["prompt"] = options.prompt;
|
|
2136
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2137
|
+
if (!["async", "callbackUrl", "maxWait", "model", "pollInterval", "prompt", "wait"].includes(key) && value !== void 0) {
|
|
2138
|
+
body[key] = value;
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2142
|
+
return await this.transport.request("POST", "/suno/lyrics", { json: body });
|
|
2143
|
+
}
|
|
2144
|
+
/** Suno mashup lyrics API, merge two lyrics into a blended version. */
|
|
2145
|
+
async mashup_lyrics(options) {
|
|
2146
|
+
const body = {};
|
|
2147
|
+
body["lyrics_a"] = options.lyricsA;
|
|
2148
|
+
body["lyrics_b"] = options.lyricsB;
|
|
2149
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2150
|
+
if (!["async", "callbackUrl", "lyricsA", "lyricsB", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
2151
|
+
body[key] = value;
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2155
|
+
return await this.transport.request("POST", "/suno/mashup-lyrics", { json: body });
|
|
2156
|
+
}
|
|
2157
|
+
/** Suno reference audio upload API, upload audio to get an audio_id for extended generation. */
|
|
2158
|
+
async upload(options) {
|
|
2159
|
+
const body = {};
|
|
2160
|
+
body["audio_url"] = options.audioUrl;
|
|
2161
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2162
|
+
if (!["async", "audioUrl", "callbackUrl", "maxWait", "pollInterval", "wait"].includes(key) && value !== void 0) {
|
|
2163
|
+
body[key] = value;
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2167
|
+
return await this.transport.request("POST", "/suno/upload", { json: body });
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
2170
|
+
|
|
2171
|
+
// src/resources/providers/wan.ts
|
|
2172
|
+
function taskId13(result) {
|
|
2173
|
+
if (typeof result?.task_id === "string") return result.task_id;
|
|
2174
|
+
const data = result?.data;
|
|
2175
|
+
if (data && typeof data.task_id === "string") return data.task_id;
|
|
2176
|
+
return typeof result?.id === "string" ? result.id : "";
|
|
2177
|
+
}
|
|
2178
|
+
var Wan = class {
|
|
2179
|
+
constructor(transport) {
|
|
2180
|
+
this.transport = transport;
|
|
2181
|
+
}
|
|
2182
|
+
transport;
|
|
2183
|
+
/** Generate videos based on prompt and image frames */
|
|
2184
|
+
async generate(options) {
|
|
2185
|
+
const body = {};
|
|
2186
|
+
body["model"] = options.model;
|
|
2187
|
+
body["action"] = options.action;
|
|
2188
|
+
body["prompt"] = options.prompt;
|
|
2189
|
+
if (options.size !== void 0) body["size"] = options.size;
|
|
2190
|
+
body["audio"] = options.audio ?? false;
|
|
2191
|
+
if (options.duration !== void 0) body["duration"] = options.duration;
|
|
2192
|
+
if (options.audioUrl !== void 0) body["audio_url"] = options.audioUrl;
|
|
2193
|
+
body["image_url"] = options.imageUrl ?? "https://cdn.acedata.cloud/r9vsv9.png";
|
|
2194
|
+
if (options.shotType !== void 0) body["shot_type"] = options.shotType;
|
|
2195
|
+
if (options.resolution !== void 0) body["resolution"] = options.resolution;
|
|
2196
|
+
body["prompt_extend"] = options.promptExtend ?? false;
|
|
2197
|
+
body["negative_prompt"] = options.negativePrompt ?? "Astronauts shuttle from space to volcano";
|
|
2198
|
+
if (options.referenceVideoUrls !== void 0) body["reference_video_urls"] = options.referenceVideoUrls;
|
|
2199
|
+
for (const [key, value] of Object.entries(options)) {
|
|
2200
|
+
if (!["action", "async", "audio", "audioUrl", "callbackUrl", "duration", "imageUrl", "maxWait", "model", "negativePrompt", "pollInterval", "prompt", "promptExtend", "referenceVideoUrls", "resolution", "shotType", "size", "wait"].includes(key) && value !== void 0) {
|
|
2201
|
+
body[key] = value;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
if (options.callbackUrl !== void 0) body.callback_url = options.callbackUrl;
|
|
2205
|
+
body.async = options.async ?? true;
|
|
2206
|
+
const result = await this.transport.request("POST", "/wan/videos", { json: body });
|
|
2207
|
+
const handle = new TaskHandle(taskId13(result), "/wan/tasks", this.transport, result);
|
|
2208
|
+
if (options.wait) {
|
|
2209
|
+
await handle.wait({ pollInterval: options.pollInterval, maxWait: options.maxWait });
|
|
2210
|
+
}
|
|
2211
|
+
return handle;
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
2214
|
+
|
|
2215
|
+
// src/resources/providers/index.ts
|
|
2216
|
+
function attachProviders(client, transport) {
|
|
2217
|
+
client.digitalhuman = new Digitalhuman(transport);
|
|
2218
|
+
client.dreamina = new Dreamina(transport);
|
|
2219
|
+
client.fish = new Fish(transport);
|
|
2220
|
+
client.flux = new Flux(transport);
|
|
2221
|
+
client.hailuo = new Hailuo(transport);
|
|
2222
|
+
client.happyhorse = new Happyhorse(transport);
|
|
2223
|
+
client.localization = new Localization(transport);
|
|
2224
|
+
client.luma = new Luma(transport);
|
|
2225
|
+
client.maestro = new Maestro(transport);
|
|
2226
|
+
client.nanobanana = new NanoBanana(transport);
|
|
2227
|
+
client.producer = new Producer(transport);
|
|
2228
|
+
client.seedance = new Seedance(transport);
|
|
2229
|
+
client.seedream = new Seedream(transport);
|
|
2230
|
+
client.suno = new Suno(transport);
|
|
2231
|
+
client.wan = new Wan(transport);
|
|
2232
|
+
}
|
|
2233
|
+
|
|
1260
2234
|
// src/client.ts
|
|
1261
2235
|
var AceDataCloud = class {
|
|
1262
2236
|
aichat;
|
|
@@ -1302,6 +2276,7 @@ var AceDataCloud = class {
|
|
|
1302
2276
|
this.webextrator = new WebExtrator(this.transport);
|
|
1303
2277
|
this.face = new Face(this.transport);
|
|
1304
2278
|
this.shorturl = new ShortUrl(this.transport);
|
|
2279
|
+
attachProviders(this, this.transport);
|
|
1305
2280
|
}
|
|
1306
2281
|
};
|
|
1307
2282
|
export {
|