@ai-sdk/bytedance 2.0.0-beta.5 → 2.0.0-beta.52

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/CHANGELOG.md CHANGED
@@ -1,5 +1,373 @@
1
1
  # @ai-sdk/bytedance
2
2
 
3
+ ## 2.0.0-beta.52
4
+
5
+ ### Patch Changes
6
+
7
+ - b8396f0: trigger initial beta release
8
+ - Updated dependencies [b8396f0]
9
+ - @ai-sdk/provider-utils@5.0.0-beta.49
10
+ - @ai-sdk/provider@4.0.0-beta.19
11
+
12
+ ## 2.0.0-canary.51
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [aeda373]
17
+ - Updated dependencies [375fdd7]
18
+ - Updated dependencies [b4507d5]
19
+ - @ai-sdk/provider-utils@5.0.0-canary.48
20
+
21
+ ## 2.0.0-canary.50
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [bae5e2b]
26
+ - @ai-sdk/provider-utils@5.0.0-canary.47
27
+
28
+ ## 2.0.0-canary.49
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [ce769dd]
33
+ - @ai-sdk/provider@4.0.0-canary.18
34
+ - @ai-sdk/provider-utils@5.0.0-canary.46
35
+
36
+ ## 2.0.0-canary.48
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [ee798eb]
41
+ - Updated dependencies [daf6637]
42
+ - @ai-sdk/provider-utils@5.0.0-canary.45
43
+
44
+ ## 2.0.0-canary.47
45
+
46
+ ### Patch Changes
47
+
48
+ - a2ad029: Fix ByteDance video payloads to tag the prompt image as the first frame when a last frame image is provided.
49
+
50
+ ## 2.0.0-canary.46
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [6c93e36]
55
+ - Updated dependencies [f617ac2]
56
+ - @ai-sdk/provider-utils@5.0.0-canary.44
57
+
58
+ ## 2.0.0-canary.45
59
+
60
+ ### Patch Changes
61
+
62
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
63
+ - Updated dependencies [7fc6bd6]
64
+ - @ai-sdk/provider-utils@5.0.0-canary.43
65
+ - @ai-sdk/provider@4.0.0-canary.17
66
+
67
+ ## 2.0.0-canary.44
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [a6617c5]
72
+ - @ai-sdk/provider-utils@5.0.0-canary.42
73
+
74
+ ## 2.0.0-canary.43
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [28dfa06]
79
+ - Updated dependencies [e93fa91]
80
+ - @ai-sdk/provider-utils@5.0.0-canary.41
81
+
82
+ ## 2.0.0-canary.42
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [a7de9c9]
87
+ - @ai-sdk/provider-utils@5.0.0-canary.40
88
+
89
+ ## 2.0.0-canary.41
90
+
91
+ ### Patch Changes
92
+
93
+ - Updated dependencies [105f95b]
94
+ - @ai-sdk/provider-utils@5.0.0-canary.39
95
+
96
+ ## 2.0.0-canary.40
97
+
98
+ ### Patch Changes
99
+
100
+ - Updated dependencies [ca446f8]
101
+ - @ai-sdk/provider-utils@5.0.0-canary.38
102
+
103
+ ## 2.0.0-canary.39
104
+
105
+ ### Patch Changes
106
+
107
+ - Updated dependencies [d848405]
108
+ - @ai-sdk/provider-utils@5.0.0-canary.37
109
+
110
+ ## 2.0.0-canary.38
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [ca39020]
115
+ - @ai-sdk/provider-utils@5.0.0-canary.36
116
+
117
+ ## 2.0.0-canary.37
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [f634bac]
122
+ - @ai-sdk/provider-utils@5.0.0-canary.35
123
+
124
+ ## 2.0.0-canary.36
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [69254e0]
129
+ - Updated dependencies [3015fc3]
130
+ - @ai-sdk/provider-utils@5.0.0-canary.34
131
+
132
+ ## 2.0.0-canary.35
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [2427d88]
137
+ - @ai-sdk/provider-utils@5.0.0-canary.33
138
+
139
+ ## 2.0.0-canary.34
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies [5463d0d]
144
+ - @ai-sdk/provider-utils@5.0.0-canary.32
145
+ - @ai-sdk/provider@4.0.0-canary.16
146
+
147
+ ## 2.0.0-canary.33
148
+
149
+ ### Patch Changes
150
+
151
+ - 0c4c275: trigger initial canary release
152
+ - Updated dependencies [0c4c275]
153
+ - @ai-sdk/provider-utils@5.0.0-canary.31
154
+ - @ai-sdk/provider@4.0.0-canary.15
155
+
156
+ ## 2.0.0-beta.32
157
+
158
+ ### Patch Changes
159
+
160
+ - Updated dependencies [08d2129]
161
+ - @ai-sdk/provider-utils@5.0.0-beta.30
162
+
163
+ ## 2.0.0-beta.31
164
+
165
+ ### Patch Changes
166
+
167
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
168
+ - Updated dependencies [9bd6512]
169
+ - Updated dependencies [258c093]
170
+ - Updated dependencies [b6783da]
171
+ - @ai-sdk/provider-utils@5.0.0-beta.29
172
+ - @ai-sdk/provider@4.0.0-beta.14
173
+
174
+ ## 2.0.0-beta.30
175
+
176
+ ### Patch Changes
177
+
178
+ - 9f0e36c: trigger release for all packages after provenance setup
179
+ - Updated dependencies [9f0e36c]
180
+ - @ai-sdk/provider@4.0.0-beta.13
181
+ - @ai-sdk/provider-utils@5.0.0-beta.28
182
+
183
+ ## 2.0.0-beta.29
184
+
185
+ ### Patch Changes
186
+
187
+ - Updated dependencies [785fe16]
188
+ - Updated dependencies [67df0a0]
189
+ - Updated dependencies [befb78c]
190
+ - Updated dependencies [0458559]
191
+ - Updated dependencies [5852c0a]
192
+ - Updated dependencies [fc92055]
193
+ - @ai-sdk/provider-utils@5.0.0-beta.27
194
+
195
+ ## 2.0.0-beta.28
196
+
197
+ ### Patch Changes
198
+
199
+ - Updated dependencies [2e98477]
200
+ - @ai-sdk/provider-utils@5.0.0-beta.26
201
+
202
+ ## 2.0.0-beta.27
203
+
204
+ ### Patch Changes
205
+
206
+ - Updated dependencies [eea8d98]
207
+ - @ai-sdk/provider-utils@5.0.0-beta.25
208
+
209
+ ## 2.0.0-beta.26
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [f807e45]
214
+ - @ai-sdk/provider-utils@5.0.0-beta.24
215
+
216
+ ## 2.0.0-beta.25
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [350ea38]
221
+ - @ai-sdk/provider-utils@5.0.0-beta.23
222
+
223
+ ## 2.0.0-beta.24
224
+
225
+ ### Patch Changes
226
+
227
+ - Updated dependencies [083947b]
228
+ - @ai-sdk/provider-utils@5.0.0-beta.22
229
+
230
+ ## 2.0.0-beta.23
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [add1126]
235
+ - @ai-sdk/provider-utils@5.0.0-beta.21
236
+
237
+ ## 2.0.0-beta.22
238
+
239
+ ### Patch Changes
240
+
241
+ - 12d239b: feat (provider/bytedance): add seedance 2.0 support
242
+
243
+ ## 2.0.0-beta.21
244
+
245
+ ### Patch Changes
246
+
247
+ - Updated dependencies [b3976a2]
248
+ - Updated dependencies [ff5eba1]
249
+ - @ai-sdk/provider-utils@5.0.0-beta.20
250
+ - @ai-sdk/provider@4.0.0-beta.12
251
+
252
+ ## 2.0.0-beta.20
253
+
254
+ ### Major Changes
255
+
256
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
257
+
258
+ ### Patch Changes
259
+
260
+ - Updated dependencies [ef992f8]
261
+ - @ai-sdk/provider@4.0.0-beta.11
262
+ - @ai-sdk/provider-utils@5.0.0-beta.19
263
+
264
+ ## 2.0.0-beta.19
265
+
266
+ ### Patch Changes
267
+
268
+ - Updated dependencies [90e2d8a]
269
+ - @ai-sdk/provider-utils@5.0.0-beta.18
270
+
271
+ ## 2.0.0-beta.18
272
+
273
+ ### Patch Changes
274
+
275
+ - Updated dependencies [3ae1786]
276
+ - @ai-sdk/provider-utils@5.0.0-beta.17
277
+
278
+ ## 2.0.0-beta.17
279
+
280
+ ### Patch Changes
281
+
282
+ - Updated dependencies [176466a]
283
+ - @ai-sdk/provider@4.0.0-beta.10
284
+ - @ai-sdk/provider-utils@5.0.0-beta.16
285
+
286
+ ## 2.0.0-beta.16
287
+
288
+ ### Patch Changes
289
+
290
+ - Updated dependencies [e311194]
291
+ - @ai-sdk/provider@4.0.0-beta.9
292
+ - @ai-sdk/provider-utils@5.0.0-beta.15
293
+
294
+ ## 2.0.0-beta.15
295
+
296
+ ### Patch Changes
297
+
298
+ - Updated dependencies [34bd95d]
299
+ - Updated dependencies [008271d]
300
+ - @ai-sdk/provider@4.0.0-beta.8
301
+ - @ai-sdk/provider-utils@5.0.0-beta.14
302
+
303
+ ## 2.0.0-beta.14
304
+
305
+ ### Patch Changes
306
+
307
+ - Updated dependencies [b0c2869]
308
+ - Updated dependencies [7e26e81]
309
+ - @ai-sdk/provider-utils@5.0.0-beta.13
310
+
311
+ ## 2.0.0-beta.13
312
+
313
+ ### Patch Changes
314
+
315
+ - Updated dependencies [46d1149]
316
+ - @ai-sdk/provider-utils@5.0.0-beta.12
317
+
318
+ ## 2.0.0-beta.12
319
+
320
+ ### Patch Changes
321
+
322
+ - Updated dependencies [6fd51c0]
323
+ - @ai-sdk/provider-utils@5.0.0-beta.11
324
+ - @ai-sdk/provider@4.0.0-beta.7
325
+
326
+ ## 2.0.0-beta.11
327
+
328
+ ### Patch Changes
329
+
330
+ - Updated dependencies [c29a26f]
331
+ - @ai-sdk/provider-utils@5.0.0-beta.10
332
+ - @ai-sdk/provider@4.0.0-beta.6
333
+
334
+ ## 2.0.0-beta.10
335
+
336
+ ### Patch Changes
337
+
338
+ - 38fc777: Add AI Gateway hint to provider READMEs
339
+
340
+ ## 2.0.0-beta.9
341
+
342
+ ### Patch Changes
343
+
344
+ - Updated dependencies [2e17091]
345
+ - @ai-sdk/provider-utils@5.0.0-beta.9
346
+
347
+ ## 2.0.0-beta.8
348
+
349
+ ### Patch Changes
350
+
351
+ - Updated dependencies [986c6fd]
352
+ - Updated dependencies [493295c]
353
+ - @ai-sdk/provider-utils@5.0.0-beta.8
354
+
355
+ ## 2.0.0-beta.7
356
+
357
+ ### Patch Changes
358
+
359
+ - Updated dependencies [1f509d4]
360
+ - @ai-sdk/provider-utils@5.0.0-beta.7
361
+ - @ai-sdk/provider@4.0.0-beta.5
362
+
363
+ ## 2.0.0-beta.6
364
+
365
+ ### Patch Changes
366
+
367
+ - Updated dependencies [3887c70]
368
+ - @ai-sdk/provider-utils@5.0.0-beta.6
369
+ - @ai-sdk/provider@4.0.0-beta.4
370
+
3
371
  ## 2.0.0-beta.5
