sonilo 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -55,6 +55,12 @@ interface TextToMusicParams {
55
55
  mode?: "stream" | "async";
56
56
  /** Container for the async result. `wav` requires `mode: "async"`. Defaults to m4a server-side. */
57
57
  outputFormat?: "m4a" | "wav";
58
+ /** How many distinct music variants to generate in one request (1-10,
59
+ * default 1). Cost scales linearly, and values above 1 are never covered
60
+ * by the free trial. Values above 1 require `mode: "async"` — only
61
+ * meaningful via `submit()`; `stream()`/`generate()` never send it, since
62
+ * they always request a plain stream. */
63
+ variantsNum?: number;
58
64
  /** Bounds the stream: aborting this cancels the in-flight generation.
59
65
  * Passed straight through to `fetch` — it is never rewrapped as
60
66
  * RequestTimeoutError, since the client's own absolute timeout does not
@@ -93,6 +99,12 @@ interface VideoToMusicParams {
93
99
  * Default-ON server-side in async mode: leave unset to keep it on, pass
94
100
  * `false` to opt out. Free, best-effort; only valid on `submit()`. */
95
101
  ducking?: boolean;
102
+ /** How many distinct music variants to generate in one request (1-10,
103
+ * default 1). Cost scales linearly, and values above 1 are never covered
104
+ * by the free trial. Values above 1 require `mode: "async"` (auto-selected
105
+ * by `submit()`) — only meaningful via `submit()`; `stream()`/`generate()`
106
+ * never send it, since they always request a plain stream. */
107
+ variantsNum?: number;
96
108
  }
97
109
  /** One service's free-trial allowance. `remaining` is already floored at 0,
98
110
  * so it is safe to compare directly. */
@@ -171,6 +183,11 @@ interface BaseTaskResult {
171
183
  cost?: number;
172
184
  error?: SfxError;
173
185
  refunded?: boolean;
186
+ /** Echoes the request's `variantsNum`. Present regardless of task status
187
+ * (so a `processing`/`failed` poll explains the charge too), but only
188
+ * when it was above 1 — a default (single-variant) request sees the same
189
+ * shape it always has. */
190
+ variants_num?: number;
174
191
  [key: string]: unknown;
175
192
  }
176
193
  /** State of an SFX task (`tasks.get`) or its final result (`wait`/`generate`). */
@@ -198,6 +215,11 @@ interface MusicMediaEntry extends SfxMedia {
198
215
  stream_index: number;
199
216
  sample_rate?: number;
200
217
  channels?: number;
218
+ /** This entry's own title, present when `variantsNum` was above 1 (and
219
+ * titles are visible on the account). Each variant is a distinct creative
220
+ * direction, so it can carry its own title rather than sharing the
221
+ * top-level `MusicTaskResult.title`, which always names variant 0. */
222
+ title?: MusicTitle;
201
223
  }
202
224
  /** One muxed audio+video-aligned output, present only when `isolateVocals`
203
225
  * is set. */
