@acedatacloud/sdk 2026.322.1 → 2026.418.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +28 -0
  2. package/dist/index.d.mts +336 -0
  3. package/dist/index.d.ts +336 -4
  4. package/dist/index.js +713 -19
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +665 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +16 -2
  9. package/src/index.ts +4 -0
  10. package/src/resources/audio.ts +6 -3
  11. package/src/resources/images.ts +7 -3
  12. package/src/resources/tasks.ts +6 -0
  13. package/src/resources/video.ts +6 -3
  14. package/dist/client.d.ts +0 -31
  15. package/dist/client.js +0 -46
  16. package/dist/resources/audio.d.ts +0 -17
  17. package/dist/resources/audio.js +0 -30
  18. package/dist/resources/chat.d.ts +0 -30
  19. package/dist/resources/chat.js +0 -38
  20. package/dist/resources/files.d.ts +0 -9
  21. package/dist/resources/files.js +0 -59
  22. package/dist/resources/images.d.ts +0 -18
  23. package/dist/resources/images.js +0 -32
  24. package/dist/resources/openai.d.ts +0 -46
  25. package/dist/resources/openai.js +0 -59
  26. package/dist/resources/platform.d.ts +0 -41
  27. package/dist/resources/platform.js +0 -76
  28. package/dist/resources/search.d.ts +0 -14
  29. package/dist/resources/search.js +0 -22
  30. package/dist/resources/tasks.d.ts +0 -14
  31. package/dist/resources/tasks.js +0 -36
  32. package/dist/resources/video.d.ts +0 -17
  33. package/dist/resources/video.js +0 -30
  34. package/dist/runtime/errors.d.ts +0 -44
  35. package/dist/runtime/errors.js +0 -89
  36. package/dist/runtime/index.d.ts +0 -3
  37. package/dist/runtime/index.js +0 -19
  38. package/dist/runtime/tasks.d.ts +0 -17
  39. package/dist/runtime/tasks.js +0 -46
  40. package/dist/runtime/transport.d.ts +0 -31
  41. package/dist/runtime/transport.js +0 -213
