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