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