@@ -213,13 +235,20 @@ interface MusicTitle {
213
235
  * (`tasks.wait<MusicTaskResult>()`). Only reachable via `videoToMusic.submit()`
214
236
  * with `mode: "async"`. */
215
237
  interface MusicTaskResult extends BaseTaskResult {
238
+ /** One entry per stream, or one entry per variant when `variantsNum` was
239
+ * greater than 1 — each variant entry may carry its own `title`. */
216
240
  audio?: MusicMediaEntry[];
217
241
  /** Vocals-only stem; present only when `isolateVocals` was requested. */
218
242
  vocals?: SfxMedia;
219
- /** Muxed output per stream; present only when `isolateVocals` was requested. */
243
+ /** Muxed output per stream (or per variant); present only when
244
+ * `isolateVocals` was requested. */
220
245
  mux?: MusicMuxEntry[];
221
- /** Music ducked under the source voice; present only when `ducking` ran. */
246
+ /** Music ducked under the source voice (per variant when `variantsNum` is
247
+ * above 1); present only when `ducking` ran. */
222
248
  ducked?: MusicMediaEntry[];
249
+ /** Variant 0's title — the top-level field always names the first variant,
250
+ * even when `variantsNum` produced others with their own titles on
251
+ * `audio[]`. */
223
252
  title?: MusicTitle;
224
253
  duration_seconds?: number;
225
254
  }
@@ -232,6 +261,11 @@ interface WaitOptions {
232
261
  /** Result of an async video-to-video task (`videoToVideoMusic`/`videoToVideoSfx`):
233
262
  * a re-hosted video with generated music or SFX muxed in. */
234
263
  interface VideoResult extends BaseTaskResult {
264
+ /** One re-hosted video per variant. On `videoToVideoMusic` this is
265
+ * populated even at the default `variantsNum` of 1 (as a single-entry
266
+ * array); `videoToVideoSfx` has no variants knob and always sends one. */
267
+ videos?: SfxMedia[];
268
+ /** Permanent alias for `videos[0]`. */
235
269
  video?: SfxMedia;
236
270
  duration_seconds?: number;
237
271
  }
@@ -244,6 +278,11 @@ interface VideoToVideoMusicParams {
244
278
  preserveSpeech?: boolean;
245
279
  /** @deprecated Legacy alias for `preserveSpeech`. */
246
280
  isolateVocals?: boolean;
281
+ /** How many distinct music variants to generate in one request (1-10,
282
+ * default 1). Cost scales linearly, and values above 1 are never covered
283
+ * by the free trial. This endpoint is always async, so no extra `mode`
284
+ * gating applies. The result's `videos[]` gets one entry per variant. */
285
+ variantsNum?: number;
247
286
  }
248
287
  interface VideoToVideoSfxParams {
249
288
  video?: VideoInput;
@@ -267,6 +306,24 @@ interface VideoToSoundParams {
267
306
  /** Duck the generated music under the source speech. Default-ON
268
307
  * server-side: leave unset to keep it on, pass `false` to opt out. */
269
308
  ducking?: boolean;
309
+ /** How many distinct variants to generate in one request (1-10, default
310
+ * 1). Cost scales linearly, and values above 1 are never covered by the
311
+ * free trial. Both `videoToSound` and `videoToVideoSound` are always
312
+ * async, so no extra `mode` gating applies. The result's `outputs[]` gets
313
+ * one entry per variant. */
314
+ variantsNum?: number;
315
+ }
316
+ /** One variant's outputs on a `videoToSound` / `videoToVideoSound` result.
317
+ * Present even at the default `variantsNum` of 1, as a single-entry array. */
318
+ interface SoundOutputEntry {
319
+ variant_index: number;
320
+ output_url: string;
321
+ output_type: "audio" | "video";
322
+ output_bytes: number;
323
+ music?: SfxMedia;
324
+ /** Present only when `preserveSpeech`/`ducking` altered this variant's music bed. */
325
+ music_processed?: SfxMedia;
326
+ sfx?: SfxMedia;
270
327
  }
271
328
  /** Result of a `videoToSound` / `videoToVideoSound` task (`tasks.get`) or its
272
329
  * final state (`generate`).
@@ -275,7 +332,11 @@ interface VideoToSoundParams {
275
332
  * than a media object, since these endpoints render one artifact whose kind is
276
333
  * announced by `output_type` ("audio" for video-to-sound, "video" for
277
334
  * video-to-video-sound). `music`, `music_processed` and `sfx` are the
278
- * individual stems; pass any of them, or `output_url` itself, to `download()`. */
335
+ * individual stems; pass any of them, or `output_url` itself, to `download()`.
336
+ *
337
+ * `outputs` carries the same fields per variant when `variantsNum` was
338
+ * greater than 1; `output_url`/`output_type`/`output_bytes`/`music`/
339
+ * `music_processed`/`sfx` remain permanent aliases for `outputs[0]`. */
279
340
  interface SoundResult extends BaseTaskResult {
280
341
  output_url?: string;
281
342
  output_type?: "audio" | "video";
@@ -285,6 +346,8 @@ interface SoundResult extends BaseTaskResult {
285
346
  music_processed?: SfxMedia;
286
347
  sfx?: SfxMedia;
287
348
  duration_seconds?: number;
349
+ /** One entry per variant; see `SoundOutputEntry`. */
350
+ outputs?: SoundOutputEntry[];
288
351
  }
289
352
  /**
290
353
  * A target language for /v1/dubbing. The union stays open (`string & {}`) so a
@@ -302,6 +365,12 @@ interface DubbingParams {
302
365
  videoUrl?: string;
303
366
  /** Omit to get the server default, `["zh_cn", "es", "fr"]`. */
304
367
  languages?: DubbingLanguage[];
368
+ /**
369
+ * Duck the background music/effects bed under the dubbed voice. Default
370
+ * OFF server-side (the opposite of video-to-music's `ducking`): the bed
371
+ * is always kept, at a constant level unless this is `true`. Free.
372
+ */
373
+ ducking?: boolean;
305
374
  }
306
375
  interface DubbingResult extends BaseTaskResult {
307
376
  /**
@@ -352,7 +421,8 @@ declare class TextToMusic {
352
421
  /**
353
422
  * Submit an async text-to-music task; poll with
354
423
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
355
- * `outputFormat: "wav"`. `stream()`/`generate()` remain the streaming path.
424
+ * `outputFormat: "wav"` and `variantsNum` above 1. `stream()`/`generate()`
425
+ * remain the streaming path.
356
426
  */
357
427
  submit(params: TextToMusicParams): Promise<SfxTask>;
358
428
  }
@@ -365,8 +435,9 @@ declare class VideoToMusic {
365
435
  /**
366
436
  * Submit an async video-to-music task; poll its result with
367
437
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
368
- * `isolateVocals` the backend rejects vocal isolation on the plain
369
- * stream, and it only ever runs in async mode.
438
+ * `isolateVocals`/`preserveSpeech`, `outputFormat: "wav"`, and
439
+ * `variantsNum` above 1 the backend rejects all of these on the plain
440
+ * stream, and they only ever run in async mode.
370
441
  */
371
442
  submit(params: VideoToMusicParams): Promise<SfxTask>;
372
443
  }
@@ -550,6 +621,6 @@ declare class RequestTimeoutError extends SoniloError {
550
621
  declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
551
622
 
552
623
  /** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
553
- declare const VERSION = "0.7.0";
624
+ declare const VERSION = "0.9.0";
554
625
 
555
- export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
626
+ export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
package/dist/index.d.ts CHANGED
@@ -55,6 +55,12 @@ interface TextToMusicParams {
55
55
  mode?: "stream" | "async";
56
56
  /** Container for the async result. `wav` requires `mode: "async"`. Defaults to m4a server-side. */
57
57
  outputFormat?: "m4a" | "wav";
58
+ /** How many distinct music variants to generate in one request (1-10,
59
+ * default 1). Cost scales linearly, and values above 1 are never covered
60
+ * by the free trial. Values above 1 require `mode: "async"` — only
61
+ * meaningful via `submit()`; `stream()`/`generate()` never send it, since
62
+ * they always request a plain stream. */
63
+ variantsNum?: number;
58
64
  /** Bounds the stream: aborting this cancels the in-flight generation.
59
65
  * Passed straight through to `fetch` — it is never rewrapped as
60
66
  * RequestTimeoutError, since the client's own absolute timeout does not
@@ -93,6 +99,12 @@ interface VideoToMusicParams {
93
99
  * Default-ON server-side in async mode: leave unset to keep it on, pass
94
100
  * `false` to opt out. Free, best-effort; only valid on `submit()`. */
95
101
  ducking?: boolean;
102
+ /** How many distinct music variants to generate in one request (1-10,
103
+ * default 1). Cost scales linearly, and values above 1 are never covered
104
+ * by the free trial. Values above 1 require `mode: "async"` (auto-selected
105
+ * by `submit()`) — only meaningful via `submit()`; `stream()`/`generate()`
106
+ * never send it, since they always request a plain stream. */
107
+ variantsNum?: number;
96
108
  }
97
109
  /** One service's free-trial allowance. `remaining` is already floored at 0,
98
110
  * so it is safe to compare directly. */
@@ -171,6 +183,11 @@ interface BaseTaskResult {
171
183
  cost?: number;
172
184
  error?: SfxError;
173
185
  refunded?: boolean;
186
+ /** Echoes the request's `variantsNum`. Present regardless of task status
187
+ * (so a `processing`/`failed` poll explains the charge too), but only
188
+ * when it was above 1 — a default (single-variant) request sees the same
189
+ * shape it always has. */
190
+ variants_num?: number;
174
191
  [key: string]: unknown;
175
192
  }
176
193
  /** State of an SFX task (`tasks.get`) or its final result (`wait`/`generate`). */
@@ -198,6 +215,11 @@ interface MusicMediaEntry extends SfxMedia {
198
215
  stream_index: number;
199
216
  sample_rate?: number;
200
217
  channels?: number;
218
+ /** This entry's own title, present when `variantsNum` was above 1 (and
219
+ * titles are visible on the account). Each variant is a distinct creative
220
+ * direction, so it can carry its own title rather than sharing the
221
+ * top-level `MusicTaskResult.title`, which always names variant 0. */
222
+ title?: MusicTitle;
201
223
  }
202
224
  /** One muxed audio+video-aligned output, present only when `isolateVocals`
203
225
  * is set. */
@@ -213,13 +235,20 @@ interface MusicTitle {
213
235
  * (`tasks.wait<MusicTaskResult>()`). Only reachable via `videoToMusic.submit()`
214
236
  * with `mode: "async"`. */
215
237
  interface MusicTaskResult extends BaseTaskResult {
238
+ /** One entry per stream, or one entry per variant when `variantsNum` was
239
+ * greater than 1 — each variant entry may carry its own `title`. */
216
240
  audio?: MusicMediaEntry[];
217
241
  /** Vocals-only stem; present only when `isolateVocals` was requested. */
218
242
  vocals?: SfxMedia;
219
- /** Muxed output per stream; present only when `isolateVocals` was requested. */
243
+ /** Muxed output per stream (or per variant); present only when
244
+ * `isolateVocals` was requested. */
220
245
  mux?: MusicMuxEntry[];
221
- /** Music ducked under the source voice; present only when `ducking` ran. */
246
+ /** Music ducked under the source voice (per variant when `variantsNum` is
247
+ * above 1); present only when `ducking` ran. */
222
248
  ducked?: MusicMediaEntry[];
249
+ /** Variant 0's title — the top-level field always names the first variant,
250
+ * even when `variantsNum` produced others with their own titles on
251
+ * `audio[]`. */
223
252
  title?: MusicTitle;
224
253
  duration_seconds?: number;
225
254
  }
@@ -232,6 +261,11 @@ interface WaitOptions {
232
261
  /** Result of an async video-to-video task (`videoToVideoMusic`/`videoToVideoSfx`):
233
262
  * a re-hosted video with generated music or SFX muxed in. */
234
263
  interface VideoResult extends BaseTaskResult {
264
+ /** One re-hosted video per variant. On `videoToVideoMusic` this is
265
+ * populated even at the default `variantsNum` of 1 (as a single-entry
266
+ * array); `videoToVideoSfx` has no variants knob and always sends one. */
267
+ videos?: SfxMedia[];
268
+ /** Permanent alias for `videos[0]`. */
235
269
  video?: SfxMedia;
236
270
  duration_seconds?: number;
237
271
  }
@@ -244,6 +278,11 @@ interface VideoToVideoMusicParams {
244
278
  preserveSpeech?: boolean;
245
279
  /** @deprecated Legacy alias for `preserveSpeech`. */
246
280
  isolateVocals?: boolean;
281
+ /** How many distinct music variants to generate in one request (1-10,
282
+ * default 1). Cost scales linearly, and values above 1 are never covered
283
+ * by the free trial. This endpoint is always async, so no extra `mode`
284
+ * gating applies. The result's `videos[]` gets one entry per variant. */
285
+ variantsNum?: number;
247
286
  }
248
287
  interface VideoToVideoSfxParams {
249
288
  video?: VideoInput;
@@ -267,6 +306,24 @@ interface VideoToSoundParams {
267
306
  /** Duck the generated music under the source speech. Default-ON
268
307
  * server-side: leave unset to keep it on, pass `false` to opt out. */
269
308
  ducking?: boolean;
309
+ /** How many distinct variants to generate in one request (1-10, default
310
+ * 1). Cost scales linearly, and values above 1 are never covered by the
311
+ * free trial. Both `videoToSound` and `videoToVideoSound` are always
312
+ * async, so no extra `mode` gating applies. The result's `outputs[]` gets
313
+ * one entry per variant. */
314
+ variantsNum?: number;
315
+ }
316
+ /** One variant's outputs on a `videoToSound` / `videoToVideoSound` result.
317
+ * Present even at the default `variantsNum` of 1, as a single-entry array. */
318
+ interface SoundOutputEntry {
319
+ variant_index: number;
320
+ output_url: string;
321
+ output_type: "audio" | "video";
322
+ output_bytes: number;
323
+ music?: SfxMedia;
324
+ /** Present only when `preserveSpeech`/`ducking` altered this variant's music bed. */
325
+ music_processed?: SfxMedia;
326
+ sfx?: SfxMedia;
270
327
  }
271
328
  /** Result of a `videoToSound` / `videoToVideoSound` task (`tasks.get`) or its
272
329
  * final state (`generate`).
@@ -275,7 +332,11 @@ interface VideoToSoundParams {
275
332
  * than a media object, since these endpoints render one artifact whose kind is
276
333
  * announced by `output_type` ("audio" for video-to-sound, "video" for
277
334
  * video-to-video-sound). `music`, `music_processed` and `sfx` are the
278
- * individual stems; pass any of them, or `output_url` itself, to `download()`. */
335
+ * individual stems; pass any of them, or `output_url` itself, to `download()`.
336
+ *
337
+ * `outputs` carries the same fields per variant when `variantsNum` was
338
+ * greater than 1; `output_url`/`output_type`/`output_bytes`/`music`/
339
+ * `music_processed`/`sfx` remain permanent aliases for `outputs[0]`. */
279
340
  interface SoundResult extends BaseTaskResult {
280
341
  output_url?: string;
281
342
  output_type?: "audio" | "video";
@@ -285,6 +346,8 @@ interface SoundResult extends BaseTaskResult {
285
346
  music_processed?: SfxMedia;
286
347
  sfx?: SfxMedia;
287
348
  duration_seconds?: number;
349
+ /** One entry per variant; see `SoundOutputEntry`. */
350
+ outputs?: SoundOutputEntry[];
288
351
  }
289
352
  /**
290
353
  * A target language for /v1/dubbing. The union stays open (`string & {}`) so a
@@ -302,6 +365,12 @@ interface DubbingParams {
302
365
  videoUrl?: string;
303
366
  /** Omit to get the server default, `["zh_cn", "es", "fr"]`. */
304
367
  languages?: DubbingLanguage[];
368
+ /**
369
+ * Duck the background music/effects bed under the dubbed voice. Default
370
+ * OFF server-side (the opposite of video-to-music's `ducking`): the bed
371
+ * is always kept, at a constant level unless this is `true`. Free.
372
+ */
373
+ ducking?: boolean;
305
374
  }
306
375
  interface DubbingResult extends BaseTaskResult {
307
376
  /**
@@ -352,7 +421,8 @@ declare class TextToMusic {
352
421
  /**
353
422
  * Submit an async text-to-music task; poll with
354
423
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
355
- * `outputFormat: "wav"`. `stream()`/`generate()` remain the streaming path.
424
+ * `outputFormat: "wav"` and `variantsNum` above 1. `stream()`/`generate()`
425
+ * remain the streaming path.
356
426
  */
357
427
  submit(params: TextToMusicParams): Promise<SfxTask>;
358
428
  }
@@ -365,8 +435,9 @@ declare class VideoToMusic {
365
435
  /**
366
436
  * Submit an async video-to-music task; poll its result with
367
437
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
368
- * `isolateVocals` the backend rejects vocal isolation on the plain
369
- * stream, and it only ever runs in async mode.
438
+ * `isolateVocals`/`preserveSpeech`, `outputFormat: "wav"`, and
439
+ * `variantsNum` above 1 the backend rejects all of these on the plain
440
+ * stream, and they only ever run in async mode.
370
441
  */
371
442
  submit(params: VideoToMusicParams): Promise<SfxTask>;
372
443
  }
@@ -550,6 +621,6 @@ declare class RequestTimeoutError extends SoniloError {
550
621
  declare function download(media: SfxMedia | string | undefined, fetchFn?: typeof globalThis.fetch, timeout?: number): Promise<Uint8Array>;
551
622
 
552
623
  /** The SDK's own version. Generated by scripts/sync-versions.mjs — do not edit. */
553
- declare const VERSION = "0.7.0";
624
+ declare const VERSION = "0.9.0";
554
625
 
555
- export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
626
+ export { APIError, type AccountServices, type AudioChunkEvent, AuthenticationError, BadRequestError, type BaseTaskResult, type CompleteEvent, type CostEvent, type CostInfo, DEFAULT_TIMEOUT_MS, type DailyUsage, type DubbingLanguage, type DubbingParams, type DubbingResult, type ErrorEvent, GenerationError, type MusicMediaEntry, type MusicMuxEntry, type MusicTaskResult, type MusicTitle, PaymentRequiredError, RateLimitError, RequestTimeoutError, type Segment, type SegmentLabel, type SfxAudioFormat, type SfxError, type SfxMedia, type SfxResult, type SfxSegment, type SfxTask, SoniloClient, type SoniloClientOptions, SoniloError, type SoundOutputEntry, type SoundResult, type StreamEvent, TaskFailedError, TaskTimeoutError, type TextToMusicParams, type TextToSfxParams, type TitleEvent, type Track, TrialExhaustedError, type TrialQuota, type UnknownEvent, type UsageResponse, type UsageSummary, VERSION, type VideoInput, type VideoResult, type VideoToMusicParams, type VideoToSfxParams, type VideoToSoundParams, type VideoToVideoMusicParams, type VideoToVideoSfxParams, type WaitOptions, download, isAudioChunkEvent, isErrorEvent };
package/dist/index.js CHANGED
@@ -305,7 +305,8 @@ var TextToMusic = class {
305
305
  /**
306
306
  * Submit an async text-to-music task; poll with
307
307
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
308
- * `outputFormat: "wav"`. `stream()`/`generate()` remain the streaming path.
308
+ * `outputFormat: "wav"` and `variantsNum` above 1. `stream()`/`generate()`
309
+ * remain the streaming path.
309
310
  */
310
311
  async submit(params) {
311
312
  const mode = params.mode ?? "async";
@@ -322,6 +323,9 @@ var TextToMusic = class {
322
323
  if (params.outputFormat !== void 0) {
323
324
  form.set("output_format", params.outputFormat);
324
325
  }
326
+ if (params.variantsNum !== void 0) {
327
+ form.set("variants_num", String(params.variantsNum));
328
+ }
325
329
  const res = await this.client.request("/v1/text-to-music", {
326
330
  method: "POST",
327
331
  body: form
@@ -402,19 +406,20 @@ var VideoToMusic = class {
402
406
  /**
403
407
  * Submit an async video-to-music task; poll its result with
404
408
  * `client.tasks.wait<MusicTaskResult>(task.task_id)`. Required for
405
- * `isolateVocals` the backend rejects vocal isolation on the plain
406
- * stream, and it only ever runs in async mode.
409
+ * `isolateVocals`/`preserveSpeech`, `outputFormat: "wav"`, and
410
+ * `variantsNum` above 1 the backend rejects all of these on the plain
411
+ * stream, and they only ever run in async mode.
407
412
  */
408
413
  async submit(params) {
409
414
  if (params.video === void 0 === (params.videoUrl === void 0)) {
410
415
  throw new SoniloError("Provide exactly one of video or videoUrl");
411
416
  }
412
417
  let mode = params.mode;
413
- const needsAsync = params.isolateVocals || params.preserveSpeech || params.ducking !== void 0 || params.outputFormat === "wav";
418
+ const needsAsync = params.isolateVocals || params.preserveSpeech || params.ducking !== void 0 || params.outputFormat === "wav" || params.variantsNum !== void 0 && params.variantsNum > 1;
414
419
  if (mode === void 0) mode = "async";
415
420
  if (needsAsync && mode !== "async") {
416
421
  throw new SoniloError(
417
- 'isolateVocals/preserveSpeech/ducking/outputFormat "wav" require mode: "async"'
422
+ 'isolateVocals/preserveSpeech/ducking/outputFormat "wav"/variantsNum > 1 require mode: "async"'
418
423
  );
419
424
  }
420
425
  const form = new FormData();
@@ -441,6 +446,9 @@ var VideoToMusic = class {
441
446
  if (params.ducking !== void 0) {
442
447
  form.set("ducking", String(params.ducking));
443
448
  }
449
+ if (params.variantsNum !== void 0) {
450
+ form.set("variants_num", String(params.variantsNum));
451
+ }
444
452
  const res = await this.client.request("/v1/video-to-music", {
445
453
  method: "POST",
446
454
  body: form
@@ -527,6 +535,9 @@ var VideoToVideoMusic = class {
527
535
  if (params.isolateVocals !== void 0) {
528
536
  form.set("isolate_vocals", String(params.isolateVocals));
529
537
  }
538
+ if (params.variantsNum !== void 0) {
539
+ form.set("variants_num", String(params.variantsNum));
540
+ }
530
541
  const res = await this.client.request("/v1/video-to-video-music", {
531
542
  method: "POST",
532
543
  body: form
@@ -592,6 +603,9 @@ async function buildSoundForm(params) {
592
603
  form.set("preserve_speech", String(params.preserveSpeech));
593
604
  }
594
605
  if (params.ducking !== void 0) form.set("ducking", String(params.ducking));
606
+ if (params.variantsNum !== void 0) {
607
+ form.set("variants_num", String(params.variantsNum));
608
+ }
595
609
  return form;
596
610
  }
597
611
 
@@ -652,6 +666,9 @@ async function buildDubbingForm(params) {
652
666
  if (params.languages !== void 0) {
653
667
  form.set("languages", JSON.stringify(params.languages));
654
668
  }
669
+ if (params.ducking !== void 0) {
670
+ form.set("ducking", String(params.ducking));
671
+ }
655
672
  return form;
656
673
  }
657
674
  var Dubbing = class {
@@ -672,7 +689,7 @@ var Dubbing = class {
672
689
  };
673
690
 
674
691
  // src/version.ts
675
- var VERSION = "0.7.0";
692
+ var VERSION = "0.9.0";
676
693
 
677
694
  // src/client.ts
678
695
  var DEFAULT_BASE_URL = "https://api.sonilo.com";