seacloud-sdk 0.10.2 → 0.11.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
@@ -9,7 +9,51 @@ var SeacloudError = class extends Error {
9
9
  };
10
10
 
11
11
  // src/core/config.ts
12
- function getApiToken(providedApiKey) {
12
+ function isInIframe() {
13
+ try {
14
+ return typeof globalThis.window !== "undefined" && globalThis.window.self !== globalThis.window.top;
15
+ } catch (e) {
16
+ return true;
17
+ }
18
+ }
19
+ async function getTokenFromParent(timeout = 5e3) {
20
+ if (!isInIframe()) {
21
+ return null;
22
+ }
23
+ return new Promise((resolve) => {
24
+ const messageHandler = (event) => {
25
+ if (event.data && event.data.type === "seaverse:token") {
26
+ cleanup();
27
+ const token = event.data.payload?.accessToken;
28
+ resolve(token || null);
29
+ } else if (event.data && event.data.type === "seaverse:error") {
30
+ cleanup();
31
+ console.warn("[SeaCloud SDK] Error getting token from parent:", event.data.error);
32
+ resolve(null);
33
+ }
34
+ };
35
+ const timeoutId = setTimeout(() => {
36
+ cleanup();
37
+ resolve(null);
38
+ }, timeout);
39
+ const cleanup = () => {
40
+ clearTimeout(timeoutId);
41
+ globalThis.window.removeEventListener("message", messageHandler);
42
+ };
43
+ globalThis.window.addEventListener("message", messageHandler);
44
+ try {
45
+ globalThis.window.parent.postMessage(
46
+ { type: "seaverse:get_token" },
47
+ "*"
48
+ // 允许任何源,支持跨域场景
49
+ );
50
+ } catch (e) {
51
+ cleanup();
52
+ resolve(null);
53
+ }
54
+ });
55
+ }
56
+ async function getApiToken(providedApiKey) {
13
57
  if (providedApiKey) {
14
58
  return providedApiKey;
15
59
  }
@@ -25,23 +69,27 @@ function getApiToken(providedApiKey) {
25
69
  if (typeof process !== "undefined" && process.env?.API_SERVICE_TOKEN) {
26
70
  return process.env.API_SERVICE_TOKEN;
27
71
  }
28
- throw new Error(
29
- 'SeaCloud SDK: No API token found. Please ensure token is available in localStorage.getItem("auth_token") (browser) or process.env.API_SERVICE_TOKEN (Node.js), or initialize with initSeacloud({ apiKey: "your-token" }).'
30
- );
72
+ if (typeof globalThis.window !== "undefined") {
73
+ const parentToken = await getTokenFromParent();
74
+ if (parentToken) {
75
+ return parentToken;
76
+ }
77
+ }
78
+ return "";
31
79
  }
32
80
  function createConfig(options = {}) {
33
- const apiKey = getApiToken(options.apiKey);
81
+ const apiKey = options.apiKey;
34
82
  const baseUrl = options.baseUrl || (typeof process !== "undefined" ? process.env?.SEACLOUD_BASE_URL : void 0) || "https://proxy-rs.seaverse.ai";
35
83
  const fetchImpl = options.fetch || (globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0);
36
84
  if (!fetchImpl) {
37
85
  throw new Error("fetch is not available. Please provide a fetch implementation in config or upgrade to Node.js 18+");
38
86
  }
39
87
  return {
40
- apiKey,
88
+ apiKey: apiKey || "",
89
+ // 提供默认空字符串,实际请求时会动态获取
41
90
  baseUrl,
42
91
  fetch: fetchImpl,
43
- timeout: options.timeout || 3e4,
44
- xProject: options.xProject || "SeaVerse"
92
+ timeout: options.timeout || 3e4
45
93
  };
46
94
  }
47
95
  function validateConfig(config) {
@@ -83,7 +131,7 @@ var SeacloudClient = class {
83
131
  */
84
132
  async createTask(endpoint, body) {
85
133
  const url = `${this.config.baseUrl}${endpoint}`;
86
- const currentToken = getApiToken(this.providedApiKey);
134
+ const currentToken = await getApiToken(this.providedApiKey);
87
135
  const controller = new AbortController();
88
136
  const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
89
137
  try {
@@ -130,7 +178,7 @@ var SeacloudClient = class {
130
178
  */
131
179
  async getTaskStatus(endpoint, taskId) {
132
180
  const url = `${this.config.baseUrl}${endpoint}/task/${taskId}`;
133
- const currentToken = getApiToken(this.providedApiKey);
181
+ const currentToken = await getApiToken(this.providedApiKey);
134
182
  const controller = new AbortController();
135
183
  const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
136
184
  try {
@@ -201,8 +249,7 @@ function initSeacloud(apiKeyOrConfig, options) {
201
249
  globalConfig.client = new SeacloudClient({
202
250
  apiKey: apiKey || "",
203
251
  baseUrl: config.baseUrl,
204
- timeout: config.timeout,
205
- xProject: config.xProject
252
+ timeout: config.timeout
206
253
  });
207
254
  if (config.intervalMs !== void 0) {
208
255
  globalConfig.defaultPollingOptions.intervalMs = config.intervalMs;
@@ -286,6 +333,12 @@ async function createAndWaitTask(client, endpoint, body, options = {}) {
286
333
  return pollTaskUntilComplete(client, endpoint, task.id, options);
287
334
  }
288
335
 
336
+ // src/core/index.ts
337
+ async function getTaskStatus(endpoint, taskId) {
338
+ const client = getClient();
339
+ return client.getTaskStatus(endpoint, taskId);
340
+ }
341
+
289
342
  // src/api/alibaba_animate_anyone_detect.ts
290
343
  async function alibabaAnimateAnyoneDetect(params) {
291
344
  const client = getClient();
@@ -3830,17 +3883,14 @@ async function appSearch(params) {
3830
3883
  const timeoutId = setTimeout(() => controller.abort(), config.timeout);
3831
3884
  try {
3832
3885
  const requestId = `req-${Date.now()}-${Math.random().toString(36).substring(7)}`;
3833
- const headers = {
3834
- "Content-Type": "application/json",
3835
- "Authorization": `Bearer ${config.apiKey}`,
3836
- "X-Request-Id": requestId
3837
- };
3838
- if (config.xProject) {
3839
- headers["X-Project"] = config.xProject;
3840
- }
3841
3886
  const response = await config.fetch(url, {
3842
3887
  method: "POST",
3843
- headers,
3888
+ headers: {
3889
+ "Content-Type": "application/json",
3890
+ "Authorization": `Bearer ${config.apiKey}`,
3891
+ "X-Request-Id": requestId,
3892
+ "X-Project": "KIIRA"
3893
+ },
3844
3894
  body: JSON.stringify(params),
3845
3895
  signal: controller.signal
3846
3896
  });
@@ -5086,6 +5136,7 @@ async function llmChatCompletions(params) {
5086
5136
  const client = getClient();
5087
5137
  const config = client.getConfig();
5088
5138
  const url = `${config.baseUrl}/llm/chat/completions`;
5139
+ const token = await getApiToken(config.apiKey);
5089
5140
  const controller = new AbortController();
5090
5141
  const timeoutId = setTimeout(() => controller.abort(), config.timeout);
5091
5142
  try {
@@ -5093,7 +5144,7 @@ async function llmChatCompletions(params) {
5093
5144
  method: "POST",
5094
5145
  headers: {
5095
5146
  "Content-Type": "application/json",
5096
- "Authorization": `Bearer ${config.apiKey}`
5147
+ "Authorization": `Bearer ${token}`
5097
5148
  },
5098
5149
  body: JSON.stringify(params),
5099
5150
  signal: controller.signal
@@ -5179,16 +5230,14 @@ async function agentChatCompletions(params) {
5179
5230
  const controller = new AbortController();
5180
5231
  const timeoutId = setTimeout(() => controller.abort(), config.timeout);
5181
5232
  try {
5182
- const headers = {
5183
- "Content-Type": "application/json",
5184
- "Authorization": `Bearer ${config.apiKey}`
5185
- };
5186
- if (config.xProject) {
5187
- headers["X-Project"] = config.xProject;
5188
- }
5189
5233
  const response = await config.fetch(url, {
5190
5234
  method: "POST",
5191
- headers,
5235
+ headers: {
5236
+ "Content-Type": "application/json",
5237
+ "Authorization": `Bearer ${config.apiKey}`,
5238
+ "X-Project": "SeaArt"
5239
+ // Required header for agent API
5240
+ },
5192
5241
  body: JSON.stringify(requestBody),
5193
5242
  signal: controller.signal
5194
5243
  });
@@ -5418,6 +5467,598 @@ async function appGeneration(params) {
5418
5467
  return result;
5419
5468
  }
5420
5469
 
5421
- export { SeacloudClient, SeacloudError, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, appGeneration, appSearch, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, googleGemini3ProImage, googleGeminiImage, googleImagen4FastGenerate, googleImagen4Generate, googleImagen4UltraGenerate, googleVeo20Generate001, googleVeo20GenerateExp, googleVeo20GeneratePreview, googleVeo30FastGenerate001, googleVeo30Generate001, googleVeo31, initSeacloud, klingAvatar, klingDurationExtension, klingEffectsMultiV1, klingEffectsMultiV15, klingEffectsMultiV16, klingEffectsSingle, klingLipsync, klingOmniImage, klingOmniVideo, klingV1, klingV15, klingV15I2v, klingV16, klingV16I2v, klingV1I2v, klingV21I2v, klingV21Master, klingV21MasterI2v, klingV25Turbo, klingV25TurboI2v, klingV26, klingV26I2v, klingV2Master, klingV2MasterI2v, llmChatCompletions, microsoftGptImage1, microsoftGptImage15, microsoftSora2, minimaxHailuo02, minimaxHailuo02I2v, minimaxHailuo23FastI2v, minimaxHailuo23I2v, minimaxI2v01, minimaxI2v01Director, minimaxI2v01Live, minimaxT2a, minimaxT2v01, minimaxT2v01Director, pixverseV35I2v, pixverseV35T2v, pixverseV35Transition, pixverseV45I2v, pixverseV45T2v, pixverseV45Transition, pixverseV4I2v, pixverseV4T2v, pixverseV4Transition, pixverseV55I2v, pixverseV55T2v, pixverseV55Transition, pixverseV5I2v, pixverseV5T2v, pixverseV5Transition, pollTaskUntilComplete, resetConfig, runwayGen3aTurboI2v, setDefaultPollingOptions, templateSpecs, tencentHunyuan3d, tencentHunyuan3dPro, tencentHunyuan3dRapid, tencentImageCreation3, tencentMpsSuperResolution, validateConfig, vidu15, vidu15I2v, vidu20I2v, viduQ1, viduQ1I2v, viduQ2, viduTemplate, viduTemplateV2, volcesJimeng30, volcesJimeng31, volcesJimengDreamActorM1, volcesJimengI2i30, volcesRealmanAvatarImitatorV2v, volcesRealmanAvatarPictureOmniV15, volcesRealmanAvatarPictureOmniV2, volcesSeed3d, volcesSeedance30, volcesSeedance30I2v, volcesSeedance30Pro, volcesSeedanceProFast, volcesSeededit20, volcesSeededit30, volcesSeededit30I2i, volcesSeededit3dStyle, volcesSeededitMultiIp, volcesSeededitMultiStyle, volcesSeededitPortrait, volcesSeededitSingleIp, volcesSeedream30, volcesSeedream40, volcesSeedream45, volcesSeedream45I2i, volcesSeedream45MultiBlend, volcesSubjectDetection, volcesSubjectRecognition };
5470
+ // src/api/scan.ts
5471
+ async function scan(params) {
5472
+ if (!params.uri && !params.img_base64) {
5473
+ throw new SeacloudError("\u5FC5\u987B\u63D0\u4F9B uri \u6216 img_base64 \u4E2D\u7684\u81F3\u5C11\u4E00\u4E2A\u53C2\u6570");
5474
+ }
5475
+ if (params.is_video === 1 && params.img_base64) {
5476
+ throw new SeacloudError("\u89C6\u9891\u68C0\u6D4B\u4E0D\u652F\u6301 base64 \u8F93\u5165\uFF0C\u5FC5\u987B\u4F7F\u7528 uri \u53C2\u6570");
5477
+ }
5478
+ if (!params.risk_types || params.risk_types.length === 0) {
5479
+ throw new SeacloudError("\u5FC5\u987B\u63D0\u4F9B\u81F3\u5C11\u4E00\u4E2A\u98CE\u9669\u7C7B\u578B");
5480
+ }
5481
+ const client = getClient();
5482
+ const config = client.getConfig();
5483
+ const url = `${config.baseUrl}/scan`;
5484
+ const token = await getApiToken(config.apiKey);
5485
+ const controller = new AbortController();
5486
+ const timeoutId = setTimeout(() => controller.abort(), config.timeout);
5487
+ try {
5488
+ const response = await config.fetch(url, {
5489
+ method: "POST",
5490
+ headers: {
5491
+ "Content-Type": "application/json",
5492
+ "Authorization": `Bearer ${token}`
5493
+ },
5494
+ body: JSON.stringify(params),
5495
+ signal: controller.signal
5496
+ });
5497
+ clearTimeout(timeoutId);
5498
+ if (!response.ok) {
5499
+ const errorBody = await response.text();
5500
+ throw new SeacloudError(
5501
+ `HTTP ${response.status}: ${errorBody}`,
5502
+ response.status,
5503
+ errorBody
5504
+ );
5505
+ }
5506
+ const responseData = await response.json();
5507
+ let result;
5508
+ if (responseData.success !== void 0 && responseData.data) {
5509
+ result = responseData.data;
5510
+ } else {
5511
+ result = responseData;
5512
+ }
5513
+ if (!result.ok) {
5514
+ throw new SeacloudError(
5515
+ `\u5185\u5BB9\u5B89\u5168\u68C0\u6D4B\u4E1A\u52A1\u9519\u8BEF: ${result.error || "\u672A\u77E5\u9519\u8BEF"}`,
5516
+ void 0,
5517
+ result
5518
+ );
5519
+ }
5520
+ return result;
5521
+ } catch (error) {
5522
+ clearTimeout(timeoutId);
5523
+ if (error instanceof SeacloudError) {
5524
+ throw error;
5525
+ }
5526
+ if (error.name === "AbortError") {
5527
+ throw new SeacloudError(`Request timeout after ${config.timeout}ms`);
5528
+ }
5529
+ throw new SeacloudError(
5530
+ `Request failed: ${error.message}`,
5531
+ void 0,
5532
+ error
5533
+ );
5534
+ }
5535
+ }
5536
+
5537
+ // src/api/youchuan_diffusion.ts
5538
+ async function youchuanDiffusion(params) {
5539
+ const client = getClient();
5540
+ const pollingOptions = {
5541
+ intervalMs: 3e3,
5542
+ maxAttempts: 60
5543
+ };
5544
+ const result = await createAndWaitTask(
5545
+ client,
5546
+ "/model/v1/generation",
5547
+ {
5548
+ model: "youchuan_diffusion",
5549
+ input: [{ params }]
5550
+ },
5551
+ pollingOptions
5552
+ );
5553
+ const resources = [];
5554
+ if (result.output) {
5555
+ for (const item of result.output) {
5556
+ if (item.content) {
5557
+ for (const resource of item.content) {
5558
+ resources.push({
5559
+ type: resource.type || "unknown",
5560
+ url: resource.url || "",
5561
+ size: resource.size,
5562
+ jobId: resource.jobId,
5563
+ ...resource
5564
+ });
5565
+ }
5566
+ }
5567
+ }
5568
+ }
5569
+ return resources;
5570
+ }
5571
+
5572
+ // src/api/youchuan_edit.ts
5573
+ async function youchuanEdit(params) {
5574
+ const client = getClient();
5575
+ const pollingOptions = {
5576
+ intervalMs: 3e3,
5577
+ maxAttempts: 60
5578
+ };
5579
+ const result = await createAndWaitTask(
5580
+ client,
5581
+ "/model/v1/generation",
5582
+ {
5583
+ model: "youchuan_edit",
5584
+ input: [{ params }]
5585
+ },
5586
+ pollingOptions
5587
+ );
5588
+ const resources = [];
5589
+ if (result.output) {
5590
+ for (const item of result.output) {
5591
+ if (item.content) {
5592
+ for (const resource of item.content) {
5593
+ resources.push({
5594
+ type: resource.type || "unknown",
5595
+ url: resource.url || "",
5596
+ size: resource.size,
5597
+ jobId: resource.jobId,
5598
+ ...resource
5599
+ });
5600
+ }
5601
+ }
5602
+ }
5603
+ }
5604
+ return resources;
5605
+ }
5606
+
5607
+ // src/api/youchuan_enhance.ts
5608
+ async function youchuanEnhance(params) {
5609
+ const client = getClient();
5610
+ const pollingOptions = {
5611
+ intervalMs: 3e3,
5612
+ maxAttempts: 60
5613
+ };
5614
+ const result = await createAndWaitTask(
5615
+ client,
5616
+ "/model/v1/generation",
5617
+ {
5618
+ model: "youchuan_enhance",
5619
+ input: [{ params }]
5620
+ },
5621
+ pollingOptions
5622
+ );
5623
+ const resources = [];
5624
+ if (result.output) {
5625
+ for (const item of result.output) {
5626
+ if (item.content) {
5627
+ for (const resource of item.content) {
5628
+ resources.push({
5629
+ type: resource.type || "unknown",
5630
+ url: resource.url || "",
5631
+ size: resource.size,
5632
+ jobId: resource.jobId,
5633
+ ...resource
5634
+ });
5635
+ }
5636
+ }
5637
+ }
5638
+ }
5639
+ return resources;
5640
+ }
5641
+
5642
+ // src/api/youchuan_extend_video.ts
5643
+ async function youchuanExtendVideo(params) {
5644
+ const client = getClient();
5645
+ const pollingOptions = {
5646
+ intervalMs: 3e3,
5647
+ maxAttempts: 60
5648
+ };
5649
+ const result = await createAndWaitTask(
5650
+ client,
5651
+ "/model/v1/generation",
5652
+ {
5653
+ model: "youchuan_extend_video",
5654
+ input: [{ params }]
5655
+ },
5656
+ pollingOptions
5657
+ );
5658
+ const resources = [];
5659
+ if (result.output) {
5660
+ for (const item of result.output) {
5661
+ if (item.content) {
5662
+ for (const resource of item.content) {
5663
+ resources.push({
5664
+ type: resource.type || "unknown",
5665
+ url: resource.url || "",
5666
+ size: resource.size,
5667
+ jobId: resource.jobId,
5668
+ ...resource
5669
+ });
5670
+ }
5671
+ }
5672
+ }
5673
+ }
5674
+ return resources;
5675
+ }
5676
+
5677
+ // src/api/youchuan_inpaint.ts
5678
+ async function youchuanInpaint(params) {
5679
+ const client = getClient();
5680
+ const pollingOptions = {
5681
+ intervalMs: 3e3,
5682
+ maxAttempts: 60
5683
+ };
5684
+ const result = await createAndWaitTask(
5685
+ client,
5686
+ "/model/v1/generation",
5687
+ {
5688
+ model: "youchuan_inpaint",
5689
+ input: [{ params }]
5690
+ },
5691
+ pollingOptions
5692
+ );
5693
+ const resources = [];
5694
+ if (result.output) {
5695
+ for (const item of result.output) {
5696
+ if (item.content) {
5697
+ for (const resource of item.content) {
5698
+ resources.push({
5699
+ type: resource.type || "unknown",
5700
+ url: resource.url || "",
5701
+ size: resource.size,
5702
+ jobId: resource.jobId,
5703
+ ...resource
5704
+ });
5705
+ }
5706
+ }
5707
+ }
5708
+ }
5709
+ return resources;
5710
+ }
5711
+
5712
+ // src/api/youchuan_outpaint.ts
5713
+ async function youchuanOutpaint(params) {
5714
+ const client = getClient();
5715
+ const pollingOptions = {
5716
+ intervalMs: 3e3,
5717
+ maxAttempts: 60
5718
+ };
5719
+ const result = await createAndWaitTask(
5720
+ client,
5721
+ "/model/v1/generation",
5722
+ {
5723
+ model: "youchuan_outpaint",
5724
+ input: [{ params }]
5725
+ },
5726
+ pollingOptions
5727
+ );
5728
+ const resources = [];
5729
+ if (result.output) {
5730
+ for (const item of result.output) {
5731
+ if (item.content) {
5732
+ for (const resource of item.content) {
5733
+ resources.push({
5734
+ type: resource.type || "unknown",
5735
+ url: resource.url || "",
5736
+ size: resource.size,
5737
+ jobId: resource.jobId,
5738
+ ...resource
5739
+ });
5740
+ }
5741
+ }
5742
+ }
5743
+ }
5744
+ return resources;
5745
+ }
5746
+
5747
+ // src/api/youchuan_pan.ts
5748
+ async function youchuanPan(params) {
5749
+ const client = getClient();
5750
+ const pollingOptions = {
5751
+ intervalMs: 3e3,
5752
+ maxAttempts: 60
5753
+ };
5754
+ const result = await createAndWaitTask(
5755
+ client,
5756
+ "/model/v1/generation",
5757
+ {
5758
+ model: "youchuan_pan",
5759
+ input: [{ params }]
5760
+ },
5761
+ pollingOptions
5762
+ );
5763
+ const resources = [];
5764
+ if (result.output) {
5765
+ for (const item of result.output) {
5766
+ if (item.content) {
5767
+ for (const resource of item.content) {
5768
+ resources.push({
5769
+ type: resource.type || "unknown",
5770
+ url: resource.url || "",
5771
+ size: resource.size,
5772
+ jobId: resource.jobId,
5773
+ ...resource
5774
+ });
5775
+ }
5776
+ }
5777
+ }
5778
+ }
5779
+ return resources;
5780
+ }
5781
+
5782
+ // src/api/youchuan_remix.ts
5783
+ async function youchuanRemix(params) {
5784
+ const client = getClient();
5785
+ const pollingOptions = {
5786
+ intervalMs: 3e3,
5787
+ maxAttempts: 60
5788
+ };
5789
+ const result = await createAndWaitTask(
5790
+ client,
5791
+ "/model/v1/generation",
5792
+ {
5793
+ model: "youchuan_remix",
5794
+ input: [{ params }]
5795
+ },
5796
+ pollingOptions
5797
+ );
5798
+ const resources = [];
5799
+ if (result.output) {
5800
+ for (const item of result.output) {
5801
+ if (item.content) {
5802
+ for (const resource of item.content) {
5803
+ resources.push({
5804
+ type: resource.type || "unknown",
5805
+ url: resource.url || "",
5806
+ size: resource.size,
5807
+ jobId: resource.jobId,
5808
+ ...resource
5809
+ });
5810
+ }
5811
+ }
5812
+ }
5813
+ }
5814
+ return resources;
5815
+ }
5816
+
5817
+ // src/api/youchuan_remove_background.ts
5818
+ async function youchuanRemoveBackground(params) {
5819
+ const client = getClient();
5820
+ const pollingOptions = {
5821
+ intervalMs: 3e3,
5822
+ maxAttempts: 60
5823
+ };
5824
+ const result = await createAndWaitTask(
5825
+ client,
5826
+ "/model/v1/generation",
5827
+ {
5828
+ model: "youchuan_remove_background",
5829
+ input: [{ params }]
5830
+ },
5831
+ pollingOptions
5832
+ );
5833
+ const resources = [];
5834
+ if (result.output) {
5835
+ for (const item of result.output) {
5836
+ if (item.content) {
5837
+ for (const resource of item.content) {
5838
+ resources.push({
5839
+ type: resource.type || "unknown",
5840
+ url: resource.url || "",
5841
+ size: resource.size,
5842
+ jobId: resource.jobId,
5843
+ ...resource
5844
+ });
5845
+ }
5846
+ }
5847
+ }
5848
+ }
5849
+ return resources;
5850
+ }
5851
+
5852
+ // src/api/youchuan_retexture.ts
5853
+ async function youchuanRetexture(params) {
5854
+ const client = getClient();
5855
+ const pollingOptions = {
5856
+ intervalMs: 3e3,
5857
+ maxAttempts: 60
5858
+ };
5859
+ const result = await createAndWaitTask(
5860
+ client,
5861
+ "/model/v1/generation",
5862
+ {
5863
+ model: "youchuan_retexture",
5864
+ input: [{ params }]
5865
+ },
5866
+ pollingOptions
5867
+ );
5868
+ const resources = [];
5869
+ if (result.output) {
5870
+ for (const item of result.output) {
5871
+ if (item.content) {
5872
+ for (const resource of item.content) {
5873
+ resources.push({
5874
+ type: resource.type || "unknown",
5875
+ url: resource.url || "",
5876
+ size: resource.size,
5877
+ jobId: resource.jobId,
5878
+ ...resource
5879
+ });
5880
+ }
5881
+ }
5882
+ }
5883
+ }
5884
+ return resources;
5885
+ }
5886
+
5887
+ // src/api/youchuan_uploadpaint.ts
5888
+ async function youchuanUploadpaint(params) {
5889
+ const client = getClient();
5890
+ const pollingOptions = {
5891
+ intervalMs: 3e3,
5892
+ maxAttempts: 60
5893
+ };
5894
+ const result = await createAndWaitTask(
5895
+ client,
5896
+ "/model/v1/generation",
5897
+ {
5898
+ model: "youchuan_uploadpaint",
5899
+ input: [{ params }]
5900
+ },
5901
+ pollingOptions
5902
+ );
5903
+ const resources = [];
5904
+ if (result.output) {
5905
+ for (const item of result.output) {
5906
+ if (item.content) {
5907
+ for (const resource of item.content) {
5908
+ resources.push({
5909
+ type: resource.type || "unknown",
5910
+ url: resource.url || "",
5911
+ size: resource.size,
5912
+ jobId: resource.jobId,
5913
+ ...resource
5914
+ });
5915
+ }
5916
+ }
5917
+ }
5918
+ }
5919
+ return resources;
5920
+ }
5921
+
5922
+ // src/api/youchuan_upscale.ts
5923
+ async function youchuanUpscale(params) {
5924
+ const client = getClient();
5925
+ const pollingOptions = {
5926
+ intervalMs: 3e3,
5927
+ maxAttempts: 60
5928
+ };
5929
+ const result = await createAndWaitTask(
5930
+ client,
5931
+ "/model/v1/generation",
5932
+ {
5933
+ model: "youchuan_upscale",
5934
+ input: [{ params }]
5935
+ },
5936
+ pollingOptions
5937
+ );
5938
+ const resources = [];
5939
+ if (result.output) {
5940
+ for (const item of result.output) {
5941
+ if (item.content) {
5942
+ for (const resource of item.content) {
5943
+ resources.push({
5944
+ type: resource.type || "unknown",
5945
+ url: resource.url || "",
5946
+ size: resource.size,
5947
+ jobId: resource.jobId,
5948
+ ...resource
5949
+ });
5950
+ }
5951
+ }
5952
+ }
5953
+ }
5954
+ return resources;
5955
+ }
5956
+
5957
+ // src/api/youchuan_variation.ts
5958
+ async function youchuanVariation(params) {
5959
+ const client = getClient();
5960
+ const pollingOptions = {
5961
+ intervalMs: 3e3,
5962
+ maxAttempts: 60
5963
+ };
5964
+ const result = await createAndWaitTask(
5965
+ client,
5966
+ "/model/v1/generation",
5967
+ {
5968
+ model: "youchuan_variation",
5969
+ input: [{ params }]
5970
+ },
5971
+ pollingOptions
5972
+ );
5973
+ const resources = [];
5974
+ if (result.output) {
5975
+ for (const item of result.output) {
5976
+ if (item.content) {
5977
+ for (const resource of item.content) {
5978
+ resources.push({
5979
+ type: resource.type || "unknown",
5980
+ url: resource.url || "",
5981
+ size: resource.size,
5982
+ jobId: resource.jobId,
5983
+ ...resource
5984
+ });
5985
+ }
5986
+ }
5987
+ }
5988
+ }
5989
+ return resources;
5990
+ }
5991
+
5992
+ // src/api/youchuan_video_diffusion.ts
5993
+ async function youchuanVideoDiffusion(params) {
5994
+ const client = getClient();
5995
+ const pollingOptions = {
5996
+ intervalMs: 3e3,
5997
+ maxAttempts: 60
5998
+ };
5999
+ const result = await createAndWaitTask(
6000
+ client,
6001
+ "/model/v1/generation",
6002
+ {
6003
+ model: "youchuan_video_diffusion",
6004
+ input: [{ params }]
6005
+ },
6006
+ pollingOptions
6007
+ );
6008
+ const resources = [];
6009
+ if (result.output) {
6010
+ for (const item of result.output) {
6011
+ if (item.content) {
6012
+ for (const resource of item.content) {
6013
+ resources.push({
6014
+ type: resource.type || "unknown",
6015
+ url: resource.url || "",
6016
+ size: resource.size,
6017
+ jobId: resource.jobId,
6018
+ ...resource
6019
+ });
6020
+ }
6021
+ }
6022
+ }
6023
+ }
6024
+ return resources;
6025
+ }
6026
+
6027
+ // src/api/youchuan_video_upscale.ts
6028
+ async function youchuanVideoUpscale(params) {
6029
+ const client = getClient();
6030
+ const pollingOptions = {
6031
+ intervalMs: 3e3,
6032
+ maxAttempts: 60
6033
+ };
6034
+ const result = await createAndWaitTask(
6035
+ client,
6036
+ "/model/v1/generation",
6037
+ {
6038
+ model: "youchuan_video_upscale",
6039
+ input: [{ params }]
6040
+ },
6041
+ pollingOptions
6042
+ );
6043
+ const resources = [];
6044
+ if (result.output) {
6045
+ for (const item of result.output) {
6046
+ if (item.content) {
6047
+ for (const resource of item.content) {
6048
+ resources.push({
6049
+ type: resource.type || "unknown",
6050
+ url: resource.url || "",
6051
+ size: resource.size,
6052
+ jobId: resource.jobId,
6053
+ ...resource
6054
+ });
6055
+ }
6056
+ }
6057
+ }
6058
+ }
6059
+ return resources;
6060
+ }
6061
+
6062
+ export { SeacloudClient, SeacloudError, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, appGeneration, appSearch, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, getTaskStatus, googleGemini3ProImage, googleGeminiImage, googleImagen4FastGenerate, googleImagen4Generate, googleImagen4UltraGenerate, googleVeo20Generate001, googleVeo20GenerateExp, googleVeo20GeneratePreview, googleVeo30FastGenerate001, googleVeo30Generate001, googleVeo31, initSeacloud, klingAvatar, klingDurationExtension, klingEffectsMultiV1, klingEffectsMultiV15, klingEffectsMultiV16, klingEffectsSingle, klingLipsync, klingOmniImage, klingOmniVideo, klingV1, klingV15, klingV15I2v, klingV16, klingV16I2v, klingV1I2v, klingV21I2v, klingV21Master, klingV21MasterI2v, klingV25Turbo, klingV25TurboI2v, klingV26, klingV26I2v, klingV2Master, klingV2MasterI2v, llmChatCompletions, microsoftGptImage1, microsoftGptImage15, microsoftSora2, minimaxHailuo02, minimaxHailuo02I2v, minimaxHailuo23FastI2v, minimaxHailuo23I2v, minimaxI2v01, minimaxI2v01Director, minimaxI2v01Live, minimaxT2a, minimaxT2v01, minimaxT2v01Director, pixverseV35I2v, pixverseV35T2v, pixverseV35Transition, pixverseV45I2v, pixverseV45T2v, pixverseV45Transition, pixverseV4I2v, pixverseV4T2v, pixverseV4Transition, pixverseV55I2v, pixverseV55T2v, pixverseV55Transition, pixverseV5I2v, pixverseV5T2v, pixverseV5Transition, pollTaskUntilComplete, resetConfig, runwayGen3aTurboI2v, scan, setDefaultPollingOptions, templateSpecs, tencentHunyuan3d, tencentHunyuan3dPro, tencentHunyuan3dRapid, tencentImageCreation3, tencentMpsSuperResolution, validateConfig, vidu15, vidu15I2v, vidu20I2v, viduQ1, viduQ1I2v, viduQ2, viduTemplate, viduTemplateV2, volcesJimeng30, volcesJimeng31, volcesJimengDreamActorM1, volcesJimengI2i30, volcesRealmanAvatarImitatorV2v, volcesRealmanAvatarPictureOmniV15, volcesRealmanAvatarPictureOmniV2, volcesSeed3d, volcesSeedance30, volcesSeedance30I2v, volcesSeedance30Pro, volcesSeedanceProFast, volcesSeededit20, volcesSeededit30, volcesSeededit30I2i, volcesSeededit3dStyle, volcesSeededitMultiIp, volcesSeededitMultiStyle, volcesSeededitPortrait, volcesSeededitSingleIp, volcesSeedream30, volcesSeedream40, volcesSeedream45, volcesSeedream45I2i, volcesSeedream45MultiBlend, volcesSubjectDetection, volcesSubjectRecognition, youchuanDiffusion, youchuanEdit, youchuanEnhance, youchuanExtendVideo, youchuanInpaint, youchuanOutpaint, youchuanPan, youchuanRemix, youchuanRemoveBackground, youchuanRetexture, youchuanUploadpaint, youchuanUpscale, youchuanVariation, youchuanVideoDiffusion, youchuanVideoUpscale };
5422
6063
  //# sourceMappingURL=index.js.map
5423
6064
  //# sourceMappingURL=index.js.map