package/dist/index.mjs ADDED
@@ -0,0 +1,665 @@
1
+ // src/runtime/errors.ts
2
+ var AceDataCloudError = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "AceDataCloudError";
6
+ }
7
+ };
8
+ var TransportError = class extends AceDataCloudError {
9
+ constructor(message) {
10
+ super(message);
11
+ this.name = "TransportError";
12
+ }
13
+ };
14
+ var APIError = class extends AceDataCloudError {
15
+ statusCode;
16
+ code;
17
+ traceId;
18
+ body;
19
+ constructor(opts) {
20
+ super(opts.message);
21
+ this.name = "APIError";
22
+ this.statusCode = opts.statusCode;
23
+ this.code = opts.code;
24
+ this.traceId = opts.traceId;
25
+ this.body = opts.body ?? {};
26
+ }
27
+ };
28
+ var AuthenticationError = class extends APIError {
29
+ constructor(opts) {
30
+ super(opts);
31
+ this.name = "AuthenticationError";
32
+ }
33
+ };
34
+ var TokenMismatchError = class extends APIError {
35
+ constructor(opts) {
36
+ super(opts);
37
+ this.name = "TokenMismatchError";
38
+ }
39
+ };
40
+ var RateLimitError = class extends APIError {
41
+ constructor(opts) {
42
+ super(opts);
43
+ this.name = "RateLimitError";
44
+ }
45
+ };
46
+ var ValidationError = class extends APIError {
47
+ constructor(opts) {
48
+ super(opts);
49
+ this.name = "ValidationError";
50
+ }
51
+ };
52
+ var InsufficientBalanceError = class extends APIError {
53
+ constructor(opts) {
54
+ super(opts);
55
+ this.name = "InsufficientBalanceError";
56
+ }
57
+ };
58
+ var ResourceDisabledError = class extends APIError {
59
+ constructor(opts) {
60
+ super(opts);
61
+ this.name = "ResourceDisabledError";
62
+ }
63
+ };
64
+ var ModerationError = class extends APIError {
65
+ constructor(opts) {
66
+ super(opts);
67
+ this.name = "ModerationError";
68
+ }
69
+ };
70
+ var TimeoutError = class extends APIError {
71
+ constructor(opts) {
72
+ super(opts);
73
+ this.name = "TimeoutError";
74
+ }
75
+ };
76
+
77
+ // src/runtime/transport.ts
78
+ var ERROR_CODE_MAP = {
79
+ invalid_token: AuthenticationError,
80
+ token_expired: AuthenticationError,
81
+ no_token: AuthenticationError,
82
+ token_mismatched: TokenMismatchError,
83
+ used_up: InsufficientBalanceError,
84
+ disabled: ResourceDisabledError,
85
+ too_many_requests: RateLimitError,
86
+ bad_request: ValidationError
87
+ };
88
+ var RETRY_STATUS_CODES = /* @__PURE__ */ new Set([408, 409, 429, 500, 502, 503, 504]);
89
+ function mapError(statusCode, body) {
90
+ const errorData = body.error ?? {};
91
+ const code = errorData.code ?? "";
92
+ const message = errorData.message ?? "";
93
+ const traceId = body.trace_id;
94
+ let ErrorClass = ERROR_CODE_MAP[code];
95
+ if (!ErrorClass) {
96
+ if (statusCode === 403) ErrorClass = ModerationError;
97
+ else if (statusCode === 401) ErrorClass = AuthenticationError;
98
+ else if (statusCode === 429) ErrorClass = RateLimitError;
99
+ else if (statusCode === 400) ErrorClass = ValidationError;
100
+ else ErrorClass = APIError;
101
+ }
102
+ return new ErrorClass({ message, statusCode, code, traceId, body });
103
+ }
104
+ function backoffDelay(attempt) {
105
+ const base = Math.min(2 ** attempt, 8);
106
+ return base + Math.random() * 0.5;
107
+ }
108
+ function sleep(ms) {
109
+ return new Promise((resolve) => setTimeout(resolve, ms));
110
+ }
111
+ var Transport = class {
112
+ baseURL;
113
+ platformBaseURL;
114
+ timeout;
115
+ maxRetries;
116
+ headers;
117
+ constructor(opts = {}) {
118
+ const token = opts.apiToken ?? process.env.ACEDATACLOUD_API_TOKEN ?? "";
119
+ if (!token) {
120
+ throw new AuthenticationError({
121
+ message: "apiToken is required. Pass it to the client or set ACEDATACLOUD_API_TOKEN.",
122
+ statusCode: 0,
123
+ code: "no_token"
124
+ });
125
+ }
126
+ this.baseURL = (opts.baseURL ?? "https://api.acedata.cloud").replace(/\/+$/, "");
127
+ this.platformBaseURL = (opts.platformBaseURL ?? "https://platform.acedata.cloud").replace(/\/+$/, "");
128
+ this.timeout = opts.timeout ?? 3e5;
129
+ this.maxRetries = opts.maxRetries ?? 2;
130
+ this.headers = {
131
+ accept: "application/json",
132
+ authorization: `Bearer ${token}`,
133
+ "content-type": "application/json",
134
+ "user-agent": "acedatacloud-node/0.1.0",
135
+ ...opts.headers ?? {}
136
+ };
137
+ }
138
+ async request(method, path2, opts = {}) {
139
+ const base = opts.platform ? this.platformBaseURL : this.baseURL;
140
+ let url = `${base}${path2}`;
141
+ if (opts.params) {
142
+ const qs = new URLSearchParams(opts.params).toString();
143
+ url += `?${qs}`;
144
+ }
145
+ const headers = { ...this.headers, ...opts.headers ?? {} };
146
+ const timeoutMs = opts.timeout ?? this.timeout;
147
+ let lastError = null;
148
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
149
+ const controller = new AbortController();
150
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
151
+ try {
152
+ const resp = await fetch(url, {
153
+ method,
154
+ headers,
155
+ body: opts.json ? JSON.stringify(opts.json) : void 0,
156
+ signal: controller.signal
157
+ });
158
+ clearTimeout(timer);
159
+ if (resp.status >= 400) {
160
+ const text = await resp.text();
161
+ let body;
162
+ try {
163
+ body = JSON.parse(text);
164
+ } catch {
165
+ body = { error: { code: "unknown", message: text } };
166
+ }
167
+ if (RETRY_STATUS_CODES.has(resp.status) && attempt < this.maxRetries) {
168
+ await sleep(backoffDelay(attempt) * 1e3);
169
+ continue;
170
+ }
171
+ throw mapError(resp.status, body);
172
+ }
173
+ return await resp.json();
174
+ } catch (err) {
175
+ clearTimeout(timer);
176
+ if (err instanceof APIError) throw err;
177
+ lastError = err;
178
+ if (attempt < this.maxRetries) {
179
+ await sleep(backoffDelay(attempt) * 1e3);
180
+ continue;
181
+ }
182
+ }
183
+ }
184
+ throw lastError ?? new TransportError("Request failed after retries");
185
+ }
186
+ async *requestStream(method, path2, opts = {}) {
187
+ const url = `${this.baseURL}${path2}`;
188
+ const headers = { ...this.headers, accept: "text/event-stream" };
189
+ const controller = new AbortController();
190
+ const timer = setTimeout(() => controller.abort(), opts.timeout ?? this.timeout);
191
+ try {
192
+ const resp = await fetch(url, {
193
+ method,
194
+ headers,
195
+ body: opts.json ? JSON.stringify(opts.json) : void 0,
196
+ signal: controller.signal
197
+ });
198
+ if (resp.status >= 400) {
199
+ const text = await resp.text();
200
+ let body;
201
+ try {
202
+ body = JSON.parse(text);
203
+ } catch {
204
+ body = { error: { code: "unknown", message: text } };
205
+ }
206
+ throw mapError(resp.status, body);
207
+ }
208
+ if (!resp.body) throw new TransportError("No response body for stream");
209
+ const reader = resp.body.getReader();
210
+ const decoder = new TextDecoder();
211
+ let buffer = "";
212
+ while (true) {
213
+ const { done, value } = await reader.read();
214
+ if (done) break;
215
+ buffer += decoder.decode(value, { stream: true });
216
+ const lines = buffer.split("\n");
217
+ buffer = lines.pop() ?? "";
218
+ for (const line of lines) {
219
+ if (line.startsWith("data: ")) {
220
+ const data = line.slice(6);
221
+ if (data === "[DONE]") return;
222
+ yield data;
223
+ }
224
+ }
225
+ }
226
+ } finally {
227
+ clearTimeout(timer);
228
+ }
229
+ }
230
+ async upload(path2, fileData, filename, opts = {}) {
231
+ const url = `${this.platformBaseURL}${path2}`;
232
+ const boundary = `----AceDataCloudBoundary${Date.now()}`;
233
+ const headers = {
234
+ ...this.headers,
235
+ "content-type": `multipart/form-data; boundary=${boundary}`
236
+ };
237
+ delete headers["content-type"];
238
+ const body = new FormData();
239
+ body.append("file", new Blob([fileData]), filename);
240
+ const authHeaders = {
241
+ authorization: this.headers.authorization,
242
+ "user-agent": this.headers["user-agent"]
243
+ };
244
+ const controller = new AbortController();
245
+ const timer = setTimeout(() => controller.abort(), opts.timeout ?? this.timeout);
246
+ try {
247
+ const resp = await fetch(url, {
248
+ method: "POST",
249
+ headers: authHeaders,
250
+ body,
251
+ signal: controller.signal
252
+ });
253
+ clearTimeout(timer);
254
+ if (resp.status >= 400) {
255
+ const text = await resp.text();
256
+ let respBody;
257
+ try {
258
+ respBody = JSON.parse(text);
259
+ } catch {
260
+ respBody = { error: { code: "unknown", message: text } };
261
+ }
262
+ throw mapError(resp.status, respBody);
263
+ }
264
+ return await resp.json();
265
+ } finally {
266
+ clearTimeout(timer);
267
+ }
268
+ }
269
+ };
270
+
271
+ // src/resources/chat.ts
272
+ var Messages = class {
273
+ constructor(transport) {
274
+ this.transport = transport;
275
+ }
276
+ transport;
277
+ async create(opts) {
278
+ const { model, messages, maxTokens = 4096, stream, ...rest } = opts;
279
+ const body = { model, messages, max_tokens: maxTokens, ...rest };
280
+ if (stream) {
281
+ body.stream = true;
282
+ return this.stream(body);
283
+ }
284
+ return this.transport.request("POST", "/v1/messages", { json: body });
285
+ }
286
+ async *stream(body) {
287
+ for await (const chunk of this.transport.requestStream("POST", "/v1/messages", { json: body })) {
288
+ yield JSON.parse(chunk);
289
+ }
290
+ }
291
+ async countTokens(opts) {
292
+ const { model, messages, ...rest } = opts;
293
+ return this.transport.request("POST", "/v1/messages/count_tokens", {
294
+ json: { model, messages, ...rest }
295
+ });
296
+ }
297
+ };
298
+ var Chat = class {
299
+ messages;
300
+ constructor(transport) {
301
+ this.messages = new Messages(transport);
302
+ }
303
+ };
304
+
305
+ // src/runtime/tasks.ts
306
+ var TaskHandle = class {
307
+ id;
308
+ pollEndpoint;
309
+ transport;
310
+ _result = null;
311
+ constructor(taskId, pollEndpoint, transport) {
312
+ this.id = taskId;
313
+ this.pollEndpoint = pollEndpoint;
314
+ this.transport = transport;
315
+ }
316
+ async get() {
317
+ return this.transport.request("POST", this.pollEndpoint, {
318
+ json: { id: this.id, action: "retrieve" }
319
+ });
320
+ }
321
+ async isCompleted() {
322
+ const state = await this.get();
323
+ const response = state.response ?? state;
324
+ const status = response.status;
325
+ return status === "succeeded" || status === "failed";
326
+ }
327
+ async wait(opts = {}) {
328
+ const pollInterval = opts.pollInterval ?? 3e3;
329
+ const maxWait = opts.maxWait ?? 6e5;
330
+ const start = Date.now();
331
+ while (Date.now() - start < maxWait) {
332
+ const state = await this.get();
333
+ const response = state.response ?? state;
334
+ const status = response.status;
335
+ if (status === "succeeded" || status === "failed") {
336
+ this._result = state;
337
+ return state;
338
+ }
339
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
340
+ }
341
+ throw new Error(`Task ${this.id} did not complete within ${maxWait}ms`);
342
+ }
343
+ get result() {
344
+ return this._result;
345
+ }
346
+ };
347
+
348
+ // src/resources/images.ts
349
+ var Images = class {
350
+ constructor(transport) {
351
+ this.transport = transport;
352
+ }
353
+ transport;
354
+ async generate(opts) {
355
+ const { prompt, provider = "nano-banana", model, negativePrompt, imageUrl, callbackUrl, wait: shouldWait, pollInterval, maxWait, ...rest } = opts;
356
+ const body = { prompt, ...rest };
357
+ if (model !== void 0) body.model = model;
358
+ if (negativePrompt !== void 0) body.negative_prompt = negativePrompt;
359
+ if (imageUrl !== void 0) body.image_url = imageUrl;
360
+ if (callbackUrl !== void 0) body.callback_url = callbackUrl;
361
+ const endpoint = provider === "midjourney" ? "/midjourney/imagine" : `/${provider}/images`;
362
+ const result = await this.transport.request("POST", endpoint, { json: body });
363
+ const taskId = result.task_id;
364
+ if (!taskId || result.data && !shouldWait) return result;
365
+ const handle = new TaskHandle(taskId, `/${provider}/tasks`, this.transport);
366
+ if (shouldWait) return handle.wait({ pollInterval, maxWait });
367
+ return handle;
368
+ }
369
+ };
370
+
371
+ // src/resources/audio.ts
372
+ var Audio = class {
373
+ constructor(transport) {
374
+ this.transport = transport;
375
+ }
376
+ transport;
377
+ async generate(opts) {
378
+ const { prompt, provider = "suno", model, tags, callbackUrl, wait: shouldWait, pollInterval, maxWait, ...rest } = opts;
379
+ const body = { prompt, ...rest };
380
+ if (model !== void 0) body.model = model;
381
+ if (tags !== void 0) body.tags = tags;
382
+ if (callbackUrl !== void 0) body.callback_url = callbackUrl;
383
+ const result = await this.transport.request("POST", `/${provider}/audios`, { json: body });
384
+ const taskId = result.task_id;
385
+ if (!taskId || result.data && !shouldWait) return result;
386
+ const handle = new TaskHandle(taskId, `/${provider}/tasks`, this.transport);
387
+ if (shouldWait) return handle.wait({ pollInterval, maxWait });
388
+ return handle;
389
+ }
390
+ };
391
+
392
+ // src/resources/video.ts
393
+ var Video = class {
394
+ constructor(transport) {
395
+ this.transport = transport;
396
+ }
397
+ transport;
398
+ async generate(opts) {
399
+ const { prompt, provider = "sora", model, imageUrl, callbackUrl, wait: shouldWait, pollInterval, maxWait, ...rest } = opts;
400
+ const body = { prompt, ...rest };
401
+ if (model !== void 0) body.model = model;
402
+ if (imageUrl !== void 0) body.image_url = imageUrl;
403
+ if (callbackUrl !== void 0) body.callback_url = callbackUrl;
404
+ const result = await this.transport.request("POST", `/${provider}/videos`, { json: body });
405
+ const taskId = result.task_id;
406
+ if (!taskId || result.data && !shouldWait) return result;
407
+ const handle = new TaskHandle(taskId, `/${provider}/tasks`, this.transport);
408
+ if (shouldWait) return handle.wait({ pollInterval, maxWait });
409
+ return handle;
410
+ }
411
+ };
412
+
413
+ // src/resources/search.ts
414
+ var Search = class {
415
+ constructor(transport) {
416
+ this.transport = transport;
417
+ }
418
+ transport;
419
+ async google(opts) {
420
+ const { query, type = "search", country, language, page, ...rest } = opts;
421
+ const body = { query, type, ...rest };
422
+ if (country !== void 0) body.country = country;
423
+ if (language !== void 0) body.language = language;
424
+ if (page !== void 0) body.page = page;
425
+ return this.transport.request("POST", "/serp/google", { json: body });
426
+ }
427
+ };
428
+
429
+ // src/resources/tasks.ts
430
+ var SERVICE_TASK_ENDPOINTS = {
431
+ suno: "/suno/tasks",
432
+ producer: "/producer/tasks",
433
+ "nano-banana": "/nano-banana/tasks",
434
+ seedream: "/seedream/tasks",
435
+ seedance: "/seedance/tasks",
436
+ sora: "/sora/tasks",
437
+ midjourney: "/midjourney/tasks",
438
+ luma: "/luma/tasks",
439
+ veo: "/veo/tasks",
440
+ flux: "/flux/tasks",
441
+ kling: "/kling/tasks",
442
+ hailuo: "/hailuo/tasks",
443
+ wan: "/wan/tasks",
444
+ pika: "/pika/tasks",
445
+ pixverse: "/pixverse/tasks"
446
+ };
447
+ var Tasks = class {
448
+ constructor(transport) {
449
+ this.transport = transport;
450
+ }
451
+ transport;
452
+ async get(taskId, opts = {}) {
453
+ const service = opts.service ?? "suno";
454
+ const endpoint = SERVICE_TASK_ENDPOINTS[service] ?? `/${service}/tasks`;
455
+ return this.transport.request("POST", endpoint, {
456
+ json: { id: taskId, action: "retrieve" }
457
+ });
458
+ }
459
+ async wait(taskId, opts = {}) {
460
+ const service = opts.service ?? "suno";
461
+ const endpoint = SERVICE_TASK_ENDPOINTS[service] ?? `/${service}/tasks`;
462
+ const handle = new TaskHandle(taskId, endpoint, this.transport);
463
+ return handle.wait({ pollInterval: opts.pollInterval, maxWait: opts.maxWait });
464
+ }
465
+ };
466
+
467
+ // src/resources/files.ts
468
+ import * as fs from "fs";
469
+ import * as path from "path";
470
+ var Files = class {
471
+ constructor(transport) {
472
+ this.transport = transport;
473
+ }
474
+ transport;
475
+ async upload(file, opts = {}) {
476
+ let data;
477
+ let filename;
478
+ if (typeof file === "string") {
479
+ data = fs.readFileSync(file);
480
+ filename = opts.filename ?? path.basename(file);
481
+ } else {
482
+ data = file;
483
+ filename = opts.filename ?? "upload";
484
+ }
485
+ return this.transport.upload("/api/v1/files/", data, filename);
486
+ }
487
+ };
488
+
489
+ // src/resources/platform.ts
490
+ var Applications = class {
491
+ constructor(transport) {
492
+ this.transport = transport;
493
+ }
494
+ transport;
495
+ async list(params) {
496
+ return this.transport.request("GET", "/api/v1/applications/", { params, platform: true });
497
+ }
498
+ async create(opts) {
499
+ const { serviceId, ...rest } = opts;
500
+ return this.transport.request("POST", "/api/v1/applications/", {
501
+ json: { service_id: serviceId, ...rest },
502
+ platform: true
503
+ });
504
+ }
505
+ async get(applicationId) {
506
+ return this.transport.request("GET", `/api/v1/applications/${applicationId}/`, { platform: true });
507
+ }
508
+ };
509
+ var Credentials = class {
510
+ constructor(transport) {
511
+ this.transport = transport;
512
+ }
513
+ transport;
514
+ async list(params) {
515
+ return this.transport.request("GET", "/api/v1/credentials/", { params, platform: true });
516
+ }
517
+ async create(opts) {
518
+ const { applicationId, ...rest } = opts;
519
+ return this.transport.request("POST", "/api/v1/credentials/", {
520
+ json: { application_id: applicationId, ...rest },
521
+ platform: true
522
+ });
523
+ }
524
+ async rotate(credentialId) {
525
+ return this.transport.request("POST", `/api/v1/credentials/${credentialId}/rotate/`, { platform: true });
526
+ }
527
+ async delete(credentialId) {
528
+ return this.transport.request("DELETE", `/api/v1/credentials/${credentialId}/`, { platform: true });
529
+ }
530
+ };
531
+ var Models = class {
532
+ constructor(transport) {
533
+ this.transport = transport;
534
+ }
535
+ transport;
536
+ async list(params) {
537
+ return this.transport.request("GET", "/api/v1/models/", { params, platform: true });
538
+ }
539
+ };
540
+ var Config = class {
541
+ constructor(transport) {
542
+ this.transport = transport;
543
+ }
544
+ transport;
545
+ async get() {
546
+ return this.transport.request("GET", "/api/v1/config/", { platform: true });
547
+ }
548
+ };
549
+ var Platform = class {
550
+ applications;
551
+ credentials;
552
+ models;
553
+ config;
554
+ constructor(transport) {
555
+ this.applications = new Applications(transport);
556
+ this.credentials = new Credentials(transport);
557
+ this.models = new Models(transport);
558
+ this.config = new Config(transport);
559
+ }
560
+ };
561
+
562
+ // src/resources/openai.ts
563
+ var Completions = class {
564
+ constructor(transport) {
565
+ this.transport = transport;
566
+ }
567
+ transport;
568
+ async create(opts) {
569
+ const { model, messages, stream, ...rest } = opts;
570
+ const body = { model, messages, ...rest };
571
+ if (stream) {
572
+ body.stream = true;
573
+ return this.streamResponse(body);
574
+ }
575
+ return this.transport.request("POST", "/v1/chat/completions", { json: body });
576
+ }
577
+ async *streamResponse(body) {
578
+ for await (const chunk of this.transport.requestStream("POST", "/v1/chat/completions", { json: body })) {
579
+ yield JSON.parse(chunk);
580
+ }
581
+ }
582
+ };
583
+ var ChatNamespace = class {
584
+ completions;
585
+ constructor(transport) {
586
+ this.completions = new Completions(transport);
587
+ }
588
+ };
589
+ var Responses = class {
590
+ constructor(transport) {
591
+ this.transport = transport;
592
+ }
593
+ transport;
594
+ async create(opts) {
595
+ const { model, input, stream, ...rest } = opts;
596
+ const body = { model, input, ...rest };
597
+ if (stream) {
598
+ body.stream = true;
599
+ return this.streamResponse(body);
600
+ }
601
+ return this.transport.request("POST", "/openai/responses", { json: body });
602
+ }
603
+ async *streamResponse(body) {
604
+ for await (const chunk of this.transport.requestStream("POST", "/openai/responses", { json: body })) {
605
+ yield JSON.parse(chunk);
606
+ }
607
+ }
608
+ };
609
+ var OpenAI = class {
610
+ chat;
611
+ responses;
612
+ constructor(transport) {
613
+ this.chat = new ChatNamespace(transport);
614
+ this.responses = new Responses(transport);
615
+ }
616
+ };
617
+
618
+ // src/client.ts
619
+ var AceDataCloud = class {
620
+ chat;
621
+ images;
622
+ audio;
623
+ video;
624
+ search;
625
+ tasks;
626
+ files;
627
+ platform;
628
+ openai;
629
+ transport;
630
+ constructor(opts = {}) {
631
+ this.transport = new Transport({
632
+ apiToken: opts.apiToken,
633
+ baseURL: opts.baseURL,
634
+ platformBaseURL: opts.platformBaseURL,
635
+ timeout: opts.timeout,
636
+ maxRetries: opts.maxRetries,
637
+ headers: opts.headers
638
+ });
639
+ this.chat = new Chat(this.transport);
640
+ this.images = new Images(this.transport);
641
+ this.audio = new Audio(this.transport);
642
+ this.video = new Video(this.transport);
643
+ this.search = new Search(this.transport);
644
+ this.tasks = new Tasks(this.transport);
645
+ this.files = new Files(this.transport);
646
+ this.platform = new Platform(this.transport);
647
+ this.openai = new OpenAI(this.transport);
648
+ }
649
+ };
650
+ export {
651
+ APIError,
652
+ AceDataCloud,
653
+ AceDataCloudError,
654
+ AuthenticationError,
655
+ InsufficientBalanceError,
656
+ ModerationError,
657
+ RateLimitError,
658
+ ResourceDisabledError,
659
+ TaskHandle,
660
+ TimeoutError,
661
+ TokenMismatchError,
662
+ TransportError,
663
+ ValidationError
664
+ };
665
+ //# sourceMappingURL=index.mjs.map