seacloud-sdk 0.12.4 → 0.12.6

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
@@ -16,6 +16,25 @@ function isInIframe() {
16
16
  return true;
17
17
  }
18
18
  }
19
+ function notifyParentError(status, errorBody) {
20
+ if (!isInIframe()) {
21
+ return;
22
+ }
23
+ try {
24
+ const errorPayload = {
25
+ type: "seaverse:error",
26
+ error: {
27
+ status,
28
+ message: `HTTP ${status}`,
29
+ body: errorBody,
30
+ timestamp: Date.now()
31
+ }
32
+ };
33
+ globalThis.window.parent.postMessage(errorPayload, "*");
34
+ } catch (e) {
35
+ console.warn("[SeaCloud SDK] Failed to notify parent of error:", e);
36
+ }
37
+ }
19
38
  async function getTokenFromParent(timeout = 5e3) {
20
39
  if (!isInIframe()) {
21
40
  return null;
@@ -90,6 +109,43 @@ async function getHostFromParent(timeout = 5e3) {
90
109
  }
91
110
  });
92
111
  }
112
+ async function getEnvFromParent(timeout = 5e3) {
113
+ if (!isInIframe()) {
114
+ return null;
115
+ }
116
+ return new Promise((resolve) => {
117
+ const messageHandler = (event) => {
118
+ if (event.data && event.data.type === "seaverse:env") {
119
+ cleanup();
120
+ const env = event.data.payload?.env;
121
+ resolve(env || null);
122
+ } else if (event.data && event.data.type === "seaverse:error") {
123
+ cleanup();
124
+ console.warn("[SeaCloud SDK] Error getting env from parent:", event.data.error);
125
+ resolve(null);
126
+ }
127
+ };
128
+ const timeoutId = setTimeout(() => {
129
+ cleanup();
130
+ resolve(null);
131
+ }, timeout);
132
+ const cleanup = () => {
133
+ clearTimeout(timeoutId);
134
+ globalThis.window.removeEventListener("message", messageHandler);
135
+ };
136
+ globalThis.window.addEventListener("message", messageHandler);
137
+ try {
138
+ globalThis.window.parent.postMessage(
139
+ { type: "seaverse:get_env" },
140
+ "*"
141
+ // 允许任何源,支持跨域场景
142
+ );
143
+ } catch (e) {
144
+ cleanup();
145
+ resolve(null);
146
+ }
147
+ });
148
+ }
93
149
  async function getApiToken(providedApiKey) {
94
150
  if (providedApiKey) {
95
151
  return providedApiKey;
@@ -118,22 +174,34 @@ function checkIsDevelopmentHost(host) {
118
174
  const devHostPatterns = ["localhost", "127.0.0.1", ":3000", ":8080", "seaverse.dev"];
119
175
  return devHostPatterns.some((pattern) => host.includes(pattern));
120
176
  }
121
- function createConfig(options = {}) {
122
- const apiKey = options.apiKey;
123
- let baseUrl;
124
- if (options.baseUrl) {
125
- baseUrl = options.baseUrl;
126
- } else if (typeof process !== "undefined" && process.env?.SEACLOUD_BASE_URL) {
127
- baseUrl = process.env.SEACLOUD_BASE_URL;
128
- } else {
129
- const currentHost = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" ? globalThis.window.location.host : "";
130
- if (checkIsDevelopmentHost(currentHost)) {
131
- baseUrl = "https://proxy-rs.sg.seaverse.dev";
132
- console.log("[SeaCloud SDK] \u68C0\u6D4B\u5230\u5F00\u53D1\u73AF\u5883\uFF08currentHost\uFF09\uFF0C\u4F7F\u7528\u5F00\u53D1 baseUrl:", baseUrl);
177
+ async function getBaseUrl(userBaseUrl) {
178
+ if (userBaseUrl) {
179
+ return userBaseUrl;
180
+ }
181
+ if (typeof process !== "undefined" && process.env?.SEACLOUD_BASE_URL) {
182
+ return process.env.SEACLOUD_BASE_URL;
183
+ }
184
+ if (isInIframe()) {
185
+ const parentEnv = await getEnvFromParent(3e3);
186
+ if (parentEnv === "develop") {
187
+ console.log("[SeaCloud SDK] iframe \u73AF\u5883\uFF1A\u7236\u9875\u9762\u8FD4\u56DE\u5F00\u53D1\u73AF\u5883\uFF0C\u4F7F\u7528\u5F00\u53D1 baseUrl");
188
+ return "https://proxy-rs.sg.seaverse.dev";
133
189
  } else {
134
- baseUrl = "https://proxy-rs.seaverse.ai";
190
+ console.log("[SeaCloud SDK] iframe \u73AF\u5883\uFF1A\u4F7F\u7528\u7EBF\u4E0A baseUrl");
191
+ return "https://proxy-rs.seaverse.ai";
135
192
  }
136
193
  }
194
+ const currentHost = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" ? globalThis.window.location.host : "";
195
+ if (checkIsDevelopmentHost(currentHost)) {
196
+ console.log("[SeaCloud SDK] \u68C0\u6D4B\u5230\u5F00\u53D1\u73AF\u5883\uFF08currentHost\uFF09\uFF0C\u4F7F\u7528\u5F00\u53D1 baseUrl");
197
+ return "https://proxy-rs.sg.seaverse.dev";
198
+ } else {
199
+ return "https://proxy-rs.seaverse.ai";
200
+ }
201
+ }
202
+ async function createConfig(options = {}) {
203
+ const apiKey = options.apiKey;
204
+ const baseUrl = await getBaseUrl(options.baseUrl);
137
205
  const fetchImpl = options.fetch || (globalThis.fetch ? globalThis.fetch.bind(globalThis) : void 0);
138
206
  if (!fetchImpl) {
139
207
  throw new Error("fetch is not available. Please provide a fetch implementation in config or upgrade to Node.js 18+");
@@ -160,11 +228,11 @@ function validateConfig(config) {
160
228
  var VERSION = "0.9.6";
161
229
 
162
230
  // src/core/client.ts
163
- var SeacloudClient = class {
231
+ var SeacloudClient = class _SeacloudClient {
164
232
  // 保存用户提供的 apiKey
165
- constructor(config = {}) {
166
- this.config = createConfig(config);
167
- this.providedApiKey = config.apiKey;
233
+ constructor(config, providedApiKey) {
234
+ this.config = config;
235
+ this.providedApiKey = providedApiKey;
168
236
  validateConfig(this.config);
169
237
  const isBrowser = typeof globalThis.window !== "undefined" && typeof globalThis.localStorage !== "undefined";
170
238
  if (isBrowser) {
@@ -178,6 +246,15 @@ var SeacloudClient = class {
178
246
  });
179
247
  }
180
248
  }
249
+ /**
250
+ * 创建 SeacloudClient 实例(异步工厂方法)
251
+ * @param config 配置选项
252
+ * @returns SeacloudClient 实例
253
+ */
254
+ static async create(config = {}) {
255
+ const fullConfig = await createConfig(config);
256
+ return new _SeacloudClient(fullConfig, config.apiKey);
257
+ }
181
258
  /**
182
259
  * 创建一个新任务
183
260
  * @param endpoint API 端点路径(例如:/model/tasks)
@@ -247,6 +324,7 @@ var SeacloudClient = class {
247
324
  clearTimeout(timeoutId);
248
325
  if (!response.ok) {
249
326
  const errorBody = await response.text();
327
+ notifyParentError(response.status, errorBody);
250
328
  throw new SeacloudError(
251
329
  `HTTP ${response.status}: ${errorBody}`,
252
330
  response.status,
@@ -302,24 +380,9 @@ async function initSeacloud(apiKeyOrConfig, options) {
302
380
  apiKey = void 0;
303
381
  }
304
382
  if (!config.baseUrl) {
305
- try {
306
- const parentHost = await getHostFromParent(3e3);
307
- if (parentHost) {
308
- const currentHost = typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" ? globalThis.window.location.host : "";
309
- const isDevelopment = checkIsDevelopmentHost(currentHost) || checkIsDevelopmentHost(parentHost);
310
- if (isDevelopment) {
311
- config.baseUrl = "https://proxy-rs.sg.seaverse.dev";
312
- console.log("[SeaCloud SDK] \u68C0\u6D4B\u5230\u5F00\u53D1\u73AF\u5883\uFF0C\u4F7F\u7528\u5F00\u53D1 baseUrl:", config.baseUrl);
313
- } else {
314
- config.baseUrl = "https://proxy-rs.seaverse.ai";
315
- console.log("[SeaCloud SDK] \u68C0\u6D4B\u5230\u6B63\u5F0F\u73AF\u5883\uFF0C\u4F7F\u7528\u6B63\u5F0F baseUrl:", config.baseUrl);
316
- }
317
- }
318
- } catch (error) {
319
- console.warn("[SeaCloud SDK] \u83B7\u53D6\u7236\u9875\u9762 host \u5931\u8D25\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E", error);
320
- }
383
+ config.baseUrl = await getBaseUrl();
321
384
  }
322
- globalConfig.client = new SeacloudClient({
385
+ globalConfig.client = await SeacloudClient.create({
323
386
  apiKey: apiKey || "",
324
387
  baseUrl: config.baseUrl,
325
388
  timeout: config.timeout,
@@ -333,11 +396,11 @@ async function initSeacloud(apiKeyOrConfig, options) {
333
396
  }
334
397
  return globalConfig.client;
335
398
  }
336
- function getClient() {
399
+ async function getClient() {
337
400
  if (globalConfig.client) {
338
401
  return globalConfig.client;
339
402
  }
340
- return new SeacloudClient({
403
+ return await SeacloudClient.create({
341
404
  // 不传 apiKey - 让 createConfig() 自动从环境变量/localStorage 读取
342
405
  // 不传 baseUrl - 让 createConfig() 自动从环境变量读取或使用默认值
343
406
  // 不传 timeout - 使用默认 30000ms
@@ -465,13 +528,13 @@ async function createAndWaitTask(client, endpoint, body, options = {}) {
465
528
 
466
529
  // src/core/index.ts
467
530
  async function getTaskStatus(endpoint, taskId) {
468
- const client = getClient();
531
+ const client = await getClient();
469
532
  return client.getTaskStatus(endpoint, taskId);
470
533
  }
471
534
 
472
535
  // src/api/alibaba_animate_anyone_detect.ts
473
536
  async function alibabaAnimateAnyoneDetect(params) {
474
- const client = getClient();
537
+ const client = await getClient();
475
538
  const pollingOptions = {
476
539
  intervalMs: 3e3,
477
540
  maxAttempts: 60
@@ -506,7 +569,7 @@ async function alibabaAnimateAnyoneDetect(params) {
506
569
 
507
570
  // src/api/alibaba_animate_anyone_template.ts
508
571
  async function alibabaAnimateAnyoneTemplate(params) {
509
- const client = getClient();
572
+ const client = await getClient();
510
573
  const pollingOptions = {
511
574
  intervalMs: 3e3,
512
575
  maxAttempts: 60
@@ -541,7 +604,7 @@ async function alibabaAnimateAnyoneTemplate(params) {
541
604
 
542
605
  // src/api/alibaba_animate_anyone_video.ts
543
606
  async function alibabaAnimateAnyoneVideo(params) {
544
- const client = getClient();
607
+ const client = await getClient();
545
608
  const pollingOptions = {
546
609
  intervalMs: 5e3,
547
610
  maxAttempts: 120
@@ -576,7 +639,7 @@ async function alibabaAnimateAnyoneVideo(params) {
576
639
 
577
640
  // src/api/alibaba_qianwen_image.ts
578
641
  async function alibabaQianwenImage(params) {
579
- const client = getClient();
642
+ const client = await getClient();
580
643
  const pollingOptions = {
581
644
  intervalMs: 3e3,
582
645
  maxAttempts: 60
@@ -611,7 +674,7 @@ async function alibabaQianwenImage(params) {
611
674
 
612
675
  // src/api/alibaba_wan22_t2i_flash.ts
613
676
  async function alibabaWan22T2iFlash(params) {
614
- const client = getClient();
677
+ const client = await getClient();
615
678
  const pollingOptions = {
616
679
  intervalMs: 3e3,
617
680
  maxAttempts: 60
@@ -646,7 +709,7 @@ async function alibabaWan22T2iFlash(params) {
646
709
 
647
710
  // src/api/alibaba_wan22_t2i_plus.ts
648
711
  async function alibabaWan22T2iPlus(params) {
649
- const client = getClient();
712
+ const client = await getClient();
650
713
  const pollingOptions = {
651
714
  intervalMs: 3e3,
652
715
  maxAttempts: 60
@@ -707,7 +770,7 @@ function validateResources(resources, resourceType = "resource") {
707
770
 
708
771
  // src/api/alibaba_wan25_i2i_preview.ts
709
772
  async function alibabaWan25I2iPreview(params) {
710
- const client = getClient();
773
+ const client = await getClient();
711
774
  const pollingOptions = {
712
775
  intervalMs: 3e3,
713
776
  maxAttempts: 60
@@ -743,7 +806,7 @@ async function alibabaWan25I2iPreview(params) {
743
806
 
744
807
  // src/api/alibaba_wan25_t2i_preview.ts
745
808
  async function alibabaWan25T2iPreview(params) {
746
- const client = getClient();
809
+ const client = await getClient();
747
810
  const pollingOptions = {
748
811
  intervalMs: 3e3,
749
812
  maxAttempts: 60
@@ -779,7 +842,7 @@ async function alibabaWan25T2iPreview(params) {
779
842
 
780
843
  // src/api/alibaba_wanx20_t2i_turbo.ts
781
844
  async function alibabaWanx20T2iTurbo(params) {
782
- const client = getClient();
845
+ const client = await getClient();
783
846
  const pollingOptions = {
784
847
  intervalMs: 3e3,
785
848
  maxAttempts: 60
@@ -814,7 +877,7 @@ async function alibabaWanx20T2iTurbo(params) {
814
877
 
815
878
  // src/api/alibaba_wanx21_i2v_plus.ts
816
879
  async function alibabaWanx21I2vPlus(params) {
817
- const client = getClient();
880
+ const client = await getClient();
818
881
  const pollingOptions = {
819
882
  intervalMs: 5e3,
820
883
  maxAttempts: 120
@@ -849,7 +912,7 @@ async function alibabaWanx21I2vPlus(params) {
849
912
 
850
913
  // src/api/alibaba_wanx21_i2v_turbo.ts
851
914
  async function alibabaWanx21I2vTurbo(params) {
852
- const client = getClient();
915
+ const client = await getClient();
853
916
  const pollingOptions = {
854
917
  intervalMs: 5e3,
855
918
  maxAttempts: 120
@@ -884,7 +947,7 @@ async function alibabaWanx21I2vTurbo(params) {
884
947
 
885
948
  // src/api/alibaba_wanx21_t2i_plus.ts
886
949
  async function alibabaWanx21T2iPlus(params) {
887
- const client = getClient();
950
+ const client = await getClient();
888
951
  const pollingOptions = {
889
952
  intervalMs: 3e3,
890
953
  maxAttempts: 60
@@ -919,7 +982,7 @@ async function alibabaWanx21T2iPlus(params) {
919
982
 
920
983
  // src/api/alibaba_wanx21_t2i_turbo.ts
921
984
  async function alibabaWanx21T2iTurbo(params) {
922
- const client = getClient();
985
+ const client = await getClient();
923
986
  const pollingOptions = {
924
987
  intervalMs: 3e3,
925
988
  maxAttempts: 60
@@ -954,7 +1017,7 @@ async function alibabaWanx21T2iTurbo(params) {
954
1017
 
955
1018
  // src/api/alibaba_wanx21_t2v_plus.ts
956
1019
  async function alibabaWanx21T2vPlus(params) {
957
- const client = getClient();
1020
+ const client = await getClient();
958
1021
  const pollingOptions = {
959
1022
  intervalMs: 5e3,
960
1023
  maxAttempts: 120
@@ -989,7 +1052,7 @@ async function alibabaWanx21T2vPlus(params) {
989
1052
 
990
1053
  // src/api/alibaba_wanx21_t2v_turbo.ts
991
1054
  async function alibabaWanx21T2vTurbo(params) {
992
- const client = getClient();
1055
+ const client = await getClient();
993
1056
  const pollingOptions = {
994
1057
  intervalMs: 5e3,
995
1058
  maxAttempts: 120
@@ -1024,7 +1087,7 @@ async function alibabaWanx21T2vTurbo(params) {
1024
1087
 
1025
1088
  // src/api/alibaba_wanx22_i2v_flash.ts
1026
1089
  async function alibabaWanx22I2vFlash(params) {
1027
- const client = getClient();
1090
+ const client = await getClient();
1028
1091
  const pollingOptions = {
1029
1092
  intervalMs: 5e3,
1030
1093
  maxAttempts: 120
@@ -1059,7 +1122,7 @@ async function alibabaWanx22I2vFlash(params) {
1059
1122
 
1060
1123
  // src/api/alibaba_wanx22_i2v_plus.ts
1061
1124
  async function alibabaWanx22I2vPlus(params) {
1062
- const client = getClient();
1125
+ const client = await getClient();
1063
1126
  const pollingOptions = {
1064
1127
  intervalMs: 5e3,
1065
1128
  maxAttempts: 120
@@ -1094,7 +1157,7 @@ async function alibabaWanx22I2vPlus(params) {
1094
1157
 
1095
1158
  // src/api/alibaba_wanx22_t2v_plus.ts
1096
1159
  async function alibabaWanx22T2vPlus(params) {
1097
- const client = getClient();
1160
+ const client = await getClient();
1098
1161
  const pollingOptions = {
1099
1162
  intervalMs: 5e3,
1100
1163
  maxAttempts: 120
@@ -1129,7 +1192,7 @@ async function alibabaWanx22T2vPlus(params) {
1129
1192
 
1130
1193
  // src/api/alibaba_wanx25_i2v_preview.ts
1131
1194
  async function alibabaWanx25I2vPreview(params) {
1132
- const client = getClient();
1195
+ const client = await getClient();
1133
1196
  const pollingOptions = {
1134
1197
  intervalMs: 5e3,
1135
1198
  maxAttempts: 120
@@ -1165,7 +1228,7 @@ async function alibabaWanx25I2vPreview(params) {
1165
1228
 
1166
1229
  // src/api/alibaba_wanx25_t2v_preview.ts
1167
1230
  async function alibabaWanx25T2vPreview(params) {
1168
- const client = getClient();
1231
+ const client = await getClient();
1169
1232
  const pollingOptions = {
1170
1233
  intervalMs: 5e3,
1171
1234
  maxAttempts: 120
@@ -1201,7 +1264,7 @@ async function alibabaWanx25T2vPreview(params) {
1201
1264
 
1202
1265
  // src/api/alibaba_wanx26_i2v.ts
1203
1266
  async function alibabaWanx26I2v(params) {
1204
- const client = getClient();
1267
+ const client = await getClient();
1205
1268
  const pollingOptions = {
1206
1269
  intervalMs: 5e3,
1207
1270
  maxAttempts: 120
@@ -1236,7 +1299,7 @@ async function alibabaWanx26I2v(params) {
1236
1299
 
1237
1300
  // src/api/alibaba_wanx26_reference.ts
1238
1301
  async function alibabaWanx26Reference(params) {
1239
- const client = getClient();
1302
+ const client = await getClient();
1240
1303
  const pollingOptions = {
1241
1304
  intervalMs: 3e3,
1242
1305
  maxAttempts: 60
@@ -1271,7 +1334,7 @@ async function alibabaWanx26Reference(params) {
1271
1334
 
1272
1335
  // src/api/alibaba_wanx26_t2v.ts
1273
1336
  async function alibabaWanx26T2v(params) {
1274
- const client = getClient();
1337
+ const client = await getClient();
1275
1338
  const pollingOptions = {
1276
1339
  intervalMs: 5e3,
1277
1340
  maxAttempts: 120
@@ -1306,7 +1369,7 @@ async function alibabaWanx26T2v(params) {
1306
1369
 
1307
1370
  // src/api/blackforestlabs_flux_11_pro.ts
1308
1371
  async function blackforestlabsFlux11Pro(params) {
1309
- const client = getClient();
1372
+ const client = await getClient();
1310
1373
  const pollingOptions = {
1311
1374
  intervalMs: 3e3,
1312
1375
  maxAttempts: 60
@@ -1341,7 +1404,7 @@ async function blackforestlabsFlux11Pro(params) {
1341
1404
 
1342
1405
  // src/api/blackforestlabs_flux_1_pro.ts
1343
1406
  async function blackforestlabsFlux1Pro(params) {
1344
- const client = getClient();
1407
+ const client = await getClient();
1345
1408
  const pollingOptions = {
1346
1409
  intervalMs: 3e3,
1347
1410
  maxAttempts: 60
@@ -1376,7 +1439,7 @@ async function blackforestlabsFlux1Pro(params) {
1376
1439
 
1377
1440
  // src/api/blackforestlabs_flux_2_flex.ts
1378
1441
  async function blackforestlabsFlux2Flex(params) {
1379
- const client = getClient();
1442
+ const client = await getClient();
1380
1443
  const pollingOptions = {
1381
1444
  intervalMs: 3e3,
1382
1445
  maxAttempts: 60
@@ -1411,7 +1474,7 @@ async function blackforestlabsFlux2Flex(params) {
1411
1474
 
1412
1475
  // src/api/blackforestlabs_flux_2_flex_edit.ts
1413
1476
  async function blackforestlabsFlux2FlexEdit(params) {
1414
- const client = getClient();
1477
+ const client = await getClient();
1415
1478
  const pollingOptions = {
1416
1479
  intervalMs: 3e3,
1417
1480
  maxAttempts: 60
@@ -1446,7 +1509,7 @@ async function blackforestlabsFlux2FlexEdit(params) {
1446
1509
 
1447
1510
  // src/api/blackforestlabs_flux_2_pro.ts
1448
1511
  async function blackforestlabsFlux2Pro(params) {
1449
- const client = getClient();
1512
+ const client = await getClient();
1450
1513
  const pollingOptions = {
1451
1514
  intervalMs: 3e3,
1452
1515
  maxAttempts: 60
@@ -1481,7 +1544,7 @@ async function blackforestlabsFlux2Pro(params) {
1481
1544
 
1482
1545
  // src/api/blackforestlabs_flux_2_pro_edit.ts
1483
1546
  async function blackforestlabsFlux2ProEdit(params) {
1484
- const client = getClient();
1547
+ const client = await getClient();
1485
1548
  const pollingOptions = {
1486
1549
  intervalMs: 3e3,
1487
1550
  maxAttempts: 60
@@ -1516,7 +1579,7 @@ async function blackforestlabsFlux2ProEdit(params) {
1516
1579
 
1517
1580
  // src/api/blackforestlabs_flux_kontext_max.ts
1518
1581
  async function blackforestlabsFluxKontextMax(params) {
1519
- const client = getClient();
1582
+ const client = await getClient();
1520
1583
  const pollingOptions = {
1521
1584
  intervalMs: 3e3,
1522
1585
  maxAttempts: 60
@@ -1551,7 +1614,7 @@ async function blackforestlabsFluxKontextMax(params) {
1551
1614
 
1552
1615
  // src/api/blackforestlabs_flux_kontext_pro.ts
1553
1616
  async function blackforestlabsFluxKontextPro(params) {
1554
- const client = getClient();
1617
+ const client = await getClient();
1555
1618
  const pollingOptions = {
1556
1619
  intervalMs: 3e3,
1557
1620
  maxAttempts: 60
@@ -1586,7 +1649,7 @@ async function blackforestlabsFluxKontextPro(params) {
1586
1649
 
1587
1650
  // src/api/elevenlabs_tts_generator.ts
1588
1651
  async function elevenlabsTtsGenerator(params) {
1589
- const client = getClient();
1652
+ const client = await getClient();
1590
1653
  const pollingOptions = {
1591
1654
  intervalMs: 2e3,
1592
1655
  maxAttempts: 60
@@ -1621,7 +1684,7 @@ async function elevenlabsTtsGenerator(params) {
1621
1684
 
1622
1685
  // src/api/google_gemini3_pro_image.ts
1623
1686
  async function googleGemini3ProImage(params) {
1624
- const client = getClient();
1687
+ const client = await getClient();
1625
1688
  const pollingOptions = {
1626
1689
  intervalMs: 3e3,
1627
1690
  maxAttempts: 60
@@ -1657,7 +1720,7 @@ async function googleGemini3ProImage(params) {
1657
1720
 
1658
1721
  // src/api/google_gemini_image.ts
1659
1722
  async function googleGeminiImage(params) {
1660
- const client = getClient();
1723
+ const client = await getClient();
1661
1724
  const pollingOptions = {
1662
1725
  intervalMs: 3e3,
1663
1726
  maxAttempts: 60
@@ -1704,7 +1767,7 @@ async function googleGeminiImage(params) {
1704
1767
 
1705
1768
  // src/api/google_imagen_4_fast_generate.ts
1706
1769
  async function googleImagen4FastGenerate(params) {
1707
- const client = getClient();
1770
+ const client = await getClient();
1708
1771
  const pollingOptions = {
1709
1772
  intervalMs: 3e3,
1710
1773
  maxAttempts: 60
@@ -1739,7 +1802,7 @@ async function googleImagen4FastGenerate(params) {
1739
1802
 
1740
1803
  // src/api/google_imagen_4_generate.ts
1741
1804
  async function googleImagen4Generate(params) {
1742
- const client = getClient();
1805
+ const client = await getClient();
1743
1806
  const pollingOptions = {
1744
1807
  intervalMs: 3e3,
1745
1808
  maxAttempts: 60
@@ -1774,7 +1837,7 @@ async function googleImagen4Generate(params) {
1774
1837
 
1775
1838
  // src/api/google_imagen_4_ultra_generate.ts
1776
1839
  async function googleImagen4UltraGenerate(params) {
1777
- const client = getClient();
1840
+ const client = await getClient();
1778
1841
  const pollingOptions = {
1779
1842
  intervalMs: 3e3,
1780
1843
  maxAttempts: 60
@@ -1809,7 +1872,7 @@ async function googleImagen4UltraGenerate(params) {
1809
1872
 
1810
1873
  // src/api/google_veo_20_generate_001.ts
1811
1874
  async function googleVeo20Generate001(params) {
1812
- const client = getClient();
1875
+ const client = await getClient();
1813
1876
  const pollingOptions = {
1814
1877
  intervalMs: 3e3,
1815
1878
  maxAttempts: 60
@@ -1844,7 +1907,7 @@ async function googleVeo20Generate001(params) {
1844
1907
 
1845
1908
  // src/api/google_veo_20_generate_exp.ts
1846
1909
  async function googleVeo20GenerateExp(params) {
1847
- const client = getClient();
1910
+ const client = await getClient();
1848
1911
  const pollingOptions = {
1849
1912
  intervalMs: 3e3,
1850
1913
  maxAttempts: 60
@@ -1879,7 +1942,7 @@ async function googleVeo20GenerateExp(params) {
1879
1942
 
1880
1943
  // src/api/google_veo_20_generate_preview.ts
1881
1944
  async function googleVeo20GeneratePreview(params) {
1882
- const client = getClient();
1945
+ const client = await getClient();
1883
1946
  const pollingOptions = {
1884
1947
  intervalMs: 3e3,
1885
1948
  maxAttempts: 60
@@ -1914,7 +1977,7 @@ async function googleVeo20GeneratePreview(params) {
1914
1977
 
1915
1978
  // src/api/google_veo_30_fast_generate_001.ts
1916
1979
  async function googleVeo30FastGenerate001(params) {
1917
- const client = getClient();
1980
+ const client = await getClient();
1918
1981
  const pollingOptions = {
1919
1982
  intervalMs: 3e3,
1920
1983
  maxAttempts: 60
@@ -1949,7 +2012,7 @@ async function googleVeo30FastGenerate001(params) {
1949
2012
 
1950
2013
  // src/api/google_veo_30_generate_001.ts
1951
2014
  async function googleVeo30Generate001(params) {
1952
- const client = getClient();
2015
+ const client = await getClient();
1953
2016
  const pollingOptions = {
1954
2017
  intervalMs: 3e3,
1955
2018
  maxAttempts: 60
@@ -1984,7 +2047,7 @@ async function googleVeo30Generate001(params) {
1984
2047
 
1985
2048
  // src/api/google_veo_31.ts
1986
2049
  async function googleVeo31(params) {
1987
- const client = getClient();
2050
+ const client = await getClient();
1988
2051
  const pollingOptions = {
1989
2052
  intervalMs: 3e3,
1990
2053
  maxAttempts: 60
@@ -2019,7 +2082,7 @@ async function googleVeo31(params) {
2019
2082
 
2020
2083
  // src/api/kling_avatar.ts
2021
2084
  async function klingAvatar(params) {
2022
- const client = getClient();
2085
+ const client = await getClient();
2023
2086
  const pollingOptions = {
2024
2087
  intervalMs: 5e3,
2025
2088
  maxAttempts: 120
@@ -2054,7 +2117,7 @@ async function klingAvatar(params) {
2054
2117
 
2055
2118
  // src/api/kling_duration_extension.ts
2056
2119
  async function klingDurationExtension(params) {
2057
- const client = getClient();
2120
+ const client = await getClient();
2058
2121
  const pollingOptions = {
2059
2122
  intervalMs: 3e3,
2060
2123
  maxAttempts: 60
@@ -2089,7 +2152,7 @@ async function klingDurationExtension(params) {
2089
2152
 
2090
2153
  // src/api/kling_effects_multi_v1.ts
2091
2154
  async function klingEffectsMultiV1(params) {
2092
- const client = getClient();
2155
+ const client = await getClient();
2093
2156
  const pollingOptions = {
2094
2157
  intervalMs: 3e3,
2095
2158
  maxAttempts: 60
@@ -2124,7 +2187,7 @@ async function klingEffectsMultiV1(params) {
2124
2187
 
2125
2188
  // src/api/kling_effects_multi_v15.ts
2126
2189
  async function klingEffectsMultiV15(params) {
2127
- const client = getClient();
2190
+ const client = await getClient();
2128
2191
  const pollingOptions = {
2129
2192
  intervalMs: 3e3,
2130
2193
  maxAttempts: 60
@@ -2159,7 +2222,7 @@ async function klingEffectsMultiV15(params) {
2159
2222
 
2160
2223
  // src/api/kling_effects_multi_v16.ts
2161
2224
  async function klingEffectsMultiV16(params) {
2162
- const client = getClient();
2225
+ const client = await getClient();
2163
2226
  const pollingOptions = {
2164
2227
  intervalMs: 3e3,
2165
2228
  maxAttempts: 60
@@ -2194,7 +2257,7 @@ async function klingEffectsMultiV16(params) {
2194
2257
 
2195
2258
  // src/api/kling_effects_single.ts
2196
2259
  async function klingEffectsSingle(params) {
2197
- const client = getClient();
2260
+ const client = await getClient();
2198
2261
  const pollingOptions = {
2199
2262
  intervalMs: 3e3,
2200
2263
  maxAttempts: 60
@@ -2229,7 +2292,7 @@ async function klingEffectsSingle(params) {
2229
2292
 
2230
2293
  // src/api/kling_lipsync.ts
2231
2294
  async function klingLipsync(params) {
2232
- const client = getClient();
2295
+ const client = await getClient();
2233
2296
  const pollingOptions = {
2234
2297
  intervalMs: 5e3,
2235
2298
  maxAttempts: 120
@@ -2264,7 +2327,7 @@ async function klingLipsync(params) {
2264
2327
 
2265
2328
  // src/api/kling_omni_image.ts
2266
2329
  async function klingOmniImage(params) {
2267
- const client = getClient();
2330
+ const client = await getClient();
2268
2331
  const pollingOptions = {
2269
2332
  intervalMs: 3e3,
2270
2333
  maxAttempts: 60
@@ -2299,7 +2362,7 @@ async function klingOmniImage(params) {
2299
2362
 
2300
2363
  // src/api/kling_omni_video.ts
2301
2364
  async function klingOmniVideo(params) {
2302
- const client = getClient();
2365
+ const client = await getClient();
2303
2366
  const pollingOptions = {
2304
2367
  intervalMs: 5e3,
2305
2368
  maxAttempts: 120
@@ -2334,10 +2397,10 @@ async function klingOmniVideo(params) {
2334
2397
 
2335
2398
  // src/api/kling_v1.ts
2336
2399
  async function klingV1(params) {
2337
- const client = getClient();
2400
+ const client = await getClient();
2338
2401
  const pollingOptions = {
2339
- intervalMs: 3e3,
2340
- maxAttempts: 60
2402
+ intervalMs: 5e3,
2403
+ maxAttempts: 120
2341
2404
  };
2342
2405
  const result = await createAndWaitTask(
2343
2406
  client,
@@ -2369,7 +2432,7 @@ async function klingV1(params) {
2369
2432
 
2370
2433
  // src/api/kling_v1_5.ts
2371
2434
  async function klingV15(params) {
2372
- const client = getClient();
2435
+ const client = await getClient();
2373
2436
  const pollingOptions = {
2374
2437
  intervalMs: 3e3,
2375
2438
  maxAttempts: 60
@@ -2404,7 +2467,7 @@ async function klingV15(params) {
2404
2467
 
2405
2468
  // src/api/kling_v1_5_i2v.ts
2406
2469
  async function klingV15I2v(params) {
2407
- const client = getClient();
2470
+ const client = await getClient();
2408
2471
  const pollingOptions = {
2409
2472
  intervalMs: 5e3,
2410
2473
  maxAttempts: 120
@@ -2439,7 +2502,7 @@ async function klingV15I2v(params) {
2439
2502
 
2440
2503
  // src/api/kling_v1_6.ts
2441
2504
  async function klingV16(params) {
2442
- const client = getClient();
2505
+ const client = await getClient();
2443
2506
  const pollingOptions = {
2444
2507
  intervalMs: 3e3,
2445
2508
  maxAttempts: 60
@@ -2474,7 +2537,7 @@ async function klingV16(params) {
2474
2537
 
2475
2538
  // src/api/kling_v1_6_i2v.ts
2476
2539
  async function klingV16I2v(params) {
2477
- const client = getClient();
2540
+ const client = await getClient();
2478
2541
  const pollingOptions = {
2479
2542
  intervalMs: 5e3,
2480
2543
  maxAttempts: 120
@@ -2509,7 +2572,7 @@ async function klingV16I2v(params) {
2509
2572
 
2510
2573
  // src/api/kling_v1_i2v.ts
2511
2574
  async function klingV1I2v(params) {
2512
- const client = getClient();
2575
+ const client = await getClient();
2513
2576
  const pollingOptions = {
2514
2577
  intervalMs: 5e3,
2515
2578
  maxAttempts: 120
@@ -2544,7 +2607,7 @@ async function klingV1I2v(params) {
2544
2607
 
2545
2608
  // src/api/kling_v2_1_i2v.ts
2546
2609
  async function klingV21I2v(params) {
2547
- const client = getClient();
2610
+ const client = await getClient();
2548
2611
  const pollingOptions = {
2549
2612
  intervalMs: 5e3,
2550
2613
  maxAttempts: 120
@@ -2579,7 +2642,7 @@ async function klingV21I2v(params) {
2579
2642
 
2580
2643
  // src/api/kling_v2_1_master.ts
2581
2644
  async function klingV21Master(params) {
2582
- const client = getClient();
2645
+ const client = await getClient();
2583
2646
  const pollingOptions = {
2584
2647
  intervalMs: 3e3,
2585
2648
  maxAttempts: 60
@@ -2614,7 +2677,7 @@ async function klingV21Master(params) {
2614
2677
 
2615
2678
  // src/api/kling_v2_1_master_i2v.ts
2616
2679
  async function klingV21MasterI2v(params) {
2617
- const client = getClient();
2680
+ const client = await getClient();
2618
2681
  const pollingOptions = {
2619
2682
  intervalMs: 5e3,
2620
2683
  maxAttempts: 120
@@ -2649,7 +2712,7 @@ async function klingV21MasterI2v(params) {
2649
2712
 
2650
2713
  // src/api/kling_v2_5_turbo.ts
2651
2714
  async function klingV25Turbo(params) {
2652
- const client = getClient();
2715
+ const client = await getClient();
2653
2716
  const pollingOptions = {
2654
2717
  intervalMs: 3e3,
2655
2718
  maxAttempts: 60
@@ -2684,7 +2747,7 @@ async function klingV25Turbo(params) {
2684
2747
 
2685
2748
  // src/api/kling_v2_5_turbo_i2v.ts
2686
2749
  async function klingV25TurboI2v(params) {
2687
- const client = getClient();
2750
+ const client = await getClient();
2688
2751
  const pollingOptions = {
2689
2752
  intervalMs: 5e3,
2690
2753
  maxAttempts: 120
@@ -2719,7 +2782,7 @@ async function klingV25TurboI2v(params) {
2719
2782
 
2720
2783
  // src/api/kling_v2_6.ts
2721
2784
  async function klingV26(params) {
2722
- const client = getClient();
2785
+ const client = await getClient();
2723
2786
  const pollingOptions = {
2724
2787
  intervalMs: 3e3,
2725
2788
  maxAttempts: 60
@@ -2754,7 +2817,7 @@ async function klingV26(params) {
2754
2817
 
2755
2818
  // src/api/kling_v2_6_i2v.ts
2756
2819
  async function klingV26I2v(params) {
2757
- const client = getClient();
2820
+ const client = await getClient();
2758
2821
  const pollingOptions = {
2759
2822
  intervalMs: 5e3,
2760
2823
  maxAttempts: 120
@@ -2789,7 +2852,7 @@ async function klingV26I2v(params) {
2789
2852
 
2790
2853
  // src/api/kling_v2_master.ts
2791
2854
  async function klingV2Master(params) {
2792
- const client = getClient();
2855
+ const client = await getClient();
2793
2856
  const pollingOptions = {
2794
2857
  intervalMs: 3e3,
2795
2858
  maxAttempts: 60
@@ -2824,7 +2887,7 @@ async function klingV2Master(params) {
2824
2887
 
2825
2888
  // src/api/kling_v2_master_i2v.ts
2826
2889
  async function klingV2MasterI2v(params) {
2827
- const client = getClient();
2890
+ const client = await getClient();
2828
2891
  const pollingOptions = {
2829
2892
  intervalMs: 5e3,
2830
2893
  maxAttempts: 120
@@ -2859,7 +2922,7 @@ async function klingV2MasterI2v(params) {
2859
2922
 
2860
2923
  // src/api/microsoft_gpt_image_1.ts
2861
2924
  async function microsoftGptImage1(params) {
2862
- const client = getClient();
2925
+ const client = await getClient();
2863
2926
  const pollingOptions = {
2864
2927
  intervalMs: 3e3,
2865
2928
  maxAttempts: 60
@@ -2894,7 +2957,7 @@ async function microsoftGptImage1(params) {
2894
2957
 
2895
2958
  // src/api/microsoft_gpt_image_15.ts
2896
2959
  async function microsoftGptImage15(params) {
2897
- const client = getClient();
2960
+ const client = await getClient();
2898
2961
  const pollingOptions = {
2899
2962
  intervalMs: 3e3,
2900
2963
  maxAttempts: 60
@@ -2929,7 +2992,7 @@ async function microsoftGptImage15(params) {
2929
2992
 
2930
2993
  // src/api/microsoft_sora2.ts
2931
2994
  async function microsoftSora2(params) {
2932
- const client = getClient();
2995
+ const client = await getClient();
2933
2996
  const pollingOptions = {
2934
2997
  intervalMs: 3e3,
2935
2998
  maxAttempts: 60
@@ -2964,7 +3027,7 @@ async function microsoftSora2(params) {
2964
3027
 
2965
3028
  // src/api/minimax_hailuo_02.ts
2966
3029
  async function minimaxHailuo02(params) {
2967
- const client = getClient();
3030
+ const client = await getClient();
2968
3031
  const pollingOptions = {
2969
3032
  intervalMs: 3e3,
2970
3033
  maxAttempts: 60
@@ -2999,7 +3062,7 @@ async function minimaxHailuo02(params) {
2999
3062
 
3000
3063
  // src/api/minimax_hailuo_02_i2v.ts
3001
3064
  async function minimaxHailuo02I2v(params) {
3002
- const client = getClient();
3065
+ const client = await getClient();
3003
3066
  const pollingOptions = {
3004
3067
  intervalMs: 5e3,
3005
3068
  maxAttempts: 120
@@ -3034,7 +3097,7 @@ async function minimaxHailuo02I2v(params) {
3034
3097
 
3035
3098
  // src/api/minimax_hailuo_23_fast_i2v.ts
3036
3099
  async function minimaxHailuo23FastI2v(params) {
3037
- const client = getClient();
3100
+ const client = await getClient();
3038
3101
  const pollingOptions = {
3039
3102
  intervalMs: 5e3,
3040
3103
  maxAttempts: 120
@@ -3069,7 +3132,7 @@ async function minimaxHailuo23FastI2v(params) {
3069
3132
 
3070
3133
  // src/api/minimax_hailuo_23_i2v.ts
3071
3134
  async function minimaxHailuo23I2v(params) {
3072
- const client = getClient();
3135
+ const client = await getClient();
3073
3136
  const pollingOptions = {
3074
3137
  intervalMs: 5e3,
3075
3138
  maxAttempts: 120
@@ -3104,7 +3167,7 @@ async function minimaxHailuo23I2v(params) {
3104
3167
 
3105
3168
  // src/api/minimax_i2v_01.ts
3106
3169
  async function minimaxI2v01(params) {
3107
- const client = getClient();
3170
+ const client = await getClient();
3108
3171
  const pollingOptions = {
3109
3172
  intervalMs: 5e3,
3110
3173
  maxAttempts: 120
@@ -3139,7 +3202,7 @@ async function minimaxI2v01(params) {
3139
3202
 
3140
3203
  // src/api/minimax_i2v_01_director.ts
3141
3204
  async function minimaxI2v01Director(params) {
3142
- const client = getClient();
3205
+ const client = await getClient();
3143
3206
  const pollingOptions = {
3144
3207
  intervalMs: 5e3,
3145
3208
  maxAttempts: 120
@@ -3174,7 +3237,7 @@ async function minimaxI2v01Director(params) {
3174
3237
 
3175
3238
  // src/api/minimax_i2v_01_live.ts
3176
3239
  async function minimaxI2v01Live(params) {
3177
- const client = getClient();
3240
+ const client = await getClient();
3178
3241
  const pollingOptions = {
3179
3242
  intervalMs: 5e3,
3180
3243
  maxAttempts: 120
@@ -3209,7 +3272,7 @@ async function minimaxI2v01Live(params) {
3209
3272
 
3210
3273
  // src/api/minimax_t2a.ts
3211
3274
  async function minimaxT2a(params) {
3212
- const client = getClient();
3275
+ const client = await getClient();
3213
3276
  const pollingOptions = {
3214
3277
  intervalMs: 3e3,
3215
3278
  maxAttempts: 60
@@ -3244,7 +3307,7 @@ async function minimaxT2a(params) {
3244
3307
 
3245
3308
  // src/api/minimax_t2v_01.ts
3246
3309
  async function minimaxT2v01(params) {
3247
- const client = getClient();
3310
+ const client = await getClient();
3248
3311
  const pollingOptions = {
3249
3312
  intervalMs: 5e3,
3250
3313
  maxAttempts: 120
@@ -3279,7 +3342,7 @@ async function minimaxT2v01(params) {
3279
3342
 
3280
3343
  // src/api/minimax_t2v_01_director.ts
3281
3344
  async function minimaxT2v01Director(params) {
3282
- const client = getClient();
3345
+ const client = await getClient();
3283
3346
  const pollingOptions = {
3284
3347
  intervalMs: 5e3,
3285
3348
  maxAttempts: 120
@@ -3314,7 +3377,7 @@ async function minimaxT2v01Director(params) {
3314
3377
 
3315
3378
  // src/api/pixverse_v35_transition.ts
3316
3379
  async function pixverseV35Transition(params) {
3317
- const client = getClient();
3380
+ const client = await getClient();
3318
3381
  const pollingOptions = {
3319
3382
  intervalMs: 3e3,
3320
3383
  maxAttempts: 60
@@ -3349,7 +3412,7 @@ async function pixverseV35Transition(params) {
3349
3412
 
3350
3413
  // src/api/pixverse_v3_5_i2v.ts
3351
3414
  async function pixverseV35I2v(params) {
3352
- const client = getClient();
3415
+ const client = await getClient();
3353
3416
  const pollingOptions = {
3354
3417
  intervalMs: 5e3,
3355
3418
  maxAttempts: 120
@@ -3384,7 +3447,7 @@ async function pixverseV35I2v(params) {
3384
3447
 
3385
3448
  // src/api/pixverse_v3_5_t2v.ts
3386
3449
  async function pixverseV35T2v(params) {
3387
- const client = getClient();
3450
+ const client = await getClient();
3388
3451
  const pollingOptions = {
3389
3452
  intervalMs: 5e3,
3390
3453
  maxAttempts: 120
@@ -3419,7 +3482,7 @@ async function pixverseV35T2v(params) {
3419
3482
 
3420
3483
  // src/api/pixverse_v45_transition.ts
3421
3484
  async function pixverseV45Transition(params) {
3422
- const client = getClient();
3485
+ const client = await getClient();
3423
3486
  const pollingOptions = {
3424
3487
  intervalMs: 3e3,
3425
3488
  maxAttempts: 60
@@ -3454,7 +3517,7 @@ async function pixverseV45Transition(params) {
3454
3517
 
3455
3518
  // src/api/pixverse_v4_5_i2v.ts
3456
3519
  async function pixverseV45I2v(params) {
3457
- const client = getClient();
3520
+ const client = await getClient();
3458
3521
  const pollingOptions = {
3459
3522
  intervalMs: 5e3,
3460
3523
  maxAttempts: 120
@@ -3489,7 +3552,7 @@ async function pixverseV45I2v(params) {
3489
3552
 
3490
3553
  // src/api/pixverse_v4_5_t2v.ts
3491
3554
  async function pixverseV45T2v(params) {
3492
- const client = getClient();
3555
+ const client = await getClient();
3493
3556
  const pollingOptions = {
3494
3557
  intervalMs: 5e3,
3495
3558
  maxAttempts: 120
@@ -3524,7 +3587,7 @@ async function pixverseV45T2v(params) {
3524
3587
 
3525
3588
  // src/api/pixverse_v4_i2v.ts
3526
3589
  async function pixverseV4I2v(params) {
3527
- const client = getClient();
3590
+ const client = await getClient();
3528
3591
  const pollingOptions = {
3529
3592
  intervalMs: 5e3,
3530
3593
  maxAttempts: 120
@@ -3559,7 +3622,7 @@ async function pixverseV4I2v(params) {
3559
3622
 
3560
3623
  // src/api/pixverse_v4_t2v.ts
3561
3624
  async function pixverseV4T2v(params) {
3562
- const client = getClient();
3625
+ const client = await getClient();
3563
3626
  const pollingOptions = {
3564
3627
  intervalMs: 5e3,
3565
3628
  maxAttempts: 120
@@ -3594,7 +3657,7 @@ async function pixverseV4T2v(params) {
3594
3657
 
3595
3658
  // src/api/pixverse_v4_transition.ts
3596
3659
  async function pixverseV4Transition(params) {
3597
- const client = getClient();
3660
+ const client = await getClient();
3598
3661
  const pollingOptions = {
3599
3662
  intervalMs: 3e3,
3600
3663
  maxAttempts: 60
@@ -3629,7 +3692,7 @@ async function pixverseV4Transition(params) {
3629
3692
 
3630
3693
  // src/api/pixverse_v5_5_i2v.ts
3631
3694
  async function pixverseV55I2v(params) {
3632
- const client = getClient();
3695
+ const client = await getClient();
3633
3696
  const pollingOptions = {
3634
3697
  intervalMs: 5e3,
3635
3698
  maxAttempts: 120
@@ -3664,7 +3727,7 @@ async function pixverseV55I2v(params) {
3664
3727
 
3665
3728
  // src/api/pixverse_v5_5_t2v.ts
3666
3729
  async function pixverseV55T2v(params) {
3667
- const client = getClient();
3730
+ const client = await getClient();
3668
3731
  const pollingOptions = {
3669
3732
  intervalMs: 5e3,
3670
3733
  maxAttempts: 120
@@ -3699,7 +3762,7 @@ async function pixverseV55T2v(params) {
3699
3762
 
3700
3763
  // src/api/pixverse_v5_5_transition.ts
3701
3764
  async function pixverseV55Transition(params) {
3702
- const client = getClient();
3765
+ const client = await getClient();
3703
3766
  const pollingOptions = {
3704
3767
  intervalMs: 3e3,
3705
3768
  maxAttempts: 60
@@ -3734,7 +3797,7 @@ async function pixverseV55Transition(params) {
3734
3797
 
3735
3798
  // src/api/pixverse_v5_i2v.ts
3736
3799
  async function pixverseV5I2v(params) {
3737
- const client = getClient();
3800
+ const client = await getClient();
3738
3801
  const pollingOptions = {
3739
3802
  intervalMs: 5e3,
3740
3803
  maxAttempts: 120
@@ -3769,7 +3832,7 @@ async function pixverseV5I2v(params) {
3769
3832
 
3770
3833
  // src/api/pixverse_v5_t2v.ts
3771
3834
  async function pixverseV5T2v(params) {
3772
- const client = getClient();
3835
+ const client = await getClient();
3773
3836
  const pollingOptions = {
3774
3837
  intervalMs: 5e3,
3775
3838
  maxAttempts: 120
@@ -3804,7 +3867,7 @@ async function pixverseV5T2v(params) {
3804
3867
 
3805
3868
  // src/api/pixverse_v5_transition.ts
3806
3869
  async function pixverseV5Transition(params) {
3807
- const client = getClient();
3870
+ const client = await getClient();
3808
3871
  const pollingOptions = {
3809
3872
  intervalMs: 3e3,
3810
3873
  maxAttempts: 60
@@ -3839,7 +3902,7 @@ async function pixverseV5Transition(params) {
3839
3902
 
3840
3903
  // src/api/quick_app_background_remover_standard.ts
3841
3904
  async function quickAppBackgroundRemoverStandard(params) {
3842
- const client = getClient();
3905
+ const client = await getClient();
3843
3906
  const inputs = [
3844
3907
  { field: "image", value: params.imageUrl }
3845
3908
  ];
@@ -3886,7 +3949,7 @@ async function quickAppBackgroundRemoverStandard(params) {
3886
3949
 
3887
3950
  // src/api/runway_gen3a_turbo_i2v.ts
3888
3951
  async function runwayGen3aTurboI2v(params) {
3889
- const client = getClient();
3952
+ const client = await getClient();
3890
3953
  const pollingOptions = {
3891
3954
  intervalMs: 5e3,
3892
3955
  maxAttempts: 120
@@ -3921,7 +3984,7 @@ async function runwayGen3aTurboI2v(params) {
3921
3984
 
3922
3985
  // src/api/tencent_hunyuan_3d.ts
3923
3986
  async function tencentHunyuan3d(params) {
3924
- const client = getClient();
3987
+ const client = await getClient();
3925
3988
  const pollingOptions = {
3926
3989
  intervalMs: 4e3,
3927
3990
  maxAttempts: 90
@@ -3956,7 +4019,7 @@ async function tencentHunyuan3d(params) {
3956
4019
 
3957
4020
  // src/api/tencent_hunyuan_3d_pro.ts
3958
4021
  async function tencentHunyuan3dPro(params) {
3959
- const client = getClient();
4022
+ const client = await getClient();
3960
4023
  const pollingOptions = {
3961
4024
  intervalMs: 4e3,
3962
4025
  maxAttempts: 90
@@ -3991,7 +4054,7 @@ async function tencentHunyuan3dPro(params) {
3991
4054
 
3992
4055
  // src/api/tencent_hunyuan_3d_rapid.ts
3993
4056
  async function tencentHunyuan3dRapid(params) {
3994
- const client = getClient();
4057
+ const client = await getClient();
3995
4058
  const pollingOptions = {
3996
4059
  intervalMs: 4e3,
3997
4060
  maxAttempts: 90
@@ -4026,7 +4089,7 @@ async function tencentHunyuan3dRapid(params) {
4026
4089
 
4027
4090
  // src/api/tencent_image_creation_3.ts
4028
4091
  async function tencentImageCreation3(params) {
4029
- const client = getClient();
4092
+ const client = await getClient();
4030
4093
  const pollingOptions = {
4031
4094
  intervalMs: 3e3,
4032
4095
  maxAttempts: 60
@@ -4061,7 +4124,7 @@ async function tencentImageCreation3(params) {
4061
4124
 
4062
4125
  // src/api/tencent_mps_super_resolution.ts
4063
4126
  async function tencentMpsSuperResolution(params) {
4064
- const client = getClient();
4127
+ const client = await getClient();
4065
4128
  const pollingOptions = {
4066
4129
  intervalMs: 3e3,
4067
4130
  maxAttempts: 60
@@ -4096,7 +4159,7 @@ async function tencentMpsSuperResolution(params) {
4096
4159
 
4097
4160
  // src/api/app_search.ts
4098
4161
  async function appSearch(params) {
4099
- const client = getClient();
4162
+ const client = await getClient();
4100
4163
  const config = client.getConfig();
4101
4164
  const url = `${config.baseUrl}/model/v1/template/specs`;
4102
4165
  const controller = new AbortController();
@@ -4133,7 +4196,7 @@ var templateSpecs = appSearch;
4133
4196
 
4134
4197
  // src/api/vidu_15.ts
4135
4198
  async function vidu15(params) {
4136
- const client = getClient();
4199
+ const client = await getClient();
4137
4200
  const pollingOptions = {
4138
4201
  intervalMs: 3e3,
4139
4202
  maxAttempts: 60
@@ -4168,7 +4231,7 @@ async function vidu15(params) {
4168
4231
 
4169
4232
  // src/api/vidu_15_i2v.ts
4170
4233
  async function vidu15I2v(params) {
4171
- const client = getClient();
4234
+ const client = await getClient();
4172
4235
  const pollingOptions = {
4173
4236
  intervalMs: 5e3,
4174
4237
  maxAttempts: 120
@@ -4203,7 +4266,7 @@ async function vidu15I2v(params) {
4203
4266
 
4204
4267
  // src/api/vidu_20_i2v.ts
4205
4268
  async function vidu20I2v(params) {
4206
- const client = getClient();
4269
+ const client = await getClient();
4207
4270
  const pollingOptions = {
4208
4271
  intervalMs: 5e3,
4209
4272
  maxAttempts: 120
@@ -4238,7 +4301,7 @@ async function vidu20I2v(params) {
4238
4301
 
4239
4302
  // src/api/vidu_q1.ts
4240
4303
  async function viduQ1(params) {
4241
- const client = getClient();
4304
+ const client = await getClient();
4242
4305
  const pollingOptions = {
4243
4306
  intervalMs: 3e3,
4244
4307
  maxAttempts: 60
@@ -4273,7 +4336,7 @@ async function viduQ1(params) {
4273
4336
 
4274
4337
  // src/api/vidu_q1_i2v.ts
4275
4338
  async function viduQ1I2v(params) {
4276
- const client = getClient();
4339
+ const client = await getClient();
4277
4340
  const pollingOptions = {
4278
4341
  intervalMs: 5e3,
4279
4342
  maxAttempts: 120
@@ -4308,7 +4371,7 @@ async function viduQ1I2v(params) {
4308
4371
 
4309
4372
  // src/api/vidu_q2.ts
4310
4373
  async function viduQ2(params) {
4311
- const client = getClient();
4374
+ const client = await getClient();
4312
4375
  const pollingOptions = {
4313
4376
  intervalMs: 3e3,
4314
4377
  maxAttempts: 60
@@ -4343,7 +4406,7 @@ async function viduQ2(params) {
4343
4406
 
4344
4407
  // src/api/viduq2_i2v_reference.ts
4345
4408
  async function viduQ2I2vReference(params) {
4346
- const client = getClient();
4409
+ const client = await getClient();
4347
4410
  if (params.images && params.subjects) {
4348
4411
  throw new Error("images \u548C subjects \u53C2\u6570\u4E92\u65A5\uFF0C\u53EA\u80FD\u9009\u62E9\u5176\u4E2D\u4E00\u4E2A");
4349
4412
  }
@@ -4386,7 +4449,7 @@ async function viduQ2I2vReference(params) {
4386
4449
 
4387
4450
  // src/api/vidu_template.ts
4388
4451
  async function viduTemplate(params) {
4389
- const client = getClient();
4452
+ const client = await getClient();
4390
4453
  const pollingOptions = {
4391
4454
  intervalMs: 3e3,
4392
4455
  maxAttempts: 60
@@ -4421,7 +4484,7 @@ async function viduTemplate(params) {
4421
4484
 
4422
4485
  // src/api/vidu_template_v2.ts
4423
4486
  async function viduTemplateV2(params) {
4424
- const client = getClient();
4487
+ const client = await getClient();
4425
4488
  const pollingOptions = {
4426
4489
  intervalMs: 3e3,
4427
4490
  maxAttempts: 60
@@ -4456,7 +4519,7 @@ async function viduTemplateV2(params) {
4456
4519
 
4457
4520
  // src/api/volces_jimeng_3_0.ts
4458
4521
  async function volcesJimeng30(params) {
4459
- const client = getClient();
4522
+ const client = await getClient();
4460
4523
  const pollingOptions = {
4461
4524
  intervalMs: 3e3,
4462
4525
  maxAttempts: 60
@@ -4491,7 +4554,7 @@ async function volcesJimeng30(params) {
4491
4554
 
4492
4555
  // src/api/volces_jimeng_3_1.ts
4493
4556
  async function volcesJimeng31(params) {
4494
- const client = getClient();
4557
+ const client = await getClient();
4495
4558
  const pollingOptions = {
4496
4559
  intervalMs: 3e3,
4497
4560
  maxAttempts: 60
@@ -4526,7 +4589,7 @@ async function volcesJimeng31(params) {
4526
4589
 
4527
4590
  // src/api/volces_jimeng_dream_actor_m1.ts
4528
4591
  async function volcesJimengDreamActorM1(params) {
4529
- const client = getClient();
4592
+ const client = await getClient();
4530
4593
  const pollingOptions = {
4531
4594
  intervalMs: 3e3,
4532
4595
  maxAttempts: 60
@@ -4561,7 +4624,7 @@ async function volcesJimengDreamActorM1(params) {
4561
4624
 
4562
4625
  // src/api/volces_jimeng_i2i_3_0.ts
4563
4626
  async function volcesJimengI2i30(params) {
4564
- const client = getClient();
4627
+ const client = await getClient();
4565
4628
  const pollingOptions = {
4566
4629
  intervalMs: 3e3,
4567
4630
  maxAttempts: 60
@@ -4596,7 +4659,7 @@ async function volcesJimengI2i30(params) {
4596
4659
 
4597
4660
  // src/api/volces_realman_avatar_imitator_v2v.ts
4598
4661
  async function volcesRealmanAvatarImitatorV2v(params) {
4599
- const client = getClient();
4662
+ const client = await getClient();
4600
4663
  const pollingOptions = {
4601
4664
  intervalMs: 5e3,
4602
4665
  maxAttempts: 120
@@ -4631,7 +4694,7 @@ async function volcesRealmanAvatarImitatorV2v(params) {
4631
4694
 
4632
4695
  // src/api/volces_realman_avatar_picture_omni_v15.ts
4633
4696
  async function volcesRealmanAvatarPictureOmniV15(params) {
4634
- const client = getClient();
4697
+ const client = await getClient();
4635
4698
  const pollingOptions = {
4636
4699
  intervalMs: 5e3,
4637
4700
  maxAttempts: 120
@@ -4666,7 +4729,7 @@ async function volcesRealmanAvatarPictureOmniV15(params) {
4666
4729
 
4667
4730
  // src/api/volces_realman_avatar_picture_omni_v2.ts
4668
4731
  async function volcesRealmanAvatarPictureOmniV2(params) {
4669
- const client = getClient();
4732
+ const client = await getClient();
4670
4733
  const pollingOptions = {
4671
4734
  intervalMs: 5e3,
4672
4735
  maxAttempts: 120
@@ -4701,7 +4764,7 @@ async function volcesRealmanAvatarPictureOmniV2(params) {
4701
4764
 
4702
4765
  // src/api/volces_seed3d.ts
4703
4766
  async function volcesSeed3d(params) {
4704
- const client = getClient();
4767
+ const client = await getClient();
4705
4768
  const pollingOptions = {
4706
4769
  intervalMs: 4e3,
4707
4770
  maxAttempts: 90
@@ -4736,7 +4799,7 @@ async function volcesSeed3d(params) {
4736
4799
 
4737
4800
  // src/api/volces_seedance_30_i2v.ts
4738
4801
  async function volcesSeedance30I2v(params) {
4739
- const client = getClient();
4802
+ const client = await getClient();
4740
4803
  const pollingOptions = {
4741
4804
  intervalMs: 5e3,
4742
4805
  maxAttempts: 120
@@ -4771,7 +4834,7 @@ async function volcesSeedance30I2v(params) {
4771
4834
 
4772
4835
  // src/api/volces_seedance_3_0.ts
4773
4836
  async function volcesSeedance30(params) {
4774
- const client = getClient();
4837
+ const client = await getClient();
4775
4838
  const pollingOptions = {
4776
4839
  intervalMs: 3e3,
4777
4840
  maxAttempts: 60
@@ -4806,7 +4869,7 @@ async function volcesSeedance30(params) {
4806
4869
 
4807
4870
  // src/api/volces_seedance_3_0_pro.ts
4808
4871
  async function volcesSeedance30Pro(params) {
4809
- const client = getClient();
4872
+ const client = await getClient();
4810
4873
  const pollingOptions = {
4811
4874
  intervalMs: 3e3,
4812
4875
  maxAttempts: 60
@@ -4841,7 +4904,7 @@ async function volcesSeedance30Pro(params) {
4841
4904
 
4842
4905
  // src/api/volces_seedance_pro_fast.ts
4843
4906
  async function volcesSeedanceProFast(params) {
4844
- const client = getClient();
4907
+ const client = await getClient();
4845
4908
  const pollingOptions = {
4846
4909
  intervalMs: 3e3,
4847
4910
  maxAttempts: 60
@@ -4876,7 +4939,7 @@ async function volcesSeedanceProFast(params) {
4876
4939
 
4877
4940
  // src/api/volces_seededit_2_0.ts
4878
4941
  async function volcesSeededit20(params) {
4879
- const client = getClient();
4942
+ const client = await getClient();
4880
4943
  const pollingOptions = {
4881
4944
  intervalMs: 3e3,
4882
4945
  maxAttempts: 60
@@ -4910,7 +4973,7 @@ async function volcesSeededit20(params) {
4910
4973
 
4911
4974
  // src/api/volces_seededit_3_0.ts
4912
4975
  async function volcesSeededit30(params) {
4913
- const client = getClient();
4976
+ const client = await getClient();
4914
4977
  const pollingOptions = {
4915
4978
  intervalMs: 3e3,
4916
4979
  maxAttempts: 60
@@ -4946,7 +5009,7 @@ async function volcesSeededit30(params) {
4946
5009
 
4947
5010
  // src/api/volces_seededit_3_0_i2i.ts
4948
5011
  async function volcesSeededit30I2i(params) {
4949
- const client = getClient();
5012
+ const client = await getClient();
4950
5013
  const pollingOptions = {
4951
5014
  intervalMs: 3e3,
4952
5015
  maxAttempts: 60
@@ -4981,7 +5044,7 @@ async function volcesSeededit30I2i(params) {
4981
5044
 
4982
5045
  // src/api/volces_seededit_3d_style.ts
4983
5046
  async function volcesSeededit3dStyle(params) {
4984
- const client = getClient();
5047
+ const client = await getClient();
4985
5048
  const pollingOptions = {
4986
5049
  intervalMs: 4e3,
4987
5050
  maxAttempts: 90
@@ -5016,7 +5079,7 @@ async function volcesSeededit3dStyle(params) {
5016
5079
 
5017
5080
  // src/api/volces_seededit_multi_ip.ts
5018
5081
  async function volcesSeededitMultiIp(params) {
5019
- const client = getClient();
5082
+ const client = await getClient();
5020
5083
  const pollingOptions = {
5021
5084
  intervalMs: 3e3,
5022
5085
  maxAttempts: 60
@@ -5051,7 +5114,7 @@ async function volcesSeededitMultiIp(params) {
5051
5114
 
5052
5115
  // src/api/volces_seededit_multi_style.ts
5053
5116
  async function volcesSeededitMultiStyle(params) {
5054
- const client = getClient();
5117
+ const client = await getClient();
5055
5118
  const pollingOptions = {
5056
5119
  intervalMs: 3e3,
5057
5120
  maxAttempts: 60
@@ -5086,7 +5149,7 @@ async function volcesSeededitMultiStyle(params) {
5086
5149
 
5087
5150
  // src/api/volces_seededit_portrait.ts
5088
5151
  async function volcesSeededitPortrait(params) {
5089
- const client = getClient();
5152
+ const client = await getClient();
5090
5153
  const pollingOptions = {
5091
5154
  intervalMs: 3e3,
5092
5155
  maxAttempts: 60
@@ -5121,7 +5184,7 @@ async function volcesSeededitPortrait(params) {
5121
5184
 
5122
5185
  // src/api/volces_seededit_single_ip.ts
5123
5186
  async function volcesSeededitSingleIp(params) {
5124
- const client = getClient();
5187
+ const client = await getClient();
5125
5188
  const pollingOptions = {
5126
5189
  intervalMs: 3e3,
5127
5190
  maxAttempts: 60
@@ -5156,7 +5219,7 @@ async function volcesSeededitSingleIp(params) {
5156
5219
 
5157
5220
  // src/api/volces_seedream_3_0.ts
5158
5221
  async function volcesSeedream30(params) {
5159
- const client = getClient();
5222
+ const client = await getClient();
5160
5223
  const pollingOptions = {
5161
5224
  intervalMs: 3e3,
5162
5225
  maxAttempts: 60
@@ -5192,7 +5255,7 @@ async function volcesSeedream30(params) {
5192
5255
 
5193
5256
  // src/api/volces_seedream_4_0.ts
5194
5257
  async function volcesSeedream40(params) {
5195
- const client = getClient();
5258
+ const client = await getClient();
5196
5259
  const pollingOptions = {
5197
5260
  intervalMs: 3e3,
5198
5261
  maxAttempts: 60
@@ -5228,7 +5291,7 @@ async function volcesSeedream40(params) {
5228
5291
 
5229
5292
  // src/api/volces_seedream_4_5.ts
5230
5293
  async function volcesSeedream45(params) {
5231
- const client = getClient();
5294
+ const client = await getClient();
5232
5295
  const pollingOptions = {
5233
5296
  intervalMs: 3e3,
5234
5297
  maxAttempts: 60
@@ -5264,7 +5327,7 @@ async function volcesSeedream45(params) {
5264
5327
 
5265
5328
  // src/api/volces_seedream_4_5_i2i.ts
5266
5329
  async function volcesSeedream45I2i(params) {
5267
- const client = getClient();
5330
+ const client = await getClient();
5268
5331
  const pollingOptions = {
5269
5332
  intervalMs: 3e3,
5270
5333
  maxAttempts: 60
@@ -5273,7 +5336,7 @@ async function volcesSeedream45I2i(params) {
5273
5336
  client,
5274
5337
  "/model/v1/generation",
5275
5338
  {
5276
- model: "volces_seedream_4_5_i2i",
5339
+ model: "volces_seedream_4_5",
5277
5340
  input: [{ params }]
5278
5341
  },
5279
5342
  pollingOptions
@@ -5299,7 +5362,7 @@ async function volcesSeedream45I2i(params) {
5299
5362
 
5300
5363
  // src/api/volces_seedream_4_5_multi_blend.ts
5301
5364
  async function volcesSeedream45MultiBlend(params) {
5302
- const client = getClient();
5365
+ const client = await getClient();
5303
5366
  const imageList = params.image || params.images;
5304
5367
  if (!imageList || !Array.isArray(imageList)) {
5305
5368
  throw new Error('Parameter "image" or "images" is required and must be an array');
@@ -5346,7 +5409,7 @@ async function volcesSeedream45MultiBlend(params) {
5346
5409
 
5347
5410
  // src/api/volces_subject_detection.ts
5348
5411
  async function volcesSubjectDetection(params) {
5349
- const client = getClient();
5412
+ const client = await getClient();
5350
5413
  const pollingOptions = {
5351
5414
  intervalMs: 3e3,
5352
5415
  maxAttempts: 60
@@ -5381,7 +5444,7 @@ async function volcesSubjectDetection(params) {
5381
5444
 
5382
5445
  // src/api/volces_subject_recognition.ts
5383
5446
  async function volcesSubjectRecognition(params) {
5384
- const client = getClient();
5447
+ const client = await getClient();
5385
5448
  const pollingOptions = {
5386
5449
  intervalMs: 3e3,
5387
5450
  maxAttempts: 60
@@ -5416,7 +5479,7 @@ async function volcesSubjectRecognition(params) {
5416
5479
 
5417
5480
  // src/api/llm_chat_completions.ts
5418
5481
  async function llmChatCompletions(params) {
5419
- const client = getClient();
5482
+ const client = await getClient();
5420
5483
  const config = client.getConfig();
5421
5484
  const url = `${config.baseUrl}/llm/chat/completions`;
5422
5485
  const token = await getApiToken(config.apiKey);
@@ -5436,6 +5499,7 @@ async function llmChatCompletions(params) {
5436
5499
  clearTimeout(timeoutId);
5437
5500
  if (!response.ok) {
5438
5501
  const errorBody = await response.text();
5502
+ notifyParentError(response.status, errorBody);
5439
5503
  throw new SeacloudError(
5440
5504
  `HTTP ${response.status}: ${errorBody}`,
5441
5505
  response.status,
@@ -5500,7 +5564,7 @@ async function* parseStreamingResponse(response) {
5500
5564
 
5501
5565
  // src/api/agent_chat_completions.ts
5502
5566
  async function agentChatCompletions(params) {
5503
- const client = getClient();
5567
+ const client = await getClient();
5504
5568
  const config = client.getConfig();
5505
5569
  const url = `${config.baseUrl}/agent/api/v1/chat/completions`;
5506
5570
  const model = params.model || "custom_openai/vertex-ai-claude-sonnet-4.5";
@@ -5531,6 +5595,7 @@ async function agentChatCompletions(params) {
5531
5595
  clearTimeout(timeoutId);
5532
5596
  if (!response.ok) {
5533
5597
  const errorBody = await response.text();
5598
+ notifyParentError(response.status, errorBody);
5534
5599
  throw new SeacloudError(
5535
5600
  `HTTP ${response.status}: ${errorBody}`,
5536
5601
  response.status,
@@ -5737,7 +5802,7 @@ function createTool(toolName) {
5737
5802
 
5738
5803
  // src/api/app_generation.ts
5739
5804
  async function appGeneration(params) {
5740
- const client = getClient();
5805
+ const client = await getClient();
5741
5806
  const pollingOptions = {
5742
5807
  intervalMs: 3e3,
5743
5808
  maxAttempts: 120
@@ -5765,7 +5830,7 @@ async function scan(params) {
5765
5830
  if (!params.risk_types || params.risk_types.length === 0) {
5766
5831
  throw new SeacloudError("\u5FC5\u987B\u63D0\u4F9B\u81F3\u5C11\u4E00\u4E2A\u98CE\u9669\u7C7B\u578B");
5767
5832
  }
5768
- const client = getClient();
5833
+ const client = await getClient();
5769
5834
  const config = client.getConfig();
5770
5835
  const url = `${config.baseUrl}/scan`;
5771
5836
  const token = await getApiToken(config.apiKey);
@@ -5823,7 +5888,7 @@ async function scan(params) {
5823
5888
 
5824
5889
  // src/api/youchuan_diffusion.ts
5825
5890
  async function youchuanDiffusion(params) {
5826
- const client = getClient();
5891
+ const client = await getClient();
5827
5892
  const pollingOptions = {
5828
5893
  intervalMs: 3e3,
5829
5894
  maxAttempts: 60
@@ -5858,7 +5923,7 @@ async function youchuanDiffusion(params) {
5858
5923
 
5859
5924
  // src/api/youchuan_edit.ts
5860
5925
  async function youchuanEdit(params) {
5861
- const client = getClient();
5926
+ const client = await getClient();
5862
5927
  const pollingOptions = {
5863
5928
  intervalMs: 3e3,
5864
5929
  maxAttempts: 60
@@ -5893,7 +5958,7 @@ async function youchuanEdit(params) {
5893
5958
 
5894
5959
  // src/api/youchuan_enhance.ts
5895
5960
  async function youchuanEnhance(params) {
5896
- const client = getClient();
5961
+ const client = await getClient();
5897
5962
  const pollingOptions = {
5898
5963
  intervalMs: 3e3,
5899
5964
  maxAttempts: 60
@@ -5912,12 +5977,13 @@ async function youchuanEnhance(params) {
5912
5977
  for (const item of result.output) {
5913
5978
  if (item.content) {
5914
5979
  for (const resource of item.content) {
5980
+ const { usage, ...cleanResource } = resource;
5915
5981
  resources.push({
5916
- type: resource.type || "unknown",
5917
- url: resource.url || "",
5918
- size: resource.size,
5919
- jobId: resource.jobId,
5920
- ...resource
5982
+ type: cleanResource.type || "unknown",
5983
+ url: cleanResource.url || "",
5984
+ size: cleanResource.size,
5985
+ jobId: cleanResource.jobId,
5986
+ ...cleanResource
5921
5987
  });
5922
5988
  }
5923
5989
  }
@@ -5928,7 +5994,7 @@ async function youchuanEnhance(params) {
5928
5994
 
5929
5995
  // src/api/youchuan_extend_video.ts
5930
5996
  async function youchuanExtendVideo(params) {
5931
- const client = getClient();
5997
+ const client = await getClient();
5932
5998
  const pollingOptions = {
5933
5999
  intervalMs: 3e3,
5934
6000
  maxAttempts: 60
@@ -5963,7 +6029,7 @@ async function youchuanExtendVideo(params) {
5963
6029
 
5964
6030
  // src/api/youchuan_inpaint.ts
5965
6031
  async function youchuanInpaint(params) {
5966
- const client = getClient();
6032
+ const client = await getClient();
5967
6033
  const pollingOptions = {
5968
6034
  intervalMs: 3e3,
5969
6035
  maxAttempts: 60
@@ -5998,7 +6064,7 @@ async function youchuanInpaint(params) {
5998
6064
 
5999
6065
  // src/api/youchuan_outpaint.ts
6000
6066
  async function youchuanOutpaint(params) {
6001
- const client = getClient();
6067
+ const client = await getClient();
6002
6068
  const pollingOptions = {
6003
6069
  intervalMs: 3e3,
6004
6070
  maxAttempts: 60
@@ -6033,7 +6099,7 @@ async function youchuanOutpaint(params) {
6033
6099
 
6034
6100
  // src/api/youchuan_pan.ts
6035
6101
  async function youchuanPan(params) {
6036
- const client = getClient();
6102
+ const client = await getClient();
6037
6103
  const pollingOptions = {
6038
6104
  intervalMs: 3e3,
6039
6105
  maxAttempts: 60
@@ -6068,7 +6134,7 @@ async function youchuanPan(params) {
6068
6134
 
6069
6135
  // src/api/youchuan_remix.ts
6070
6136
  async function youchuanRemix(params) {
6071
- const client = getClient();
6137
+ const client = await getClient();
6072
6138
  const pollingOptions = {
6073
6139
  intervalMs: 3e3,
6074
6140
  maxAttempts: 60
@@ -6103,7 +6169,7 @@ async function youchuanRemix(params) {
6103
6169
 
6104
6170
  // src/api/youchuan_remove_background.ts
6105
6171
  async function youchuanRemoveBackground(params) {
6106
- const client = getClient();
6172
+ const client = await getClient();
6107
6173
  const pollingOptions = {
6108
6174
  intervalMs: 3e3,
6109
6175
  maxAttempts: 60
@@ -6138,7 +6204,7 @@ async function youchuanRemoveBackground(params) {
6138
6204
 
6139
6205
  // src/api/youchuan_retexture.ts
6140
6206
  async function youchuanRetexture(params) {
6141
- const client = getClient();
6207
+ const client = await getClient();
6142
6208
  const pollingOptions = {
6143
6209
  intervalMs: 3e3,
6144
6210
  maxAttempts: 60
@@ -6173,7 +6239,7 @@ async function youchuanRetexture(params) {
6173
6239
 
6174
6240
  // src/api/youchuan_uploadpaint.ts
6175
6241
  async function youchuanUploadpaint(params) {
6176
- const client = getClient();
6242
+ const client = await getClient();
6177
6243
  const pollingOptions = {
6178
6244
  intervalMs: 3e3,
6179
6245
  maxAttempts: 60
@@ -6208,7 +6274,7 @@ async function youchuanUploadpaint(params) {
6208
6274
 
6209
6275
  // src/api/youchuan_upscale.ts
6210
6276
  async function youchuanUpscale(params) {
6211
- const client = getClient();
6277
+ const client = await getClient();
6212
6278
  const pollingOptions = {
6213
6279
  intervalMs: 3e3,
6214
6280
  maxAttempts: 60
@@ -6243,7 +6309,7 @@ async function youchuanUpscale(params) {
6243
6309
 
6244
6310
  // src/api/youchuan_variation.ts
6245
6311
  async function youchuanVariation(params) {
6246
- const client = getClient();
6312
+ const client = await getClient();
6247
6313
  const pollingOptions = {
6248
6314
  intervalMs: 3e3,
6249
6315
  maxAttempts: 60
@@ -6278,7 +6344,7 @@ async function youchuanVariation(params) {
6278
6344
 
6279
6345
  // src/api/youchuan_video_diffusion.ts
6280
6346
  async function youchuanVideoDiffusion(params) {
6281
- const client = getClient();
6347
+ const client = await getClient();
6282
6348
  const pollingOptions = {
6283
6349
  intervalMs: 3e3,
6284
6350
  maxAttempts: 60
@@ -6313,7 +6379,7 @@ async function youchuanVideoDiffusion(params) {
6313
6379
 
6314
6380
  // src/api/youchuan_video_upscale.ts
6315
6381
  async function youchuanVideoUpscale(params) {
6316
- const client = getClient();
6382
+ const client = await getClient();
6317
6383
  const pollingOptions = {
6318
6384
  intervalMs: 3e3,
6319
6385
  maxAttempts: 60