4
372
 
5
373
  ### Patch Changes
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  The **ByteDance provider** for the [AI SDK](https://ai-sdk.dev/docs) contains video model support for ByteDance's Seedance family of video generation models through the [BytePlus ModelArk](https://docs.byteplus.com/en/docs/ModelArk/Video_Generation_API) platform.
4
4
 
5
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access ByteDance (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
6
+
5
7
  ## Setup
6
8
 
7
9
  The ByteDance provider is available in the `@ai-sdk/bytedance` module. You can install it with:
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ProviderV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
 
4
- type ByteDanceVideoModelId = 'seedance-1-5-pro-251215' | 'seedance-1-0-pro-250528' | 'seedance-1-0-pro-fast-251015' | 'seedance-1-0-lite-t2v-250428' | 'seedance-1-0-lite-i2v-250428' | (string & {});
4
+ type ByteDanceVideoModelId = 'dreamina-seedance-2-0-fast-260128' | 'dreamina-seedance-2-0-260128' | 'seedance-1-5-pro-251215' | 'seedance-1-0-pro-250528' | 'seedance-1-0-pro-fast-251015' | 'seedance-1-0-lite-t2v-250428' | 'seedance-1-0-lite-i2v-250428' | (string & {});
5
5
 
6
6
  interface ByteDanceProviderSettings {
7
7
  /**
@@ -52,6 +52,8 @@ type ByteDanceVideoProviderOptions = {
52
52
  draft?: boolean | null;
53
53
  lastFrameImage?: string | null;
54
54
  referenceImages?: string[] | null;
55
+ referenceVideos?: string[] | null;
56
+ referenceAudio?: string[] | null;
55
57
  pollIntervalMs?: number | null;
56
58
  pollTimeoutMs?: number | null;
57
59
  [key: string]: unknown;
package/dist/index.js CHANGED
@@ -1,39 +1,30 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- VERSION: () => VERSION,
24
- byteDance: () => byteDance,
25
- createByteDance: () => createByteDance
26
- });
27
- module.exports = __toCommonJS(index_exports);
28
-
29
1
  // src/bytedance-provider.ts
30
- var import_provider2 = require("@ai-sdk/provider");
31
- var import_provider_utils2 = require("@ai-sdk/provider-utils");
2
+ import {
3
+ NoSuchModelError
4
+ } from "@ai-sdk/provider";
5
+ import {
6
+ loadApiKey,
7
+ withoutTrailingSlash
8
+ } from "@ai-sdk/provider-utils";
32
9
 
33
10
  // src/bytedance-video-model.ts
34
- var import_provider = require("@ai-sdk/provider");
35
- var import_provider_utils = require("@ai-sdk/provider-utils");
36
- var import_v4 = require("zod/v4");
11
+ import {
12
+ AISDKError
13
+ } from "@ai-sdk/provider";
14
+ import {
15
+ combineHeaders,
16
+ convertImageModelFileToDataUri,
17
+ createJsonErrorResponseHandler,
18
+ createJsonResponseHandler,
19
+ delay,
20
+ getFromApi,
21
+ lazySchema,
22
+ parseProviderOptions,
23
+ postJsonToApi,
24
+ resolve,
25
+ zodSchema
26
+ } from "@ai-sdk/provider-utils";
27
+ import { z } from "zod/v4";
37
28
  var HANDLED_PROVIDER_OPTIONS = /* @__PURE__ */ new Set([
38
29
  "watermark",
39
30
  "generateAudio",
@@ -43,22 +34,26 @@ var HANDLED_PROVIDER_OPTIONS = /* @__PURE__ */ new Set([
43
34
  "draft",
44
35
  "lastFrameImage",
45
36
  "referenceImages",
37
+ "referenceVideos",
38
+ "referenceAudio",
46
39
  "pollIntervalMs",
47
40
  "pollTimeoutMs"
48
41
  ]);
49
- var byteDanceVideoProviderOptionsSchema = (0, import_provider_utils.lazySchema)(
50
- () => (0, import_provider_utils.zodSchema)(
51
- import_v4.z.object({
52
- watermark: import_v4.z.boolean().nullish(),
53
- generateAudio: import_v4.z.boolean().nullish(),
54
- cameraFixed: import_v4.z.boolean().nullish(),
55
- returnLastFrame: import_v4.z.boolean().nullish(),
56
- serviceTier: import_v4.z.enum(["default", "flex"]).nullish(),
57
- draft: import_v4.z.boolean().nullish(),
58
- lastFrameImage: import_v4.z.string().nullish(),
59
- referenceImages: import_v4.z.array(import_v4.z.string()).nullish(),
60
- pollIntervalMs: import_v4.z.number().positive().nullish(),
61
- pollTimeoutMs: import_v4.z.number().positive().nullish()
42
+ var byteDanceVideoProviderOptionsSchema = lazySchema(
43
+ () => zodSchema(
44
+ z.object({
45
+ watermark: z.boolean().nullish(),
46
+ generateAudio: z.boolean().nullish(),
47
+ cameraFixed: z.boolean().nullish(),
48
+ returnLastFrame: z.boolean().nullish(),
49
+ serviceTier: z.enum(["default", "flex"]).nullish(),
50
+ draft: z.boolean().nullish(),
51
+ lastFrameImage: z.string().nullish(),
52
+ referenceImages: z.array(z.string()).nullish(),
53
+ referenceVideos: z.array(z.string()).nullish(),
54
+ referenceAudio: z.array(z.string()).nullish(),
55
+ pollIntervalMs: z.number().positive().nullish(),
56
+ pollTimeoutMs: z.number().positive().nullish()
62
57
  }).passthrough()
63
58
  )
64
59
  );
@@ -118,7 +113,7 @@ var ByteDanceVideoModel = class {
118
113
  var _a, _b, _c, _d, _e, _f;
119
114
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
120
115
  const warnings = [];
121
- const byteDanceOptions = await (0, import_provider_utils.parseProviderOptions)({
116
+ const byteDanceOptions = await parseProviderOptions({
122
117
  provider: "bytedance",
123
118
  providerOptions: options.providerOptions,
124
119
  schema: byteDanceVideoProviderOptionsSchema
@@ -147,7 +142,8 @@ var ByteDanceVideoModel = class {
147
142
  if (options.image != null) {
148
143
  content.push({
149
144
  type: "image_url",
150
- image_url: { url: (0, import_provider_utils.convertImageModelFileToDataUri)(options.image) }
145
+ image_url: { url: convertImageModelFileToDataUri(options.image) },
146
+ ...(byteDanceOptions == null ? void 0 : byteDanceOptions.lastFrameImage) != null ? { role: "first_frame" } : {}
151
147
  });
152
148
  }
153
149
  if ((byteDanceOptions == null ? void 0 : byteDanceOptions.lastFrameImage) != null) {
@@ -166,6 +162,24 @@ var ByteDanceVideoModel = class {
166
162
  });
167
163
  }
168
164
  }
165
+ if ((byteDanceOptions == null ? void 0 : byteDanceOptions.referenceVideos) != null && byteDanceOptions.referenceVideos.length > 0) {
166
+ for (const videoUrl2 of byteDanceOptions.referenceVideos) {
167
+ content.push({
168
+ type: "video_url",
169
+ video_url: { url: videoUrl2 },
170
+ role: "reference_video"
171
+ });
172
+ }
173
+ }
174
+ if ((byteDanceOptions == null ? void 0 : byteDanceOptions.referenceAudio) != null && byteDanceOptions.referenceAudio.length > 0) {
175
+ for (const audioUrl of byteDanceOptions.referenceAudio) {
176
+ content.push({
177
+ type: "audio_url",
178
+ audio_url: { url: audioUrl },
179
+ role: "reference_audio"
180
+ });
181
+ }
182
+ }
169
183
  const body = {
170
184
  model: this.modelId,
171
185
  content
@@ -213,15 +227,15 @@ var ByteDanceVideoModel = class {
213
227
  }
214
228
  }
215
229
  const createUrl = `${this.config.baseURL}/contents/generations/tasks`;
216
- const { value: createResponse } = await (0, import_provider_utils.postJsonToApi)({
230
+ const { value: createResponse } = await postJsonToApi({
217
231
  url: createUrl,
218
- headers: (0, import_provider_utils.combineHeaders)(
219
- await (0, import_provider_utils.resolve)(this.config.headers),
232
+ headers: combineHeaders(
233
+ await resolve(this.config.headers),
220
234
  options.headers
221
235
  ),
222
236
  body,
223
237
  failedResponseHandler: byteDanceFailedResponseHandler,
224
- successfulResponseHandler: (0, import_provider_utils.createJsonResponseHandler)(
238
+ successfulResponseHandler: createJsonResponseHandler(
225
239
  byteDanceTaskResponseSchema
226
240
  ),
227
241
  abortSignal: options.abortSignal,
@@ -229,7 +243,7 @@ var ByteDanceVideoModel = class {
229
243
  });
230
244
  const taskId = createResponse.id;
231
245
  if (!taskId) {
232
- throw new import_provider.AISDKError({
246
+ throw new AISDKError({
233
247
  name: "BYTEDANCE_VIDEO_GENERATION_ERROR",
234
248
  message: "No task ID returned from API"
235
249
  });
@@ -241,14 +255,14 @@ var ByteDanceVideoModel = class {
241
255
  let responseHeaders;
242
256
  while (true) {
243
257
  const statusUrl = `${this.config.baseURL}/contents/generations/tasks/${taskId}`;
244
- const { value: statusResponse, responseHeaders: statusHeaders } = await (0, import_provider_utils.getFromApi)({
258
+ const { value: statusResponse, responseHeaders: statusHeaders } = await getFromApi({
245
259
  url: statusUrl,
246
- headers: (0, import_provider_utils.combineHeaders)(
247
- await (0, import_provider_utils.resolve)(this.config.headers),
260
+ headers: combineHeaders(
261
+ await resolve(this.config.headers),
248
262
  options.headers
249
263
  ),
250
264
  failedResponseHandler: byteDanceFailedResponseHandler,
251
- successfulResponseHandler: (0, import_provider_utils.createJsonResponseHandler)(
265
+ successfulResponseHandler: createJsonResponseHandler(
252
266
  byteDanceStatusResponseSchema
253
267
  ),
254
268
  abortSignal: options.abortSignal,
@@ -260,22 +274,22 @@ var ByteDanceVideoModel = class {
260
274
  break;
261
275
  }
262
276
  if (statusResponse.status === "failed") {
263
- throw new import_provider.AISDKError({
277
+ throw new AISDKError({
264
278
  name: "BYTEDANCE_VIDEO_GENERATION_FAILED",
265
279
  message: `Video generation failed: ${JSON.stringify(statusResponse)}`
266
280
  });
267
281
  }
268
282
  if (Date.now() - startTime > pollTimeoutMs) {
269
- throw new import_provider.AISDKError({
283
+ throw new AISDKError({
270
284
  name: "BYTEDANCE_VIDEO_GENERATION_TIMEOUT",
271
285
  message: `Video generation timed out after ${pollTimeoutMs}ms`
272
286
  });
273
287
  }
274
- await (0, import_provider_utils.delay)(pollIntervalMs, { abortSignal: options.abortSignal });
288
+ await delay(pollIntervalMs, { abortSignal: options.abortSignal });
275
289
  }
276
290
  const videoUrl = (_f = response.content) == null ? void 0 : _f.video_url;
277
291
  if (!videoUrl) {
278
- throw new import_provider.AISDKError({
292
+ throw new AISDKError({
279
293
  name: "BYTEDANCE_VIDEO_GENERATION_ERROR",
280
294
  message: "No video URL in response"
281
295
  });
@@ -303,28 +317,28 @@ var ByteDanceVideoModel = class {
303
317
  };
304
318
  }
305
319
  };
306
- var byteDanceTaskResponseSchema = import_v4.z.object({
307
- id: import_v4.z.string().nullish()
320
+ var byteDanceTaskResponseSchema = z.object({
321
+ id: z.string().nullish()
308
322
  });
309
- var byteDanceStatusResponseSchema = import_v4.z.object({
310
- id: import_v4.z.string().nullish(),
311
- model: import_v4.z.string().nullish(),
312
- status: import_v4.z.string(),
313
- content: import_v4.z.object({
314
- video_url: import_v4.z.string().nullish()
323
+ var byteDanceStatusResponseSchema = z.object({
324
+ id: z.string().nullish(),
325
+ model: z.string().nullish(),
326
+ status: z.string(),
327
+ content: z.object({
328
+ video_url: z.string().nullish()
315
329
  }).nullish(),
316
- usage: import_v4.z.object({
317
- completion_tokens: import_v4.z.number().nullish()
330
+ usage: z.object({
331
+ completion_tokens: z.number().nullish()
318
332
  }).nullish()
319
333
  });
320
- var byteDanceErrorSchema = import_v4.z.object({
321
- error: import_v4.z.object({
322
- message: import_v4.z.string(),
323
- code: import_v4.z.string().nullish()
334
+ var byteDanceErrorSchema = z.object({
335
+ error: z.object({
336
+ message: z.string(),
337
+ code: z.string().nullish()
324
338
  }).nullish(),
325
- message: import_v4.z.string().nullish()
339
+ message: z.string().nullish()
326
340
  });
327
- var byteDanceFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
341
+ var byteDanceFailedResponseHandler = createJsonErrorResponseHandler({
328
342
  errorSchema: byteDanceErrorSchema,
329
343
  errorToMessage: (data) => {
330
344
  var _a, _b, _c;
@@ -336,9 +350,9 @@ var byteDanceFailedResponseHandler = (0, import_provider_utils.createJsonErrorRe
336
350
  var defaultBaseURL = "https://ark.ap-southeast.bytepluses.com/api/v3";
337
351
  function createByteDance(options = {}) {
338
352
  var _a;
339
- const baseURL = (0, import_provider_utils2.withoutTrailingSlash)((_a = options.baseURL) != null ? _a : defaultBaseURL);
353
+ const baseURL = withoutTrailingSlash((_a = options.baseURL) != null ? _a : defaultBaseURL);
340
354
  const getHeaders = () => ({
341
- Authorization: `Bearer ${(0, import_provider_utils2.loadApiKey)({
355
+ Authorization: `Bearer ${loadApiKey({
342
356
  apiKey: options.apiKey,
343
357
  environmentVariableName: "ARK_API_KEY",
344
358
  description: "ByteDance ModelArk"
@@ -355,13 +369,13 @@ function createByteDance(options = {}) {
355
369
  return {
356
370
  specificationVersion: "v4",
357
371
  embeddingModel: (modelId) => {
358
- throw new import_provider2.NoSuchModelError({ modelId, modelType: "embeddingModel" });
372
+ throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
359
373
  },
360
374
  imageModel: (modelId) => {
361
- throw new import_provider2.NoSuchModelError({ modelId, modelType: "imageModel" });
375
+ throw new NoSuchModelError({ modelId, modelType: "imageModel" });
362
376
  },
363
377
  languageModel: (modelId) => {
364
- throw new import_provider2.NoSuchModelError({ modelId, modelType: "languageModel" });
378
+ throw new NoSuchModelError({ modelId, modelType: "languageModel" });
365
379
  },
366
380
  video: createVideoModel,
367
381
  videoModel: createVideoModel
@@ -370,11 +384,10 @@ function createByteDance(options = {}) {
370
384
  var byteDance = createByteDance();
371
385
 
372
386
  // src/version.ts
373
- var VERSION = "2.0.0-beta.5";
374
- // Annotate the CommonJS export names for ESM import in node:
375
- 0 && (module.exports = {
387
+ var VERSION = true ? "2.0.0-beta.52" : "0.0.0-test";
388
+ export {
376
389
  VERSION,
377
390
  byteDance,
378
391
  createByteDance
379
- });
392
+ };
380
393
  //# sourceMappingURL=index.js.map