@shop-os/modelkit 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -32,13 +32,13 @@ var ModelKitError = class _ModelKitError extends Error {
32
32
  this.finishReason = init.finishReason;
33
33
  this.usage = init.usage;
34
34
  }
35
- withUsage(usage5) {
35
+ withUsage(usage6) {
36
36
  const init = {
37
37
  code: this.code,
38
38
  message: this.message,
39
39
  cause: this.cause,
40
40
  retryable: this.retryable,
41
- usage: usage5
41
+ usage: usage6
42
42
  };
43
43
  if (this.provider !== void 0) init.provider = this.provider;
44
44
  if (this.model !== void 0) init.model = this.model;
@@ -366,7 +366,7 @@ var FAL_IMAGE_MODELS = [
366
366
  {
367
367
  // kling/v4/text-to-image; references switch to kling/v4/image-to-image (up to 10,
368
368
  // "@Image1".."@Image10"). Per output image: $0.063 at 2K, $0.094 at 4K (Kling price page,
369
- // 2026-11-17); each reference adds $0.003, which we absorb. Native 8K is ENG-4137.
369
+ // 2026-11-17), $0.157 at 8K; each reference adds $0.003, which we absorb.
370
370
  id: "kling-image-4.0",
371
371
  aliases: [],
372
372
  label: "Kling Image 4.0",
@@ -377,7 +377,7 @@ var FAL_IMAGE_MODELS = [
377
377
  exposure: EXPOSURE,
378
378
  constraints: {
379
379
  aspectRatios: [...KLING_RATIOS, "adaptive"],
380
- sizes: ["2K", "4K"],
380
+ sizes: ["2K", "4K", "8K"],
381
381
  references: { images: 10 },
382
382
  supports: ["count"],
383
383
  prompt: { referenceSyntax: "numbered", maxChars: 21e3 }
@@ -387,7 +387,7 @@ var FAL_IMAGE_MODELS = [
387
387
  pricingKind: "image_size",
388
388
  display: {
389
389
  provider: "kuaishou",
390
- description: "Kling Image 4.0 for photoreal text-to-image, long in-image text and multi-reference editing; takes a prompt and up to 10 reference images and outputs 2K or 4K.",
390
+ description: "Kling Image 4.0 for photoreal text-to-image, long in-image text and multi-reference editing; takes a prompt and up to 10 reference images and outputs 2K, 4K or 8K.",
391
391
  logo: `${LOBE}/kling-color.png`
392
392
  }
393
393
  },
@@ -2401,6 +2401,94 @@ var GEMINI_TTS_VOICES = [
2401
2401
  { id: "Zubenelgenubi", name: "Zubenelgenubi" }
2402
2402
  ];
2403
2403
 
2404
+ // src/catalog/speech-gemini-direct.ts
2405
+ var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
2406
+ var GEMINI_VOICE_CONSENT = {
2407
+ "ar-XA": "\u0623\u0646\u0627 \u0645\u0627\u0644\u0643 \u0647\u0630\u0627 \u0627\u0644\u0635\u0648\u062A \u0648\u0623\u0648\u0627\u0641\u0642 \u0639\u0644\u0649 \u0623\u0646 \u062A\u0633\u062A\u062E\u062F\u0645 Google \u0647\u0630\u0627 \u0627\u0644\u0635\u0648\u062A \u0644\u0625\u0646\u0634\u0627\u0621 \u0646\u0645\u0648\u0630\u062C \u0635\u0648\u062A\u064A \u0627\u0635\u0637\u0646\u0627\u0639\u064A.",
2408
+ "bn-IN": "\u0986\u09AE\u09BF \u098F\u0987 \u09AD\u09AF\u09BC\u09C7\u09B8\u09C7\u09B0 \u09AE\u09BE\u09B2\u09BF\u0995 \u098F\u09AC\u0982 \u0986\u09AE\u09BF \u098F\u0995\u099F\u09BF \u09B8\u09BF\u09A8\u09CD\u09A5\u09C7\u099F\u09BF\u0995 \u09AD\u09AF\u09BC\u09C7\u09B8 \u09AE\u09A1\u09C7\u09B2 \u09A4\u09C8\u09B0\u09BF \u0995\u09B0\u09A4\u09C7 \u098F\u0987 \u09AD\u09AF\u09BC\u09C7\u09B8 \u09AC\u09CD\u09AF\u09AC\u09B9\u09BE\u09B0 \u0995\u09B0\u09C7 Google-\u098F\u09B0 \u09B8\u09BE\u09A5\u09C7 \u09B8\u09AE\u09CD\u09AE\u09A4\u09BF \u09A6\u09BF\u099A\u09CD\u099B\u09BF\u0964",
2409
+ "de-DE": "Ich bin der Eigent\xFCmer dieser Stimme und bin damit einverstanden, dass Google diese Stimme zur Erstellung eines synthetischen Stimmmodells verwendet.",
2410
+ "en-AU": "I am the owner of this voice and I consent to Google using this voice to create a synthetic voice model.",
2411
+ "en-GB": "I am the owner of this voice and I consent to Google using this voice to create a synthetic voice model.",
2412
+ "en-IN": "I am the owner of this voice and I consent to Google using this voice to create a synthetic voice model.",
2413
+ "en-US": "I am the owner of this voice and I consent to Google using this voice to create a synthetic voice model.",
2414
+ "es-ES": "Soy el propietario de esta voz y doy mi consentimiento para que Google la utilice para crear un modelo de voz sint\xE9tica.",
2415
+ "es-US": "Soy el propietario de esta voz y doy mi consentimiento para que Google la utilice para crear un modelo de voz sint\xE9tica.",
2416
+ "fr-CA": "Je suis le propri\xE9taire de cette voix et j'autorise Google \xE0 utiliser cette voix pour cr\xE9er un mod\xE8le de voix synth\xE9tique.",
2417
+ "fr-FR": "Je suis le propri\xE9taire de cette voix et j'autorise Google \xE0 utiliser cette voix pour cr\xE9er un mod\xE8le de voix synth\xE9tique.",
2418
+ "gu-IN": "\u0AB9\u0AC1\u0A82 \u0A86 \u0AB5\u0ACB\u0A88\u0AB8\u0AA8\u0ACB \u0AAE\u0ABE\u0AB2\u0ABF\u0A95 \u0A9B\u0AC1\u0A82 \u0A85\u0AA8\u0AC7 \u0AB8\u0ABF\u0AA8\u0ACD\u0AA5\u0AC7\u0A9F\u0ABF\u0A95 \u0AB5\u0ACB\u0A88\u0AB8 \u0AAE\u0ACB\u0AA1\u0AB2 \u0AAC\u0AA8\u0ABE\u0AB5\u0AB5\u0ABE \u0AAE\u0ABE\u0A9F\u0AC7 \u0A86 \u0AB5\u0ACB\u0A88\u0AB8\u0AA8\u0ACB \u0A89\u0AAA\u0AAF\u0ACB\u0A97 \u0A95\u0AB0\u0AC0\u0AA8\u0AC7 google \u0AA8\u0AC7 \u0AB9\u0AC1\u0A82 \u0AB8\u0A82\u0AAE\u0AA4\u0ABF \u0A86\u0AAA\u0AC1\u0A82 \u0A9B\u0AC1\u0A82",
2419
+ "hi-IN": "\u092E\u0948\u0902 \u0907\u0938 \u0906\u0935\u093E\u091C \u0915\u093E \u092E\u093E\u0932\u093F\u0915 \u0939\u0942\u0902 \u0914\u0930 \u092E\u0948\u0902 \u0938\u093F\u0902\u0925\u0947\u091F\u093F\u0915 \u0906\u0935\u093E\u091C \u092E\u0949\u0921\u0932 \u092C\u0928\u093E\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F Google \u0915\u094B \u0907\u0938 \u0906\u0935\u093E\u091C \u0915\u093E \u0909\u092A\u092F\u094B\u0917 \u0915\u0930\u0928\u0947 \u0915\u0940 \u0938\u0939\u092E\u0924\u093F \u0926\u0947\u0924\u093E \u0939\u0942\u0902",
2420
+ "id-ID": "Saya pemilik suara ini dan saya menyetujui Google menggunakan suara ini untuk membuat model suara sintetis.",
2421
+ "it-IT": "Sono il proprietario di questa voce e acconsento che Google la utilizzi per creare un modello di voce sintetica.",
2422
+ "ja-JP": "\u79C1\u306F\u3053\u306E\u97F3\u58F0\u306E\u6240\u6709\u8005\u3067\u3042\u308A\u3001Google\u304C\u3053\u306E\u97F3\u58F0\u3092\u4F7F\u7528\u3057\u3066\u97F3\u58F0\u5408\u6210\u30E2\u30C7\u30EB\u3092\u4F5C\u6210\u3059\u308B\u3053\u3068\u3092\u627F\u8A8D\u3057\u307E\u3059\u3002",
2423
+ "kn-IN": "\u0CA8\u0CBE\u0CA8\u0CC1 \u0C88 \u0CA7\u0CCD\u0CB5\u0CA8\u0CBF\u0CAF \u0CAE\u0CBE\u0CB2\u0CBF\u0C95 \u0CAE\u0CA4\u0CCD\u0CA4\u0CC1 \u0CB8\u0C82\u0CB6\u0CCD\u0CB2\u0CC7\u0CB7\u0CBF\u0CA4 \u0CA7\u0CCD\u0CB5\u0CA8\u0CBF \u0CAE\u0CBE\u0CA6\u0CB0\u0CBF\u0CAF\u0CA8\u0CCD\u0CA8\u0CC1 \u0CB0\u0C9A\u0CBF\u0CB8\u0CB2\u0CC1 \u0C88 \u0CA7\u0CCD\u0CB5\u0CA8\u0CBF\u0CAF\u0CA8\u0CCD\u0CA8\u0CC1 \u0CAC\u0CB3\u0CB8\u0CBF\u0C95\u0CCA\u0C82\u0CA1\u0CC1\u0C97\u0CC2\u0C97\u0CB2\u0CCD \u0C97\u0CC6 \u0CA8\u0CBE\u0CA8\u0CC1 \u0CB8\u0CAE\u0CCD\u0CAE\u0CA4\u0CBF\u0CB8\u0CC1\u0CA4\u0CCD\u0CA4\u0CC7\u0CA8\u0CC6.",
2424
+ "ko-KR": "\uB098\uB294 \uC774 \uC74C\uC131\uC758 \uC18C\uC720\uC790\uC774\uBA70 \uAD6C\uAE00\uC774 \uC774 \uC74C\uC131\uC744 \uC0AC\uC6A9\uD558\uC5EC \uC74C\uC131 \uD569\uC131 \uBAA8\uB378\uC744 \uC0DD\uC131\uD560 \uAC83\uC744 \uD5C8\uC6A9\uD569\uB2C8\uB2E4.",
2425
+ "ml-IN": "\u0D08 \u0D36\u0D2C\u0D4D\u0D26\u0D24\u0D4D\u0D24\u0D3F\u0D28\u0D4D\u0D31\u0D46 \u0D09\u0D1F\u0D2E \u0D1E\u0D3E\u0D28\u0D3E\u0D23\u0D4D, \u0D12\u0D30\u0D41 \u0D38\u0D3F\u0D28\u0D4D\u0D24\u0D31\u0D4D\u0D31\u0D3F\u0D15\u0D4D \u0D35\u0D4B\u0D2F\u0D4D\u0D38\u0D4D \u0D2E\u0D4B\u0D21\u0D7D \u0D38\u0D43\u0D37\u0D4D\u0D1F\u0D3F\u0D15\u0D4D\u0D15\u0D3E\u0D7B \u0D08 \u0D36\u0D2C\u0D4D\u0D26\u0D02 \u0D09\u0D2A\u0D2F\u0D4B\u0D17\u0D3F\u0D15\u0D4D\u0D15\u0D41\u0D28\u0D4D\u0D28\u0D24\u0D3F\u0D28\u0D4D \u0D1E\u0D3E\u0D7B Google-\u0D28\u0D4D \u0D38\u0D2E\u0D4D\u0D2E\u0D24\u0D02 \u0D28\u0D7D\u0D15\u0D41\u0D28\u0D4D\u0D28\u0D41.",
2426
+ "mr-IN": "\u092E\u0940 \u092F\u093E \u0906\u0935\u093E\u091C\u093E\u091A\u093E \u092E\u093E\u0932\u0915 \u0906\u0939\u0947 \u0906\u0923\u093F \u0938\u093F\u0902\u0925\u0947\u091F\u093F\u0915 \u0935\u094D\u0939\u0949\u0907\u0938 \u092E\u0949\u0921\u0947\u0932 \u0924\u092F\u093E\u0930 \u0915\u0930\u0923\u094D\u092F\u093E\u0938\u093E\u0920\u0940 \u0939\u093E \u0906\u0935\u093E\u091C \u0935\u093E\u092A\u0930\u0923\u094D\u092F\u093E\u0938\u093E\u0920\u0940 \u092E\u0940 Google \u0932\u093E \u0938\u0902\u092E\u0924\u0940 \u0926\u0947\u0924\u094B",
2427
+ "nl-NL": "Ik ben de eigenaar van deze stem en ik geef Google toestemming om deze stem te gebruiken om een synthetisch stemmodel te maken.",
2428
+ "pl-PL": "Jestem w\u0142a\u015Bcicielem tego g\u0142osu i wyra\u017Cam zgod\u0119 na wykorzystanie go przez Google w celu utworzenia syntetycznego modelu g\u0142osu.",
2429
+ "pt-BR": "Eu sou o propriet\xE1rio desta voz e autorizo o Google a us\xE1-la para criar um modelo de voz sint\xE9tica.",
2430
+ "ru-RU": "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0432\u043B\u0430\u0434\u0435\u043B\u044C\u0446\u0435\u043C \u044D\u0442\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430 \u0438 \u0434\u0430\u044E \u0441\u043E\u0433\u043B\u0430\u0441\u0438\u0435 Google \u043D\u0430 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435 \u044D\u0442\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430 \u0434\u043B\u044F \u0441\u043E\u0437\u0434\u0430\u043D\u0438\u044F \u043C\u043E\u0434\u0435\u043B\u0438 \u0441\u0438\u043D\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430.",
2431
+ "ta-IN": "\u0BA8\u0BBE\u0BA9\u0BCD \u0B87\u0BA8\u0BCD\u0BA4 \u0B95\u0BC1\u0BB0\u0BB2\u0BBF\u0BA9\u0BCD \u0B89\u0BB0\u0BBF\u0BAE\u0BC8\u0BAF\u0BBE\u0BB3\u0BB0\u0BCD \u0BAE\u0BB1\u0BCD\u0BB1\u0BC1\u0BAE\u0BCD \u0B9A\u0BC6\u0BAF\u0BB1\u0BCD\u0B95\u0BC8 \u0B95\u0BC1\u0BB0\u0BB2\u0BCD \u0BAE\u0BBE\u0BA4\u0BBF\u0BB0\u0BBF\u0BAF\u0BC8 \u0B89\u0BB0\u0BC1\u0BB5\u0BBE\u0B95\u0BCD\u0B95 \u0B87\u0BA8\u0BCD\u0BA4 \u0B95\u0BC1\u0BB0\u0BB2\u0BC8 \u0BAA\u0BAF\u0BA9\u0BCD\u0BAA\u0B9F\u0BC1\u0BA4\u0BCD\u0BA4 \u0B95\u0BC1\u0B95\u0BB2\u0BCD\u0B95\u0BCD\u0B95\u0BC1 \u0BA8\u0BBE\u0BA9\u0BCD \u0B92\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BCD\u0B95\u0BCA\u0BB3\u0BCD\u0B95\u0BBF\u0BB1\u0BC7\u0BA9\u0BCD.",
2432
+ "te-IN": "\u0C28\u0C47\u0C28\u0C41 \u0C08 \u0C35\u0C3E\u0C2F\u0C3F\u0C38\u0C4D \u0C2F\u0C1C\u0C2E\u0C3E\u0C28\u0C3F\u0C28\u0C3F \u0C2E\u0C30\u0C3F\u0C2F\u0C41 \u0C38\u0C3F\u0C02\u0C24\u0C1F\u0C3F\u0C15\u0C4D \u0C35\u0C3E\u0C2F\u0C3F\u0C38\u0C4D \u0C2E\u0C4B\u0C21\u0C32\u0C4D \u0C28\u0C3F \u0C30\u0C42\u0C2A\u0C4A\u0C02\u0C26\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F \u0C08 \u0C35\u0C3E\u0C2F\u0C3F\u0C38\u0C4D \u0C28\u0C3F \u0C09\u0C2A\u0C2F\u0C4B\u0C17\u0C3F\u0C02\u0C1A\u0C21\u0C3E\u0C28\u0C3F\u0C15\u0C3F google\u0C15\u0C3F \u0C28\u0C47\u0C28\u0C41 \u0C38\u0C2E\u0C4D\u0C2E\u0C24\u0C3F\u0C38\u0C4D\u0C24\u0C41\u0C28\u0C4D\u0C28\u0C3E\u0C28\u0C41.",
2433
+ "th-TH": "\u0E09\u0E31\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E40\u0E08\u0E49\u0E32\u0E02\u0E2D\u0E07\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E19\u0E35\u0E49 \u0E41\u0E25\u0E30\u0E09\u0E31\u0E19\u0E22\u0E34\u0E19\u0E22\u0E2D\u0E21\u0E43\u0E2B\u0E49 Google \u0E43\u0E0A\u0E49\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E19\u0E35\u0E49\u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E2A\u0E23\u0E49\u0E32\u0E07\u0E41\u0E1A\u0E1A\u0E08\u0E33\u0E25\u0E2D\u0E07\u0E40\u0E2A\u0E35\u0E22\u0E07\u0E2A\u0E31\u0E07\u0E40\u0E04\u0E23\u0E32\u0E30\u0E2B\u0E4C",
2434
+ "tr-TR": "Bu sesin sahibi benim ve Google'\u0131n bu sesi kullanarak sentetik bir ses modeli olu\u015Fturmas\u0131na izin veriyorum.",
2435
+ "vi-VN": "T\xF4i l\xE0 ch\u1EE7 s\u1EDF h\u1EEFu gi\u1ECDng n\xF3i n\xE0y v\xE0 t\xF4i \u0111\u1ED3ng \xFD cho Google s\u1EED d\u1EE5ng gi\u1ECDng n\xF3i n\xE0y \u0111\u1EC3 t\u1EA1o m\xF4 h\xECnh gi\u1ECDng n\xF3i t\u1ED5ng h\u1EE3p.",
2436
+ "zh-CN": "\u6211\u662F\u6B64\u58F0\u97F3\u7684\u62E5\u6709\u8005\u5E76\u6388\u6743\u8C37\u6B4C\u4F7F\u7528\u6B64\u58F0\u97F3\u521B\u5EFA\u8BED\u97F3\u5408\u6210\u6A21\u578B"
2437
+ };
2438
+ var GEMINI_DIRECT_MODELS = [
2439
+ {
2440
+ id: "gemini-3.8-flash-tts-direct",
2441
+ aliases: [],
2442
+ label: "Gemini 3.8 Flash TTS",
2443
+ type: "speech",
2444
+ adapter: "google-genai",
2445
+ providerModelId: "gemini-3.8-flash-tts",
2446
+ lifecycle: "active",
2447
+ exposure: ["cowork"],
2448
+ constraints: {
2449
+ voices: GEMINI_TTS_VOICES,
2450
+ // Returns a 24 kHz mono WAV; the language is detected from the script.
2451
+ supports: ["style"],
2452
+ // Google's docs state no script limit; fal gives 8,192 input tokens for this model
2453
+ // (a token is at least one character), so the same cap is kept here.
2454
+ prompt: { referenceSyntax: "numbered", maxChars: 8192 }
2455
+ },
2456
+ defaults: { voice: "Kore" },
2457
+ usage: { unit: "images" },
2458
+ pricingKind: "flat",
2459
+ display: {
2460
+ provider: "google",
2461
+ logo: GOOGLE_LOGO,
2462
+ description: "Google Gemini 3.8 Flash text to speech in 30 prebuilt voices or your own replicated voice, with separate style instructions."
2463
+ },
2464
+ capabilities: { customVoices: true }
2465
+ },
2466
+ {
2467
+ id: "gemini-voice-clone",
2468
+ aliases: [],
2469
+ label: "Gemini Voice Replication",
2470
+ type: "voice-clone",
2471
+ adapter: "google-genai",
2472
+ providerModelId: "gemini-3.8-flash-tts",
2473
+ lifecycle: "active",
2474
+ exposure: ["cowork"],
2475
+ constraints: {
2476
+ // One 10-30 s recording, plus the consent recording. Google's samples are WAV.
2477
+ references: { audios: 1, audioFormats: ["wav"], audioSeconds: { min: 10, max: 30 } },
2478
+ supports: []
2479
+ },
2480
+ defaults: {},
2481
+ usage: { unit: "requests" },
2482
+ pricingKind: "flat",
2483
+ display: {
2484
+ provider: "google",
2485
+ logo: GOOGLE_LOGO,
2486
+ description: "Replicate a private, reusable voice from one 10 to 30 second recording and a spoken consent line, then speak with it on Gemini 3.8 Flash TTS."
2487
+ },
2488
+ capabilities: {}
2489
+ }
2490
+ ];
2491
+
2404
2492
  // src/catalog/voices-minimax.ts
2405
2493
  var MINIMAX_VOICES = [
2406
2494
  { id: "Wise_Woman", name: "Wise Woman" },
@@ -3901,7 +3989,7 @@ var MINIMAX_VOICES = [
3901
3989
 
3902
3990
  // src/catalog/media-nodes.ts
3903
3991
  var ELEVENLABS_LOGO2 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
3904
- var GOOGLE_LOGO = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
3992
+ var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
3905
3993
  var MINIMAX_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
3906
3994
  var SYNC_LOGO = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/sync.png";
3907
3995
  var PER_CALL3 = { unit: "images" };
@@ -3951,7 +4039,7 @@ function geminiTts(id, label, description) {
3951
4039
  defaults: { voice: "Kore" },
3952
4040
  usage: PER_CALL3,
3953
4041
  pricingKind: "flat",
3954
- display: { provider: "google", logo: GOOGLE_LOGO, description },
4042
+ display: { provider: "google", logo: GOOGLE_LOGO2, description },
3955
4043
  capabilities: {}
3956
4044
  };
3957
4045
  }
@@ -4197,7 +4285,8 @@ var MEDIA_NODE_MODELS = [
4197
4285
  },
4198
4286
  SAM_3_IMAGE,
4199
4287
  ...FISH_MODELS,
4200
- ...ELEVENLABS_DIRECT_MODELS
4288
+ ...ELEVENLABS_DIRECT_MODELS,
4289
+ ...GEMINI_DIRECT_MODELS
4201
4290
  ];
4202
4291
 
4203
4292
  // src/catalog/model3d.ts
@@ -4391,9 +4480,67 @@ var MODEL3D_MODELS = [
4391
4480
  )
4392
4481
  ];
4393
4482
 
4394
- // src/catalog/other.ts
4395
- var GOOGLE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
4483
+ // src/catalog/audio-elevenlabs-direct.ts
4396
4484
  var ELEVENLABS_LOGO3 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
4485
+ var ELEVENLABS_DIRECT_AUDIO_MODELS = [
4486
+ {
4487
+ id: "elevenlabs-music-direct",
4488
+ aliases: [],
4489
+ label: "Eleven Music",
4490
+ type: "audio",
4491
+ adapter: "elevenlabs",
4492
+ providerModelId: "music_v2_5",
4493
+ lifecycle: "active",
4494
+ exposure: ["cowork"],
4495
+ constraints: {
4496
+ // The API takes 3 s to 10 min; ElevenLabs' overview says 5 min, so stop there.
4497
+ durations: { min: 3, max: 300 },
4498
+ durationPresets: [30, 60, 120, 180],
4499
+ // No `seed`: the API refuses it with a prompt (composition plans only).
4500
+ supports: ["instrumental"],
4501
+ outputFormats: ELEVENLABS_MUSIC_FORMATS
4502
+ },
4503
+ defaults: { durationSeconds: 60, outputFormat: "mp3_48000_192" },
4504
+ usage: { unit: "seconds" },
4505
+ pricingKind: "flat",
4506
+ display: {
4507
+ provider: "elevenlabs",
4508
+ logo: ELEVENLABS_LOGO3,
4509
+ description: "Songs and instrumentals in any genre, from 3 seconds to 5 minutes."
4510
+ },
4511
+ capabilities: {}
4512
+ },
4513
+ {
4514
+ id: "elevenlabs-sound-effects-direct",
4515
+ aliases: [],
4516
+ label: "Eleven Sound Effects",
4517
+ type: "sound-effect",
4518
+ adapter: "elevenlabs",
4519
+ providerModelId: "eleven_text_to_sound_v3",
4520
+ lifecycle: "active",
4521
+ exposure: ["cowork"],
4522
+ constraints: {
4523
+ durations: { min: 0.5, max: 30 },
4524
+ durationPresets: [2, 5, 10, 22],
4525
+ supports: ["loop"],
4526
+ outputFormats: ELEVENLABS_MP3_FORMATS
4527
+ },
4528
+ // No default length: a request without one gets ElevenLabs' auto length.
4529
+ defaults: { outputFormat: "mp3_44100_128" },
4530
+ usage: { unit: "seconds" },
4531
+ pricingKind: "flat",
4532
+ display: {
4533
+ provider: "elevenlabs",
4534
+ logo: ELEVENLABS_LOGO3,
4535
+ description: "Any sound from a text description, up to 30 seconds, at a set or automatic length; can loop."
4536
+ },
4537
+ capabilities: {}
4538
+ }
4539
+ ];
4540
+
4541
+ // src/catalog/other.ts
4542
+ var GOOGLE_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
4543
+ var ELEVENLABS_LOGO4 = "https://cdn.jsdelivr.net/npm/@lobehub/icons-static-png@1.97.0/light/elevenlabs.png";
4397
4544
  var MINIMAX_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/f4c2e906-28b7-4a4a-b491-df8fef7808ed.png";
4398
4545
  var OTHER_MODELS = [
4399
4546
  {
@@ -4415,7 +4562,7 @@ var OTHER_MODELS = [
4415
4562
  pricingKind: "flat",
4416
4563
  display: {
4417
4564
  provider: "google",
4418
- logo: GOOGLE_LOGO2,
4565
+ logo: GOOGLE_LOGO3,
4419
4566
  description: "Google Lyria 3 Clip short music clips, loops, and previews; takes text and up to 10 image prompts and returns a fixed 30-second MP3 plus lyrics."
4420
4567
  },
4421
4568
  capabilities: {}
@@ -4438,7 +4585,7 @@ var OTHER_MODELS = [
4438
4585
  pricingKind: "flat",
4439
4586
  display: {
4440
4587
  provider: "google",
4441
- logo: GOOGLE_LOGO2,
4588
+ logo: GOOGLE_LOGO3,
4442
4589
  description: "Google Lyria 3 Pro flagship music model for full-length songs with verses, choruses, and bridges; takes text and up to 10 image prompts and returns MP3 plus lyrics."
4443
4590
  },
4444
4591
  capabilities: {}
@@ -4530,7 +4677,7 @@ var OTHER_MODELS = [
4530
4677
  pricingKind: "flat",
4531
4678
  display: {
4532
4679
  provider: "google",
4533
- logo: GOOGLE_LOGO2,
4680
+ logo: GOOGLE_LOGO3,
4534
4681
  description: "Google Lyria 3.5 full-length songs with verses, choruses and bridges; takes text and up to 10 image prompts and returns 44.1 kHz stereo MP3 plus lyrics."
4535
4682
  },
4536
4683
  capabilities: {}
@@ -4558,7 +4705,7 @@ var OTHER_MODELS = [
4558
4705
  pricingKind: "flat",
4559
4706
  display: {
4560
4707
  provider: "elevenlabs",
4561
- logo: ELEVENLABS_LOGO3,
4708
+ logo: ELEVENLABS_LOGO4,
4562
4709
  description: "ElevenLabs Music v2.5 text-to-music; full songs or instrumentals from 3 seconds to 1 minute."
4563
4710
  },
4564
4711
  capabilities: {}
@@ -4610,7 +4757,7 @@ var OTHER_MODELS = [
4610
4757
  pricingKind: "flat",
4611
4758
  display: {
4612
4759
  provider: "elevenlabs",
4613
- logo: ELEVENLABS_LOGO3,
4760
+ logo: ELEVENLABS_LOGO4,
4614
4761
  description: "ElevenLabs Sound Effects v2; a sound effect from a text description, up to 22 seconds."
4615
4762
  },
4616
4763
  capabilities: {}
@@ -4746,7 +4893,8 @@ var OTHER_MODELS = [
4746
4893
  provider: "prodia",
4747
4894
  description: "Background removal; takes one input image and returns a PNG cut-out of the subject plus an optional black-and-white mask."
4748
4895
  }
4749
- }
4896
+ },
4897
+ ...ELEVENLABS_DIRECT_AUDIO_MODELS
4750
4898
  ];
4751
4899
 
4752
4900
  // src/catalog/text.ts
@@ -6018,7 +6166,7 @@ var H3_PROMPT2 = { referenceSyntax: "numbered", maxChars: 5e4 };
6018
6166
  var WAN_PROMPT = { referenceSyntax: "numbered", maxChars: 2e4 };
6019
6167
  var OMNI_PROMPT = { referenceSyntax: "caption", maxChars: 5e4 };
6020
6168
  var BYTEDANCE_LOGO2 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/3bba5d81-4e57-4e71-911b-cdfa05acca2c_compressed.png";
6021
- var GOOGLE_LOGO3 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
6169
+ var GOOGLE_LOGO4 = "https://d31vvfpk2ppdyq.cloudfront.net/assets/image/192485d2-a76a-4657-9c06-930b2c70badd_compressed.png";
6022
6170
  var VIDEO_MODELS = [
6023
6171
  // Google shuts down the Veo 3.1 previews and Omni Flash 1.0 on 2026-10-22.
6024
6172
  {
@@ -6054,7 +6202,7 @@ var VIDEO_MODELS = [
6054
6202
  display: {
6055
6203
  provider: "google",
6056
6204
  description: "Google's highest-quality video generation model. Supports up to 4K resolution and 8-second clips with reference image conditioning.",
6057
- logo: GOOGLE_LOGO3
6205
+ logo: GOOGLE_LOGO4
6058
6206
  },
6059
6207
  // Veo's lastFrame "must be used in combination with the image parameter".
6060
6208
  capabilities: { ...FRAMES_EXCLUDE_REFERENCES, lastFrameRequiresFirstFrame: true }
@@ -6155,7 +6303,7 @@ var VIDEO_MODELS = [
6155
6303
  display: {
6156
6304
  provider: "google",
6157
6305
  description: "Google's conversational video model with native audio, human support, and natural language editing. Aspect ratio only \u2014 resolution and duration are model-determined.",
6158
- logo: GOOGLE_LOGO3
6306
+ logo: GOOGLE_LOGO4
6159
6307
  },
6160
6308
  capabilities: { acceptsSourceVideo: true, videoEdit: true }
6161
6309
  },
@@ -6192,7 +6340,7 @@ var VIDEO_MODELS = [
6192
6340
  pricingKind: "video_per_second",
6193
6341
  display: {
6194
6342
  provider: "google",
6195
- logo: GOOGLE_LOGO3,
6343
+ logo: GOOGLE_LOGO4,
6196
6344
  description: "Google Gemini Omni Flash 1.1 conversational video generation, editing and extension; text, image, and up to 10-second video input, 3-10 second output at up to 4K and 24 FPS, extendable to 40 seconds."
6197
6345
  },
6198
6346
  capabilities: {
@@ -6231,7 +6379,7 @@ var VIDEO_MODELS = [
6231
6379
  pricingKind: "video_per_second",
6232
6380
  display: {
6233
6381
  provider: "google",
6234
- logo: GOOGLE_LOGO3,
6382
+ logo: GOOGLE_LOGO4,
6235
6383
  description: "Google Gemini Omni Flash 1.2 conversational video generation, editing and extension; text, image, and up to 15-second video input, 3-15 second output at up to 4K and 24 FPS (start and end frames up to 10 seconds), extendable to 30 seconds."
6236
6384
  },
6237
6385
  capabilities: {
@@ -8247,6 +8395,7 @@ var SupportedOptionSchema = z3.enum([
8247
8395
  "videoExtension",
8248
8396
  "instrumental",
8249
8397
  "lyrics",
8398
+ "loop",
8250
8399
  "style",
8251
8400
  "insertWindow",
8252
8401
  "points",
@@ -9883,7 +10032,7 @@ async function generateAlibabaImage(req, ctx) {
9883
10032
  return { bytes: new Uint8Array(await res.arrayBuffer()), mime };
9884
10033
  })
9885
10034
  );
9886
- const usage5 = {
10035
+ const usage6 = {
9887
10036
  model: modelId,
9888
10037
  provider: "alibaba",
9889
10038
  modality: "IMAGE",
@@ -9891,9 +10040,9 @@ async function generateAlibabaImage(req, ctx) {
9891
10040
  quantity: data.usage?.output_image_count ?? images.length
9892
10041
  };
9893
10042
  const tier = billedTier(data.usage?.output_image_type, req.size);
9894
- if (tier !== void 0) usage5.imageSize = tier;
9895
- if (req.quality !== void 0) usage5.imageQuality = req.quality;
9896
- return { images, usage: usage5, raw: data };
10043
+ if (tier !== void 0) usage6.imageSize = tier;
10044
+ if (req.quality !== void 0) usage6.imageQuality = req.quality;
10045
+ return { images, usage: usage6, raw: data };
9897
10046
  }
9898
10047
 
9899
10048
  // src/adapters/alibaba-video.ts
@@ -10301,17 +10450,17 @@ var RENDERED = /* @__PURE__ */ new Map([
10301
10450
  [720, "720p"],
10302
10451
  [1080, "1080p"]
10303
10452
  ]);
10304
- function settleUsage(usage5, task) {
10453
+ function settleUsage(usage6, task) {
10305
10454
  const reported = task.usage;
10306
10455
  if (reported?.duration !== void 0 && reported.duration > 0) {
10307
- usage5.quantity = reported.duration;
10456
+ usage6.quantity = reported.duration;
10308
10457
  }
10309
10458
  const output = reported?.output_video_duration;
10310
- if (output !== void 0 && output > 0) usage5.durationSeconds = output;
10459
+ if (output !== void 0 && output > 0) usage6.durationSeconds = output;
10311
10460
  const rendered = reported?.SR === void 0 ? void 0 : RENDERED.get(reported.SR);
10312
- if (rendered !== void 0) usage5.resolution = rendered;
10461
+ if (rendered !== void 0) usage6.resolution = rendered;
10313
10462
  }
10314
- function alibabaVideoJob(ctx, jobId, usage5) {
10463
+ function alibabaVideoJob(ctx, jobId, usage6) {
10315
10464
  const { key } = alibabaCredentials(ctx);
10316
10465
  const modelId = ctx.model.id;
10317
10466
  const fetchTask = async () => {
@@ -10355,10 +10504,10 @@ function alibabaVideoJob(ctx, jobId, usage5) {
10355
10504
  if (!url) {
10356
10505
  throw alibabaError(void 0, "task succeeded with no video_url", modelId);
10357
10506
  }
10358
- settleUsage(usage5, task);
10507
+ settleUsage(usage6, task);
10359
10508
  return {
10360
10509
  video: { url, expiresAt: new Date(Date.now() + VIDEO_URL_TTL_MS) },
10361
- usage: usage5,
10510
+ usage: usage6,
10362
10511
  raw: task
10363
10512
  };
10364
10513
  }
@@ -10660,16 +10809,16 @@ async function generateSeedreamImage(req, ctx) {
10660
10809
  } else {
10661
10810
  throwArkError(void 0, "Seedream returned no image URL or base64 data", modelId);
10662
10811
  }
10663
- const usage5 = {
10812
+ const usage6 = {
10664
10813
  model: modelId,
10665
10814
  provider: "ark",
10666
10815
  modality: "IMAGE",
10667
10816
  unit: "images",
10668
10817
  quantity: 1
10669
10818
  };
10670
- if (req.size !== void 0) usage5.imageSize = req.size;
10671
- if (req.quality !== void 0) usage5.imageQuality = req.quality;
10672
- return { images: [{ bytes, mime: sniffedImageMime(bytes) }], usage: usage5, raw: data };
10819
+ if (req.size !== void 0) usage6.imageSize = req.size;
10820
+ if (req.quality !== void 0) usage6.imageQuality = req.quality;
10821
+ return { images: [{ bytes, mime: sniffedImageMime(bytes) }], usage: usage6, raw: data };
10673
10822
  }
10674
10823
  var SeedanceUsageSchema = z10.object({
10675
10824
  total_tokens: z10.number().optional(),
@@ -10724,7 +10873,7 @@ function seedanceErrorCode(error) {
10724
10873
  const parsed = SeedanceErrorSchema.safeParse(error);
10725
10874
  return parsed.success ? parsed.data.code : void 0;
10726
10875
  }
10727
- function seedanceJob(ctx, key, jobId, usage5) {
10876
+ function seedanceJob(ctx, key, jobId, usage6) {
10728
10877
  const modelId = ctx.model.id;
10729
10878
  const fetchStatus = async () => {
10730
10879
  const res = await arkFetch(ctx, `${arkBaseUrl(ctx)}${SUBMIT_PATH2}/${jobId}`, {
@@ -10774,21 +10923,21 @@ function seedanceJob(ctx, key, jobId, usage5) {
10774
10923
  modelId
10775
10924
  );
10776
10925
  if (polled.duration !== void 0 && polled.duration > 0) {
10777
- usage5.quantity = polled.duration;
10778
- usage5.durationSeconds = polled.duration;
10926
+ usage6.quantity = polled.duration;
10927
+ usage6.durationSeconds = polled.duration;
10779
10928
  }
10780
10929
  const rendered = VideoResolutionSchema.safeParse(
10781
10930
  polled.resolution?.toLowerCase()
10782
10931
  );
10783
- if (rendered.success) usage5.resolution = rendered.data;
10932
+ if (rendered.success) usage6.resolution = rendered.data;
10784
10933
  const tokens = polled.usage;
10785
10934
  if (tokens?.total_tokens !== void 0 && tokens.completion_tokens !== void 0) {
10786
- usage5.inputTokens = tokens.total_tokens - tokens.completion_tokens;
10787
- usage5.outputTokens = tokens.completion_tokens;
10935
+ usage6.inputTokens = tokens.total_tokens - tokens.completion_tokens;
10936
+ usage6.outputTokens = tokens.completion_tokens;
10788
10937
  }
10789
10938
  return {
10790
10939
  video: { url, expiresAt: new Date(Date.now() + VIDEO_URL_TTL_MS2) },
10791
- usage: usage5,
10940
+ usage: usage6,
10792
10941
  raw: polled
10793
10942
  };
10794
10943
  }
@@ -10941,8 +11090,8 @@ async function generateSeedanceVideo(req, ctx) {
10941
11090
  if (req.watermark !== void 0) body.watermark = req.watermark;
10942
11091
  if (ctx.model.constraints.draft) body.draft = true;
10943
11092
  const jobId = await submitSeedanceTask(ctx, key, body);
10944
- const usage5 = seedanceUsage(ctx, req, taskType === "edit" ? requestedDuration : duration);
10945
- return seedanceJob(ctx, key, jobId, usage5);
11093
+ const usage6 = seedanceUsage(ctx, req, taskType === "edit" ? requestedDuration : duration);
11094
+ return seedanceJob(ctx, key, jobId, usage6);
10946
11095
  }
10947
11096
 
10948
11097
  // src/adapters/fal.ts
@@ -12085,7 +12234,7 @@ async function collectFalPlanImages(payload, plan4, ctx, req) {
12085
12234
  return { bytes, mime: mime || "image/png" };
12086
12235
  })
12087
12236
  );
12088
- const usage5 = {
12237
+ const usage6 = {
12089
12238
  model: ctx.model.id,
12090
12239
  provider: "fal",
12091
12240
  modality: "IMAGE",
@@ -12093,9 +12242,9 @@ async function collectFalPlanImages(payload, plan4, ctx, req) {
12093
12242
  quantity: images.length
12094
12243
  };
12095
12244
  const billedSize = plan4.imageSize ?? req.size;
12096
- if (billedSize !== void 0 && ctx.model.type === "image") usage5.imageSize = billedSize;
12097
- if (plan4.imageQuality !== void 0) usage5.imageQuality = plan4.imageQuality;
12098
- const result = { images, usage: usage5, raw: payload };
12245
+ if (billedSize !== void 0 && ctx.model.type === "image") usage6.imageSize = billedSize;
12246
+ if (plan4.imageQuality !== void 0) usage6.imageQuality = plan4.imageQuality;
12247
+ const result = { images, usage: usage6, raw: payload };
12099
12248
  const remote = files.find((f) => !f.url.startsWith("data:"));
12100
12249
  if (remote !== void 0) result.outputUrl = remote.url;
12101
12250
  return result;
@@ -13942,6 +14091,11 @@ var DEFAULT_BASE_URL = "https://api.elevenlabs.io";
13942
14091
  var DEFAULT_FORMAT = "mp3_44100_128";
13943
14092
  var ELEVENLABS_TTS_MODEL_IDS = /* @__PURE__ */ new Set(["eleven_v4"]);
13944
14093
  var ELEVENLABS_IVC = "ivc";
14094
+ var ELEVENLABS_MUSIC_MODEL_IDS = /* @__PURE__ */ new Set(["music_v2_5", "music_v2"]);
14095
+ var ELEVENLABS_SFX_MODEL_IDS = /* @__PURE__ */ new Set([
14096
+ "eleven_text_to_sound_v3",
14097
+ "eleven_text_to_sound_v2"
14098
+ ]);
13945
14099
  var VOICE_ID = /^[A-Za-z0-9_-]{1,64}$/;
13946
14100
  function elevenLabsRowRefusal(row2) {
13947
14101
  const id = row2.providerModelId;
@@ -13951,6 +14105,12 @@ function elevenLabsRowRefusal(row2) {
13951
14105
  if (row2.type === "voice-clone") {
13952
14106
  return id === ELEVENLABS_IVC ? void 0 : `elevenlabs voice-clone rows need providerModelId ${ELEVENLABS_IVC}`;
13953
14107
  }
14108
+ if (row2.type === "audio") {
14109
+ return ELEVENLABS_MUSIC_MODEL_IDS.has(id) ? void 0 : `elevenlabs music rows need providerModelId ${[...ELEVENLABS_MUSIC_MODEL_IDS].join(", ")}`;
14110
+ }
14111
+ if (row2.type === "sound-effect") {
14112
+ return ELEVENLABS_SFX_MODEL_IDS.has(id) ? void 0 : `elevenlabs sound-effect rows need providerModelId ${[...ELEVENLABS_SFX_MODEL_IDS].join(", ")}`;
14113
+ }
13954
14114
  return `elevenlabs has no ${row2.type} rows`;
13955
14115
  }
13956
14116
  function elevenLabsError(ctx, code, message) {
@@ -14081,6 +14241,57 @@ async function generateSpeech(req, ctx) {
14081
14241
  throw elevenLabsError(ctx, "provider_rejected", "ElevenLabs TTS returned no audio");
14082
14242
  return { audio: { bytes, mime }, usage: usage2(ctx) };
14083
14243
  }
14244
+ function mp3Seconds(format, byteLength) {
14245
+ const kbps = /^mp3_\d+_(\d+)$/.exec(format)?.[1];
14246
+ if (kbps === void 0 || byteLength <= 0) return void 0;
14247
+ return Math.round(byteLength * 8 / (Number(kbps) * 1e3) * 10) / 10;
14248
+ }
14249
+ function audioCall(req, ctx) {
14250
+ const prompt = req.prompt.trim();
14251
+ if (prompt.length === 0) throw elevenLabsError(ctx, "missing_input", "needs a prompt");
14252
+ const format = encodeURIComponent(req.outputFormat ?? DEFAULT_FORMAT);
14253
+ const model_id = ctx.model.providerModelId;
14254
+ if (ctx.model.type === "audio") {
14255
+ const body2 = { prompt, model_id };
14256
+ if (req.durationSeconds !== void 0)
14257
+ body2["music_length_ms"] = Math.round(req.durationSeconds * 1e3);
14258
+ if (req.instrumental !== void 0) body2["force_instrumental"] = req.instrumental;
14259
+ return { path: `/v1/music?output_format=${format}`, body: body2 };
14260
+ }
14261
+ const body = { text: prompt, model_id };
14262
+ if (req.durationSeconds !== void 0) body["duration_seconds"] = req.durationSeconds;
14263
+ if (req.loop !== void 0) body["loop"] = req.loop;
14264
+ return { path: `/v1/sound-generation?output_format=${format}`, body };
14265
+ }
14266
+ async function generateAudio(req, ctx) {
14267
+ checkRow(ctx, ctx.model.type === "sound-effect" ? "sound-effect" : "audio");
14268
+ const { path, body } = audioCall(req, ctx);
14269
+ const { bytes, mime } = await withRetry(
14270
+ async () => {
14271
+ const res = await elevenLabsFetch(ctx, path, {
14272
+ method: "POST",
14273
+ headers: { "Content-Type": "application/json" },
14274
+ body: JSON.stringify(body)
14275
+ });
14276
+ let audio;
14277
+ try {
14278
+ audio = new Uint8Array(await res.arrayBuffer());
14279
+ } catch (cause) {
14280
+ throw classifyThrown("elevenlabs", cause, ctx.model.id);
14281
+ }
14282
+ return { bytes: audio, mime: audioMime(res) };
14283
+ },
14284
+ mediaRetryOptions(ctx.call, ctx.signal)
14285
+ );
14286
+ if (bytes.byteLength === 0)
14287
+ throw elevenLabsError(ctx, "provider_rejected", "ElevenLabs returned no audio");
14288
+ const seconds3 = mp3Seconds(req.outputFormat ?? DEFAULT_FORMAT, bytes.byteLength) ?? req.durationSeconds;
14289
+ const perSecond = ctx.model.usage.unit === "seconds";
14290
+ return {
14291
+ audio: { bytes, mime },
14292
+ usage: { ...usage2(ctx), quantity: perSecond ? seconds3 ?? 0 : 1 }
14293
+ };
14294
+ }
14084
14295
  var createdVoiceSchema = z24.object({
14085
14296
  voice_id: z24.string().min(1),
14086
14297
  requires_verification: z24.boolean().optional().catch(void 0)
@@ -14204,6 +14415,7 @@ async function deleteVoice(req, ctx) {
14204
14415
  }
14205
14416
  var elevenLabsAdapter = {
14206
14417
  id: "elevenlabs",
14418
+ generateAudio,
14207
14419
  generateSpeech,
14208
14420
  createVoice,
14209
14421
  deleteVoice
@@ -14489,14 +14701,228 @@ var fishAdapter = {
14489
14701
  deleteVoice: deleteVoice2
14490
14702
  };
14491
14703
 
14704
+ // src/adapters/google-voice.ts
14705
+ import { z as z26 } from "zod";
14706
+ var BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
14707
+ var PROVIDER = "google-genai";
14708
+ var GEMINI_TTS_MODEL_IDS = /* @__PURE__ */ new Set([
14709
+ "gemini-3.8-flash-tts",
14710
+ "gemini-3.8-flash-lite-tts"
14711
+ ]);
14712
+ var VOICE_ID3 = /^voice_[A-Za-z0-9_-]{1,128}$/;
14713
+ function googleVoiceRowRefusal(row2) {
14714
+ if (row2.type !== "speech" && row2.type !== "voice-clone") {
14715
+ return `google-genai has no ${row2.type} rows`;
14716
+ }
14717
+ return GEMINI_TTS_MODEL_IDS.has(row2.providerModelId) ? void 0 : `google-genai ${row2.type} rows need providerModelId ${[...GEMINI_TTS_MODEL_IDS].join(", ")}`;
14718
+ }
14719
+ function refuse(ctx, code, message) {
14720
+ return new ModelKitError({
14721
+ code,
14722
+ message,
14723
+ provider: PROVIDER,
14724
+ model: ctx.model.id,
14725
+ retryable: false
14726
+ });
14727
+ }
14728
+ function checkRow3(ctx, type) {
14729
+ const refusal3 = ctx.model.type === type ? googleVoiceRowRefusal(ctx.model) : `${ctx.model.id} is not a ${type} row`;
14730
+ if (refusal3 !== void 0) throw refuse(ctx, "unsupported_option", refusal3);
14731
+ }
14732
+ function googleKey(ctx) {
14733
+ const key = ctx.keys.google;
14734
+ if (!key) throw refuse(ctx, "auth", "Missing Google API key");
14735
+ return key;
14736
+ }
14737
+ async function googleFetch(ctx, path, init) {
14738
+ throwIfAborted(ctx.signal);
14739
+ const request = {
14740
+ method: init.method,
14741
+ headers: { "x-goog-api-key": googleKey(ctx), "Content-Type": "application/json" }
14742
+ };
14743
+ if (init.body !== void 0) request.body = JSON.stringify(init.body);
14744
+ if (ctx.signal !== void 0) request.signal = ctx.signal;
14745
+ let res;
14746
+ try {
14747
+ res = await ctx.fetch(`${BASE_URL}${path}`, request);
14748
+ } catch (cause) {
14749
+ throw classifyThrown(PROVIDER, cause, ctx.model.id);
14750
+ }
14751
+ if (!res.ok) throw classifyHttpError(res.status, await readBody(res), PROVIDER, ctx.model.id);
14752
+ return res;
14753
+ }
14754
+ function usage4(ctx) {
14755
+ return {
14756
+ model: ctx.model.id,
14757
+ provider: PROVIDER,
14758
+ modality: "AUDIO",
14759
+ unit: ctx.model.usage.unit,
14760
+ quantity: 1
14761
+ };
14762
+ }
14763
+ var interactionSchema = z26.object({
14764
+ steps: z26.array(
14765
+ z26.looseObject({
14766
+ type: z26.string().optional(),
14767
+ content: z26.array(
14768
+ z26.looseObject({
14769
+ type: z26.string().optional(),
14770
+ data: z26.string().optional(),
14771
+ mime_type: z26.string().optional()
14772
+ })
14773
+ ).optional()
14774
+ })
14775
+ ).optional()
14776
+ });
14777
+ function geminiSpeechBody(req, providerModelId) {
14778
+ const text2 = { type: "text", text: req.text };
14779
+ const style = req.style?.trim();
14780
+ if (style) text2["annotations"] = [{ type: "speech_metadata", style }];
14781
+ return {
14782
+ model: providerModelId,
14783
+ input: [{ type: "user_input", content: [text2] }],
14784
+ response_format: { type: "audio" },
14785
+ // A prebuilt voice name or a replicated voice id go in the same field.
14786
+ generation_config: { speech_config: [{ voice: req.customVoice ?? req.voice ?? "" }] }
14787
+ };
14788
+ }
14789
+ async function generateGeminiSpeech(req, ctx) {
14790
+ checkRow3(ctx, "speech");
14791
+ if (req.customVoice !== void 0 && !VOICE_ID3.test(req.customVoice)) {
14792
+ throw refuse(ctx, "unsupported_option", "customVoice is not a Gemini voice id");
14793
+ }
14794
+ if ((req.customVoice ?? req.voice) === void 0) {
14795
+ throw refuse(ctx, "missing_input", "needs a voice");
14796
+ }
14797
+ if (req.text.trim().length === 0) throw refuse(ctx, "missing_input", "needs a script");
14798
+ const body = geminiSpeechBody(req, ctx.model.providerModelId);
14799
+ const raw = await withRetry(
14800
+ async () => readBody(await googleFetch(ctx, "/interactions", { method: "POST", body })),
14801
+ mediaRetryOptions(ctx.call, ctx.signal)
14802
+ );
14803
+ const parsed = interactionSchema.safeParse(raw);
14804
+ const blocks = parsed.success ? (parsed.data.steps ?? []).filter((step) => step.type === "model_output").flatMap((step) => step.content ?? []) : [];
14805
+ const block = blocks.find((b) => b.type === "audio" && b.data);
14806
+ if (block?.data === void 0) {
14807
+ throw refuse(ctx, "provider_rejected", "Gemini TTS returned no audio");
14808
+ }
14809
+ return {
14810
+ audio: {
14811
+ bytes: new Uint8Array(Buffer.from(block.data, "base64")),
14812
+ mime: block.mime_type ?? "audio/wav"
14813
+ },
14814
+ usage: usage4(ctx)
14815
+ };
14816
+ }
14817
+ async function inlineAudio(ref, ctx) {
14818
+ const { bytes, mime } = await mediaRefToBytes(ref, ctx.fetch, {
14819
+ signal: ctx.signal,
14820
+ provider: PROVIDER,
14821
+ model: ctx.model.id
14822
+ });
14823
+ const type = mime.startsWith("audio/") ? mime : "audio/wav";
14824
+ return { mime_type: type, data: Buffer.from(bytes).toString("base64") };
14825
+ }
14826
+ var createdVoiceSchema2 = z26.object({ id: z26.string().regex(VOICE_ID3) });
14827
+ async function onlyRateLimitRetries3(fn) {
14828
+ try {
14829
+ return await fn();
14830
+ } catch (cause) {
14831
+ if (!isModelKitError(cause) || !cause.retryable || cause.code === "rate_limited")
14832
+ throw cause;
14833
+ throw new ModelKitError({
14834
+ code: cause.code,
14835
+ message: cause.message,
14836
+ ...cause.provider !== void 0 && { provider: cause.provider },
14837
+ ...cause.model !== void 0 && { model: cause.model },
14838
+ ...cause.status !== void 0 && { status: cause.status },
14839
+ ...cause.body !== void 0 && { body: cause.body },
14840
+ cause,
14841
+ retryable: false
14842
+ });
14843
+ }
14844
+ }
14845
+ async function createGeminiVoice(req, ctx) {
14846
+ checkRow3(ctx, "voice-clone");
14847
+ const [sample, ...rest] = req.samples;
14848
+ if (sample === void 0) throw refuse(ctx, "missing_input", "needs a voice sample");
14849
+ if (rest.length > 0) throw refuse(ctx, "unsupported_option", "takes one voice sample");
14850
+ if (sample.designSignature?.trim()) {
14851
+ throw refuse(ctx, "unsupported_option", "Gemini cannot keep a voice design signature");
14852
+ }
14853
+ if (req.consent === void 0) {
14854
+ throw refuse(ctx, "missing_input", "needs the consent recording");
14855
+ }
14856
+ const body = {
14857
+ store: true,
14858
+ voice: {
14859
+ model: ctx.model.providerModelId,
14860
+ type: "replicated",
14861
+ display_name: req.title.trim(),
14862
+ replicated: {
14863
+ source_audio: await inlineAudio(sample.audio, ctx),
14864
+ consent_audio: await inlineAudio(req.consent, ctx)
14865
+ }
14866
+ }
14867
+ };
14868
+ const res = await withRetry(
14869
+ () => onlyRateLimitRetries3(() => googleFetch(ctx, "/voices", { method: "POST", body })),
14870
+ mediaRetryOptions(ctx.call, ctx.signal)
14871
+ );
14872
+ const raw = await readBody(res);
14873
+ const parsed = createdVoiceSchema2.safeParse(raw);
14874
+ if (!parsed.success) {
14875
+ throw new ModelKitError({
14876
+ code: "provider_rejected",
14877
+ message: "Gemini returned no voice id",
14878
+ provider: PROVIDER,
14879
+ model: ctx.model.id,
14880
+ status: res.status,
14881
+ body: raw,
14882
+ retryable: false
14883
+ });
14884
+ }
14885
+ return { voiceId: parsed.data.id, state: "trained", usage: usage4(ctx), raw };
14886
+ }
14887
+ async function deleteGeminiVoice(req, ctx) {
14888
+ checkRow3(ctx, "voice-clone");
14889
+ if (!VOICE_ID3.test(req.voiceId)) {
14890
+ throw refuse(ctx, "unsupported_option", "voiceId is not a Gemini voice id");
14891
+ }
14892
+ let attempts = 0;
14893
+ await withRetry(
14894
+ async () => {
14895
+ attempts += 1;
14896
+ try {
14897
+ await googleFetch(ctx, `/voices/${encodeURIComponent(req.voiceId)}`, {
14898
+ method: "DELETE"
14899
+ });
14900
+ } catch (cause) {
14901
+ if (!isModelKitError(cause) || cause.status !== 404) throw cause;
14902
+ if (attempts > 1) return;
14903
+ throw new ModelKitError({
14904
+ code: "provider_rejected",
14905
+ message: `Gemini has no voice ${req.voiceId} under this key set; delete with the tier that created it`,
14906
+ provider: PROVIDER,
14907
+ model: ctx.model.id,
14908
+ status: 404,
14909
+ cause,
14910
+ retryable: false
14911
+ });
14912
+ }
14913
+ },
14914
+ mediaRetryOptions(ctx.call, ctx.signal)
14915
+ );
14916
+ }
14917
+
14492
14918
  // src/adapters/google-genai.ts
14493
- import { z as z27 } from "zod";
14919
+ import { z as z28 } from "zod";
14494
14920
  import {
14495
14921
  GoogleGenAI
14496
14922
  } from "@google/genai";
14497
14923
 
14498
14924
  // src/adapters/google-files.ts
14499
- import { z as z26 } from "zod";
14925
+ import { z as z27 } from "zod";
14500
14926
  var GOOGLE_FILES_BASE = "https://generativelanguage.googleapis.com";
14501
14927
  var GOOGLE_FILES_POLL_INTERVAL_MS = 2e3;
14502
14928
  var GOOGLE_FILES_POLL_TIMEOUT_MS = 5 * 60 * 1e3;
@@ -14506,17 +14932,17 @@ var GENERIC_MEDIA_TYPES = /* @__PURE__ */ new Set([
14506
14932
  "binary/octet-stream",
14507
14933
  "application/binary"
14508
14934
  ]);
14509
- var uploadedFileSchema = z26.object({
14510
- file: z26.object({
14511
- uri: z26.string().optional(),
14512
- name: z26.string().optional(),
14513
- state: z26.string().optional(),
14514
- mimeType: z26.string().optional()
14935
+ var uploadedFileSchema = z27.object({
14936
+ file: z27.object({
14937
+ uri: z27.string().optional(),
14938
+ name: z27.string().optional(),
14939
+ state: z27.string().optional(),
14940
+ mimeType: z27.string().optional()
14515
14941
  }).optional()
14516
14942
  });
14517
- var fileStateSchema = z26.object({
14518
- state: z26.string().optional(),
14519
- error: z26.object({ message: z26.string().optional() }).optional()
14943
+ var fileStateSchema = z27.object({
14944
+ state: z27.string().optional(),
14945
+ error: z27.object({ message: z27.string().optional() }).optional()
14520
14946
  });
14521
14947
  function resolveMime(declared, fallback) {
14522
14948
  const clean = declared?.split(";")[0]?.trim().toLowerCase();
@@ -14738,7 +15164,7 @@ var RESULT_TIMEOUT_MS4 = 15 * 60 * 1e3;
14738
15164
  var OMNI_INLINE_LIMIT_BYTES = 4 * 1024 * 1024;
14739
15165
  var OMNI_FRAMES_MAX_SECONDS = 10;
14740
15166
  var MEDIA_PART_INLINE_LIMIT_BYTES = 10 * 1024 * 1024;
14741
- var errorTextSchema = z27.string();
15167
+ var errorTextSchema = z28.string();
14742
15168
  function isGoogleGenaiVideoKnown(providerModelId) {
14743
15169
  return providerModelId.startsWith("veo-") || providerModelId.startsWith("gemini-omni");
14744
15170
  }
@@ -14775,13 +15201,16 @@ function createGoogleGenaiAdapter(deps = defaultDeps2) {
14775
15201
  model: ctx.model.id
14776
15202
  });
14777
15203
  },
15204
+ generateSpeech: generateGeminiSpeech,
15205
+ createVoice: createGeminiVoice,
15206
+ deleteVoice: deleteGeminiVoice,
14778
15207
  prepareMediaPart(ref, mediaType, ctx) {
14779
15208
  return prepareGoogleMediaPart(ref, mediaType, ctx);
14780
15209
  }
14781
15210
  };
14782
15211
  }
14783
15212
  var googleGenaiAdapter = createGoogleGenaiAdapter();
14784
- function googleKey(ctx) {
15213
+ function googleKey2(ctx) {
14785
15214
  const key = ctx.keys.google;
14786
15215
  if (!key) {
14787
15216
  throw new ModelKitError({
@@ -14843,7 +15272,7 @@ function videoUsage2(ctx, duration, resolution) {
14843
15272
  return event;
14844
15273
  }
14845
15274
  async function generateVeoVideo(req, ctx, createGenAIClient) {
14846
- const apiKey = googleKey(ctx);
15275
+ const apiKey = googleKey2(ctx);
14847
15276
  const modelId = ctx.model.id;
14848
15277
  const refs = req.referenceImages ?? [];
14849
15278
  if (req.firstFrame && refs.length > 0) {
@@ -14933,7 +15362,7 @@ async function generateVeoVideo(req, ctx, createGenAIClient) {
14933
15362
  }
14934
15363
  };
14935
15364
  const jobId = operation.name ?? crypto.randomUUID();
14936
- const usage5 = videoUsage2(ctx, duration, req.resolution ?? "720p");
15365
+ const usage6 = videoUsage2(ctx, duration, req.resolution ?? "720p");
14937
15366
  return {
14938
15367
  jobId,
14939
15368
  async poll() {
@@ -14971,7 +15400,7 @@ async function generateVeoVideo(req, ctx, createGenAIClient) {
14971
15400
  modelId
14972
15401
  );
14973
15402
  }
14974
- return { video: await downloadVideo(ctx, uri, apiKey, signal), usage: usage5, raw: finished };
15403
+ return { video: await downloadVideo(ctx, uri, apiKey, signal), usage: usage6, raw: finished };
14975
15404
  }
14976
15405
  };
14977
15406
  }
@@ -15008,7 +15437,7 @@ function extractOmniVideo(interaction, model) {
15008
15437
  );
15009
15438
  }
15010
15439
  async function generateOmniVideo(req, ctx, createGenAIClient) {
15011
- const apiKey = googleKey(ctx);
15440
+ const apiKey = googleKey2(ctx);
15012
15441
  const modelId = ctx.model.id;
15013
15442
  const providerModelId = ctx.model.providerModelId;
15014
15443
  const extend = req.taskType === "extend";
@@ -15183,7 +15612,7 @@ async function generateOmniVideo(req, ctx, createGenAIClient) {
15183
15612
  if (!(extend && !chained)) await cleanupUploads();
15184
15613
  }
15185
15614
  const jobId = interaction.id ?? crypto.randomUUID();
15186
- const usage5 = videoUsage2(ctx, duration, omniResolution ?? "720p");
15615
+ const usage6 = videoUsage2(ctx, duration, omniResolution ?? "720p");
15187
15616
  const getInteraction = async () => {
15188
15617
  try {
15189
15618
  const getParams = { stream: false };
@@ -15231,7 +15660,7 @@ async function generateOmniVideo(req, ctx, createGenAIClient) {
15231
15660
  bytes: Buffer.from(video.data, "base64"),
15232
15661
  mime: video.mime_type ?? "video/mp4"
15233
15662
  },
15234
- usage: usage5,
15663
+ usage: usage6,
15235
15664
  raw: done,
15236
15665
  providerRef
15237
15666
  };
@@ -15239,7 +15668,7 @@ async function generateOmniVideo(req, ctx, createGenAIClient) {
15239
15668
  if (video.uri)
15240
15669
  return {
15241
15670
  video: await downloadVideo(ctx, video.uri, apiKey, signal),
15242
- usage: usage5,
15671
+ usage: usage6,
15243
15672
  raw: done,
15244
15673
  providerRef
15245
15674
  };
@@ -15266,7 +15695,7 @@ function lyriaUsage(ctx, req, meta) {
15266
15695
  return event;
15267
15696
  }
15268
15697
  async function generateLyriaAudio(req, ctx, createGenAIClient) {
15269
- const apiKey = googleKey(ctx);
15698
+ const apiKey = googleKey2(ctx);
15270
15699
  const modelId = ctx.model.id;
15271
15700
  const parts = [{ text: req.prompt }];
15272
15701
  for (const ref of req.references ?? []) {
@@ -15328,7 +15757,7 @@ async function generateLyriaAudio(req, ctx, createGenAIClient) {
15328
15757
  return result;
15329
15758
  }
15330
15759
  async function generateLyriaInteraction(req, ctx, createGenAIClient) {
15331
- const apiKey = googleKey(ctx);
15760
+ const apiKey = googleKey2(ctx);
15332
15761
  const modelId = ctx.model.id;
15333
15762
  const input = [{ type: "text", text: req.prompt }];
15334
15763
  for (const ref of req.references ?? []) {
@@ -15388,7 +15817,7 @@ async function prepareGoogleMediaPart(ref, mediaType, ctx) {
15388
15817
  if (ref.bytes.length <= MEDIA_PART_INLINE_LIMIT_BYTES) {
15389
15818
  return { type: "file", data: ref.bytes, mediaType };
15390
15819
  }
15391
- const apiKey = googleKey(ctx);
15820
+ const apiKey = googleKey2(ctx);
15392
15821
  const uploadOptions = {
15393
15822
  apiKey,
15394
15823
  fetchImpl: ctx.fetch,
@@ -15409,15 +15838,15 @@ async function prepareGoogleMediaPart(ref, mediaType, ctx) {
15409
15838
  // src/adapters/google-image.ts
15410
15839
  import { createGoogleGenerativeAI as createGoogleGenerativeAI2 } from "@ai-sdk/google";
15411
15840
  import { generateText } from "ai";
15412
- import { z as z28 } from "zod";
15841
+ import { z as z29 } from "zod";
15413
15842
  var GEMINI_IMAGE_TIMEOUT_MS = 6e5;
15414
15843
  var defaultGoogleImageDeps = {
15415
15844
  createGoogleClient: (opts) => createGoogleGenerativeAI2(opts),
15416
15845
  runTextGeneration: (opts) => generateText(opts)
15417
15846
  };
15418
- var causeChainNodeSchema = z28.object({
15419
- message: z28.string().optional(),
15420
- cause: z28.unknown().optional()
15847
+ var causeChainNodeSchema = z29.object({
15848
+ message: z29.string().optional(),
15849
+ cause: z29.unknown().optional()
15421
15850
  });
15422
15851
  function extractBlockReason(cause) {
15423
15852
  let current = cause;
@@ -15437,9 +15866,9 @@ function extractBlockReason(cause) {
15437
15866
  current = parsed.data.cause ?? null;
15438
15867
  }
15439
15868
  }
15440
- function billedTokens(model, usage5) {
15441
- const inputTokens = usage5?.inputTokens;
15442
- const outputTokens = usage5?.outputTokens;
15869
+ function billedTokens(model, usage6) {
15870
+ const inputTokens = usage6?.inputTokens;
15871
+ const outputTokens = usage6?.outputTokens;
15443
15872
  if (inputTokens === void 0 && outputTokens === void 0) return void 0;
15444
15873
  const event = {
15445
15874
  model,
@@ -15540,7 +15969,7 @@ function createGoogleImageAdapter(deps = defaultGoogleImageDeps) {
15540
15969
  if (billed !== void 0) init.usage = billed;
15541
15970
  throw new ModelKitError(init);
15542
15971
  }
15543
- const usage5 = {
15972
+ const usage6 = {
15544
15973
  model: ctx.model.id,
15545
15974
  provider: "google-image",
15546
15975
  modality: "IMAGE",
@@ -15548,19 +15977,19 @@ function createGoogleImageAdapter(deps = defaultGoogleImageDeps) {
15548
15977
  quantity: images.length,
15549
15978
  imageQuality: "auto"
15550
15979
  };
15551
- if (req.size !== void 0) usage5.imageSize = req.size;
15980
+ if (req.size !== void 0) usage6.imageSize = req.size;
15552
15981
  if (result.usage?.inputTokens !== void 0)
15553
- usage5.inputTokens = result.usage.inputTokens;
15982
+ usage6.inputTokens = result.usage.inputTokens;
15554
15983
  if (result.usage?.outputTokens !== void 0)
15555
- usage5.outputTokens = result.usage.outputTokens;
15556
- return { images, usage: usage5, raw: result };
15984
+ usage6.outputTokens = result.usage.outputTokens;
15985
+ return { images, usage: usage6, raw: result };
15557
15986
  }
15558
15987
  };
15559
15988
  }
15560
15989
  var googleImageAdapter = createGoogleImageAdapter();
15561
15990
 
15562
15991
  // src/adapters/higgsfield.ts
15563
- import { z as z29 } from "zod";
15992
+ import { z as z30 } from "zod";
15564
15993
 
15565
15994
  // src/adapters/higgsfield-motions.ts
15566
15995
  var MOTION_MAP = {
@@ -15779,14 +16208,14 @@ function klingEndpointFields(providerModelId) {
15779
16208
  const path = (providerModelId.startsWith("/") ? providerModelId.slice(1) : providerModelId).toLowerCase();
15780
16209
  return KLING_ENDPOINT_FIELDS.get(path) ?? UNLISTED_KLING_FIELDS;
15781
16210
  }
15782
- var klingCreateSchema = z29.object({ status_url: z29.string() });
15783
- var klingStatusSchema = z29.object({
15784
- status: z29.string().optional(),
15785
- video: z29.object({ url: z29.string().optional() }).optional(),
16211
+ var klingCreateSchema = z30.object({ status_url: z30.string() });
16212
+ var klingStatusSchema = z30.object({
16213
+ status: z30.string().optional(),
16214
+ video: z30.object({ url: z30.string().optional() }).optional(),
15786
16215
  error: JsonValueSchema.optional()
15787
16216
  });
15788
- var errorMessageSchema = z29.object({ message: z29.string().optional() });
15789
- var textValueSchema = z29.string();
16217
+ var errorMessageSchema = z30.object({ message: z30.string().optional() });
16218
+ var textValueSchema = z30.string();
15790
16219
  function klingErrorDetail(error) {
15791
16220
  if (error === void 0) return "unknown_error";
15792
16221
  const asText = textValueSchema.safeParse(error);
@@ -15942,8 +16371,8 @@ async function generateKlingVideo(req, ctx) {
15942
16371
  }
15943
16372
  };
15944
16373
  }
15945
- var dopMotionOptionsSchema = z29.object({
15946
- modelkit: z29.object({ motion: z29.string().optional() }).optional()
16374
+ var dopMotionOptionsSchema = z30.object({
16375
+ modelkit: z30.object({ motion: z30.string().optional() }).optional()
15947
16376
  });
15948
16377
  function dopMotionId(ctx) {
15949
16378
  const parsed = dopMotionOptionsSchema.safeParse(ctx.model.providerOptions);
@@ -15959,7 +16388,7 @@ function dopMotionId(ctx) {
15959
16388
  });
15960
16389
  return id;
15961
16390
  }
15962
- var jsonRecordSchema = z29.record(z29.string(), JsonValueSchema);
16391
+ var jsonRecordSchema = z30.record(z30.string(), JsonValueSchema);
15963
16392
  var DOP_URL_KEYS = ["url", "video_url", "output_url", "result_url", "download_url"];
15964
16393
  var DOP_NESTED_KEYS = ["video", "result", "results"];
15965
16394
  function dopUrl(body) {
@@ -15987,8 +16416,8 @@ function dopUrl(body) {
15987
16416
  }
15988
16417
  return void 0;
15989
16418
  }
15990
- var dopCreateSchema = z29.object({ id: z29.string() });
15991
- var dopStatusSchema = z29.object({ status: z29.string().optional() });
16419
+ var dopCreateSchema = z30.object({ id: z30.string() });
16420
+ var dopStatusSchema = z30.object({ status: z30.string().optional() });
15992
16421
  async function generateDopVideo(req, ctx) {
15993
16422
  const firstFrame = req.firstFrame ? refToUrl(req.firstFrame) : void 0;
15994
16423
  if (!firstFrame) {
@@ -16115,7 +16544,7 @@ var higgsfieldAdapter = {
16115
16544
  };
16116
16545
 
16117
16546
  // src/adapters/luma.ts
16118
- import { z as z30 } from "zod";
16547
+ import { z as z31 } from "zod";
16119
16548
 
16120
16549
  // src/adapters/mp4-duration.ts
16121
16550
  function mp4DurationSeconds(bytes) {
@@ -16332,17 +16761,17 @@ function lumaReframeResolution(req, ctx) {
16332
16761
  });
16333
16762
  return "720p";
16334
16763
  }
16335
- var lumaGenerationSchema = z30.looseObject({
16336
- id: z30.string(),
16337
- state: z30.string().optional(),
16338
- output: z30.array(
16339
- z30.looseObject({
16340
- type: z30.string().optional(),
16341
- url: z30.string().optional()
16764
+ var lumaGenerationSchema = z31.looseObject({
16765
+ id: z31.string(),
16766
+ state: z31.string().optional(),
16767
+ output: z31.array(
16768
+ z31.looseObject({
16769
+ type: z31.string().optional(),
16770
+ url: z31.string().optional()
16342
16771
  })
16343
16772
  ).optional(),
16344
- failure_reason: z30.string().optional().nullable(),
16345
- failure_code: z30.string().optional().nullable()
16773
+ failure_reason: z31.string().optional().nullable(),
16774
+ failure_code: z31.string().optional().nullable()
16346
16775
  });
16347
16776
  function lumaFailure(ctx, code, reason) {
16348
16777
  const detail = reason ?? code ?? "unknown_error";
@@ -16774,7 +17203,7 @@ var lumaAdapter = {
16774
17203
 
16775
17204
  // src/adapters/openai-image.ts
16776
17205
  import OpenAI from "openai";
16777
- import { z as z31 } from "zod";
17206
+ import { z as z32 } from "zod";
16778
17207
 
16779
17208
  // src/adapters/svg-sanitize.ts
16780
17209
  var BLOCK_ELEMENTS = /<(script|foreignObject|iframe|object|embed|audio|video|handler|listener)\b[\s\S]*?<\/\1\s*>/giu;
@@ -16887,9 +17316,9 @@ function toProviderError2(cause, ctx) {
16887
17316
  ctx.model.id
16888
17317
  );
16889
17318
  }
16890
- var openaiUsageSchema = z31.object({
16891
- input_tokens: z31.number().optional(),
16892
- output_tokens: z31.number().optional()
17319
+ var openaiUsageSchema = z32.object({
17320
+ input_tokens: z32.number().optional(),
17321
+ output_tokens: z32.number().optional()
16893
17322
  });
16894
17323
  var openaiImageAdapter = {
16895
17324
  id: "openai-image",
@@ -17001,7 +17430,7 @@ var openaiImageAdapter = {
17001
17430
  const usageParsed = openaiUsageSchema.safeParse(response.usage);
17002
17431
  const inputTokens = usageParsed.success ? usageParsed.data.input_tokens : void 0;
17003
17432
  const outputTokens = usageParsed.success ? usageParsed.data.output_tokens : void 0;
17004
- const usage5 = {
17433
+ const usage6 = {
17005
17434
  model: ctx.model.id,
17006
17435
  provider: "openai-image",
17007
17436
  modality: "IMAGE",
@@ -17009,10 +17438,10 @@ var openaiImageAdapter = {
17009
17438
  quantity: images.length,
17010
17439
  imageQuality: quality
17011
17440
  };
17012
- if (inputTokens !== void 0) usage5.inputTokens = inputTokens;
17013
- if (outputTokens !== void 0) usage5.outputTokens = outputTokens;
17014
- if (req.size !== void 0) usage5.imageSize = req.size;
17015
- return { images, usage: usage5, raw: response };
17441
+ if (inputTokens !== void 0) usage6.inputTokens = inputTokens;
17442
+ if (outputTokens !== void 0) usage6.outputTokens = outputTokens;
17443
+ if (req.size !== void 0) usage6.imageSize = req.size;
17444
+ return { images, usage: usage6, raw: response };
17016
17445
  }
17017
17446
  };
17018
17447
 
@@ -17268,16 +17697,16 @@ async function generateProdiaImage(req, ctx) {
17268
17697
  new Uint8Array(await res.arrayBuffer()),
17269
17698
  res.headers.get("content-type")
17270
17699
  );
17271
- const usage5 = {
17700
+ const usage6 = {
17272
17701
  model: ctx.model.id,
17273
17702
  provider: "prodia",
17274
17703
  modality: "IMAGE",
17275
17704
  unit: "images",
17276
17705
  quantity: 1
17277
17706
  };
17278
- if (req.size !== void 0) usage5.imageSize = req.size;
17279
- if (req.quality !== void 0) usage5.imageQuality = req.quality;
17280
- return { images: [{ bytes, mime }], usage: usage5, raw: void 0 };
17707
+ if (req.size !== void 0) usage6.imageSize = req.size;
17708
+ if (req.quality !== void 0) usage6.imageQuality = req.quality;
17709
+ return { images: [{ bytes, mime }], usage: usage6, raw: void 0 };
17281
17710
  }
17282
17711
  var prodiaAdapter = {
17283
17712
  id: "prodia",
@@ -17288,13 +17717,13 @@ var prodiaAdapter = {
17288
17717
  import Replicate from "replicate";
17289
17718
 
17290
17719
  // src/adapters/replicate-http.ts
17291
- import { z as z32 } from "zod";
17292
- var predictionSchema = z32.object({
17293
- id: z32.string(),
17294
- status: z32.string(),
17720
+ import { z as z33 } from "zod";
17721
+ var predictionSchema = z33.object({
17722
+ id: z33.string(),
17723
+ status: z33.string(),
17295
17724
  output: JsonValueSchema.optional(),
17296
17725
  error: JsonValueSchema.optional(),
17297
- metrics: z32.object({ predict_time: z32.number().optional() }).optional()
17726
+ metrics: z33.object({ predict_time: z33.number().optional() }).optional()
17298
17727
  });
17299
17728
  function createReplicateHttpClient(opts) {
17300
17729
  async function request(path, body, signal) {
@@ -17345,7 +17774,7 @@ function createReplicateHttpClient(opts) {
17345
17774
  }
17346
17775
 
17347
17776
  // src/adapters/replicate.ts
17348
- import { z as z33 } from "zod";
17777
+ import { z as z34 } from "zod";
17349
17778
  var POLL_INTERVAL_MS2 = 1e3;
17350
17779
  var POLL_TIMEOUT_MS = 15 * 6e4;
17351
17780
  var defaultReplicateDeps = {
@@ -17385,8 +17814,8 @@ function route(providerModelId) {
17385
17814
  if (!providerModelId.includes("/")) return { version: providerModelId };
17386
17815
  return { model: providerModelId };
17387
17816
  }
17388
- var replicateResponseStatusSchema = z33.object({
17389
- response: z33.object({ status: z33.number() }).partial()
17817
+ var replicateResponseStatusSchema = z34.object({
17818
+ response: z34.object({ status: z34.number() }).partial()
17390
17819
  });
17391
17820
  function replicateError(cause, ctx) {
17392
17821
  if (isModelKitError(cause)) return cause;
@@ -17409,7 +17838,7 @@ function isUrlFn(value) {
17409
17838
  function extractOutputUrl(output) {
17410
17839
  const root = Array.isArray(output) ? output[0] : output;
17411
17840
  if (root === void 0) throw noOutput();
17412
- const asString = z33.string().safeParse(root);
17841
+ const asString = z34.string().safeParse(root);
17413
17842
  if (asString.success && asString.data) return asString.data;
17414
17843
  if (root instanceof URL) return root.href;
17415
17844
  if (isObjectOutput(root)) {
@@ -17418,15 +17847,15 @@ function extractOutputUrl(output) {
17418
17847
  if (urlValue !== void 0 && isUrlFn(urlValue)) {
17419
17848
  const called = urlValue();
17420
17849
  if (called instanceof URL) return called.href;
17421
- const calledString = z33.string().safeParse(called);
17850
+ const calledString = z34.string().safeParse(called);
17422
17851
  if (calledString.success && calledString.data) return calledString.data;
17423
17852
  } else {
17424
- const direct = z33.string().safeParse(urlValue);
17853
+ const direct = z34.string().safeParse(urlValue);
17425
17854
  if (direct.success && direct.data) return direct.data;
17426
17855
  }
17427
17856
  }
17428
17857
  if ("default" in root) {
17429
- const fallback = z33.string().safeParse(root.default);
17858
+ const fallback = z34.string().safeParse(root.default);
17430
17859
  if (fallback.success && fallback.data) return fallback.data;
17431
17860
  }
17432
17861
  }
@@ -17487,7 +17916,7 @@ async function runPrediction(ctx, input, deps) {
17487
17916
  }
17488
17917
  return void 0;
17489
17918
  }, pollOpts);
17490
- const predictTime = z33.number().safeParse(done.metrics?.predict_time);
17919
+ const predictTime = z34.number().safeParse(done.metrics?.predict_time);
17491
17920
  if (done.output === void 0) throw noOutput();
17492
17921
  return {
17493
17922
  url: extractOutputUrl(done.output),
@@ -17733,9 +18162,9 @@ async function generateReplicateImage(req, ctx, deps) {
17733
18162
  }
17734
18163
  const { url, predictTime, raw } = await runPrediction(ctx, input, deps);
17735
18164
  const file = await download(ctx, url);
17736
- const usage5 = imageUsage3(ctx, req);
17737
- usage5.quantity = predictTime;
17738
- return { images: [{ bytes: file.bytes, mime: file.mime }], usage: usage5, raw, outputUrl: url };
18165
+ const usage6 = imageUsage3(ctx, req);
18166
+ usage6.quantity = predictTime;
18167
+ return { images: [{ bytes: file.bytes, mime: file.mime }], usage: usage6, raw, outputUrl: url };
17739
18168
  }
17740
18169
  function klingInput(req) {
17741
18170
  const images = (req.firstFrame ? [req.firstFrame] : []).map(refToUrl);
@@ -17840,7 +18269,7 @@ async function generateReplicateVideo(req, ctx, deps) {
17840
18269
  throw replicateError(cause, ctx);
17841
18270
  }
17842
18271
  if (current.status === "succeeded") {
17843
- const predictTime = z33.number().safeParse(current.metrics?.predict_time);
18272
+ const predictTime = z34.number().safeParse(current.metrics?.predict_time);
17844
18273
  if (current.output === void 0) throw noOutput();
17845
18274
  return {
17846
18275
  url: extractOutputUrl(current.output),
@@ -17859,9 +18288,9 @@ async function generateReplicateVideo(req, ctx, deps) {
17859
18288
  return void 0;
17860
18289
  };
17861
18290
  const toResult = (done) => {
17862
- const usage5 = videoUsage5(ctx, req);
17863
- usage5.quantity = done.predictTime;
17864
- return { video: { url: done.url }, usage: usage5, raw: done.raw };
18291
+ const usage6 = videoUsage5(ctx, req);
18292
+ usage6.quantity = done.predictTime;
18293
+ return { video: { url: done.url }, usage: usage6, raw: done.raw };
17865
18294
  };
17866
18295
  return {
17867
18296
  jobId,
@@ -17968,21 +18397,21 @@ async function generateReplicateAudio(req, ctx, deps) {
17968
18397
  input = specResult.input;
17969
18398
  }
17970
18399
  const { url, predictTime, raw } = await runPrediction(ctx, input, deps);
17971
- const usage5 = audioUsage(ctx, req);
18400
+ const usage6 = audioUsage(ctx, req);
17972
18401
  if (ctx.model.usage.unit === "seconds") {
17973
18402
  const seconds3 = elevenLabsMusicDuration(req.durationSeconds);
17974
- usage5.quantity = seconds3;
17975
- usage5.durationSeconds = seconds3;
18403
+ usage6.quantity = seconds3;
18404
+ usage6.durationSeconds = seconds3;
17976
18405
  } else {
17977
- usage5.quantity = predictTime;
18406
+ usage6.quantity = predictTime;
17978
18407
  }
17979
- return { audio: { url }, usage: usage5, raw: predictionRaw(raw) };
18408
+ return { audio: { url }, usage: usage6, raw: predictionRaw(raw) };
17980
18409
  }
17981
18410
 
17982
18411
  // src/adapters/xai-video.ts
17983
18412
  import { experimental_generateVideo } from "ai";
17984
18413
  import { createXai as createXai2 } from "@ai-sdk/xai";
17985
- import { z as z34 } from "zod";
18414
+ import { z as z35 } from "zod";
17986
18415
  var POLL_INTERVAL_MS3 = 1e4;
17987
18416
  var POLL_TIMEOUT_MS2 = 15 * 6e4;
17988
18417
  var defaultXaiDeps = {
@@ -17995,8 +18424,8 @@ function createXaiVideoAdapter(deps = defaultXaiDeps) {
17995
18424
  };
17996
18425
  }
17997
18426
  var xaiVideoAdapter = createXaiVideoAdapter();
17998
- var xaiResponseStatusSchema = z34.object({
17999
- response: z34.object({ status: z34.number() }).partial()
18427
+ var xaiResponseStatusSchema = z35.object({
18428
+ response: z35.object({ status: z35.number() }).partial()
18000
18429
  });
18001
18430
  function xaiError(cause, ctx) {
18002
18431
  const info = describeThrown(cause);
@@ -18004,12 +18433,12 @@ function xaiError(cause, ctx) {
18004
18433
  const status = info.status ?? (nested.success ? nested.data.response?.status : void 0);
18005
18434
  return classifyThrown("xai-video", cause, ctx.model.id, { status, body: info.body });
18006
18435
  }
18007
- var xaiMetaSchema = z34.object({
18436
+ var xaiMetaSchema = z35.object({
18008
18437
  videoUrl: JsonValueSchema.optional(),
18009
18438
  costInUsdTicks: JsonValueSchema.optional(),
18010
18439
  duration: JsonValueSchema.optional()
18011
18440
  });
18012
- var xaiProviderMetadataSchema = z34.object({ xai: xaiMetaSchema });
18441
+ var xaiProviderMetadataSchema = z35.object({ xai: xaiMetaSchema });
18013
18442
  function metaOf(result) {
18014
18443
  const parsed = xaiProviderMetadataSchema.partial().safeParse(result.providerMetadata);
18015
18444
  if (!parsed.success) return {};
@@ -18121,12 +18550,12 @@ async function mapResult(ctx, req, result) {
18121
18550
  if (first) {
18122
18551
  return {
18123
18552
  video: { bytes: Uint8Array.from(first.uint8Array), mime: first.mediaType },
18124
- usage: usage4(ctx, req, metaOf(result)),
18553
+ usage: usage5(ctx, req, metaOf(result)),
18125
18554
  raw: result.providerMetadata
18126
18555
  };
18127
18556
  }
18128
18557
  const meta = metaOf(result);
18129
- const videoUrl = z34.string().safeParse(meta.videoUrl);
18558
+ const videoUrl = z35.string().safeParse(meta.videoUrl);
18130
18559
  if (videoUrl.success && videoUrl.data) {
18131
18560
  const res = await ctx.fetch(videoUrl.data);
18132
18561
  if (!res.ok) {
@@ -18136,7 +18565,7 @@ async function mapResult(ctx, req, result) {
18136
18565
  const mime = res.headers.get("content-type") ?? "video/mp4";
18137
18566
  return {
18138
18567
  video: { bytes: new Uint8Array(await res.arrayBuffer()), mime },
18139
- usage: usage4(ctx, req, meta),
18568
+ usage: usage5(ctx, req, meta),
18140
18569
  raw: result.providerMetadata
18141
18570
  };
18142
18571
  }
@@ -18148,8 +18577,8 @@ async function mapResult(ctx, req, result) {
18148
18577
  retryable: false
18149
18578
  });
18150
18579
  }
18151
- function usage4(ctx, req, meta) {
18152
- const costTicks = z34.number().safeParse(meta.costInUsdTicks);
18580
+ function usage5(ctx, req, meta) {
18581
+ const costTicks = z35.number().safeParse(meta.costInUsdTicks);
18153
18582
  const cost = costTicks.success ? costTicks.data / 1e10 : void 0;
18154
18583
  const event = {
18155
18584
  model: ctx.model.id,
@@ -18230,15 +18659,17 @@ var FAL_NODE_TYPES = /* @__PURE__ */ new Set([
18230
18659
  "transcription",
18231
18660
  "mask"
18232
18661
  ]);
18233
- function directSpeech(row2) {
18234
- return (row2.adapter === "fish" || row2.adapter === "elevenlabs") && row2.type === "speech";
18662
+ function directNode(row2) {
18663
+ if (row2.adapter === "elevenlabs" && row2.type === "sound-effect") return true;
18664
+ const speaks = row2.adapter === "fish" || row2.adapter === "elevenlabs" || row2.adapter === "google-genai";
18665
+ return speaks && row2.type === "speech";
18235
18666
  }
18236
18667
  function dataOnlyCapable(row2) {
18237
18668
  const adapter = DEFAULT_ADAPTERS[row2.adapter];
18238
18669
  if (!adapterServesType(adapter, row2.type)) {
18239
18670
  return { ok: false, reason: `${row2.adapter} cannot serve ${row2.type} rows` };
18240
18671
  }
18241
- if (FAL_NODE_TYPES.has(row2.type) && row2.adapter !== "fal" && !directSpeech(row2)) {
18672
+ if (FAL_NODE_TYPES.has(row2.type) && row2.adapter !== "fal" && !directNode(row2)) {
18242
18673
  return { ok: false, reason: `only fal serves ${row2.type} rows` };
18243
18674
  }
18244
18675
  switch (row2.adapter) {
@@ -18265,6 +18696,10 @@ function dataOnlyCapable(row2) {
18265
18696
  if (row2.type === "video") {
18266
18697
  return isGoogleGenaiVideoKnown(row2.providerModelId) ? { ok: true } : { ok: false, reason: "google-genai video needs a veo- or gemini-omni id" };
18267
18698
  }
18699
+ if (row2.type === "speech" || row2.type === "voice-clone") {
18700
+ const reason = googleVoiceRowRefusal(row2);
18701
+ return reason === void 0 ? { ok: true } : { ok: false, reason };
18702
+ }
18268
18703
  return isGoogleGenaiAudioKnown(row2.providerModelId) ? { ok: true } : { ok: false, reason: "google-genai audio needs a lyria- id" };
18269
18704
  }
18270
18705
  case "replicate": {
@@ -18347,22 +18782,22 @@ var liveState = store[KEY] ??= {
18347
18782
  var liveCatalog = liveState.catalog;
18348
18783
 
18349
18784
  // src/catalog/load.ts
18350
- import { z as z35 } from "zod";
18785
+ import { z as z36 } from "zod";
18351
18786
  function rowCount() {
18352
18787
  return liveCatalog.list({ lifecycle: ["active", "deprecated", "retired"] }).length;
18353
18788
  }
18354
18789
  function authHeaders2(auth) {
18355
18790
  return "bearer" in auth ? { Authorization: `Bearer ${auth.bearer}` } : { "x-api-key": auth.apiKey };
18356
18791
  }
18357
- var EnvelopeSchema = z35.object({
18358
- rows: z35.array(JsonValueSchema),
18359
- revision: z35.string().optional()
18792
+ var EnvelopeSchema = z36.object({
18793
+ rows: z36.array(JsonValueSchema),
18794
+ revision: z36.string().optional()
18360
18795
  });
18361
18796
  function dropReason(path, message) {
18362
18797
  return path.length === 0 ? message : `${path.map((part) => String(part)).join(".")} ${message}`;
18363
18798
  }
18364
18799
  function rowId(raw) {
18365
- const parsed = z35.object({ id: z35.string().min(1) }).loose().safeParse(raw);
18800
+ const parsed = z36.object({ id: z36.string().min(1) }).loose().safeParse(raw);
18366
18801
  if (!parsed.success) return "?";
18367
18802
  return parsed.data.id;
18368
18803
  }
@@ -18579,7 +19014,7 @@ function fileCatalogCache(path) {
18579
19014
  }
18580
19015
 
18581
19016
  // src/catalog/input-billing.ts
18582
- import { z as z36 } from "zod";
19017
+ import { z as z37 } from "zod";
18583
19018
  var DATA_ONLY_INPUT_BILLING = /* @__PURE__ */ new Map([
18584
19019
  ["flux-3", "source-video-rate"]
18585
19020
  ]);
@@ -18588,7 +19023,7 @@ var KIT_INPUT_BILLING = new Map(
18588
19023
  (row2) => row2.constraints.inputBilling ? [[row2.id, row2.constraints.inputBilling]] : []
18589
19024
  )
18590
19025
  );
18591
- var ConstraintsReadView2 = z36.looseObject({
19026
+ var ConstraintsReadView2 = z37.looseObject({
18592
19027
  inputBilling: InputBillingSchema.optional().catch(void 0)
18593
19028
  });
18594
19029
  function inputBillingOf(row2) {
@@ -18610,7 +19045,7 @@ function animationTier(model, frameSize) {
18610
19045
  if (offered.includes(tier)) return tier;
18611
19046
  return offered[offered.length - 1] ?? tier;
18612
19047
  }
18613
- function refuse(model, message) {
19048
+ function refuse2(model, message) {
18614
19049
  throw new ModelKitError({ code: "unsupported_option", message, model: model.id });
18615
19050
  }
18616
19051
  function clamp(value, min, max) {
@@ -18625,7 +19060,7 @@ function applyAnimation(model, req, onUnsupported, warnings) {
18625
19060
  const fallback = sizes[0];
18626
19061
  if (req.exactSize !== void 0) {
18627
19062
  if (onUnsupported === "error") {
18628
- refuse(
19063
+ refuse2(
18629
19064
  model,
18630
19065
  `${model.id} makes GIF frames at ${sizes.map((s) => s.size).join(", ")}; got ${req.exactSize}`
18631
19066
  );
@@ -18647,7 +19082,7 @@ function applyAnimation(model, req, onUnsupported, warnings) {
18647
19082
  const frames = asked ?? clamp(limits.defaultFrameCount, frameSize.minFrames, frameSize.maxFrames);
18648
19083
  if (frames < frameSize.minFrames || frames > frameSize.maxFrames || !Number.isInteger(frames)) {
18649
19084
  if (onUnsupported === "error") {
18650
- refuse(
19085
+ refuse2(
18651
19086
  model,
18652
19087
  `${model.id} makes ${frameSize.minFrames} to ${frameSize.maxFrames} frames at ${frameSize.size}; got ${frames}`
18653
19088
  );
@@ -18668,7 +19103,7 @@ function applyAnimation(model, req, onUnsupported, warnings) {
18668
19103
  const duration = animation.frameDurationMs ?? limits.defaultFrameDurationMs;
18669
19104
  if (duration < min || duration > max) {
18670
19105
  if (onUnsupported === "error") {
18671
- refuse(model, `${model.id} shows each GIF frame ${min} to ${max} ms; got ${duration}`);
19106
+ refuse2(model, `${model.id} shows each GIF frame ${min} to ${max} ms; got ${duration}`);
18672
19107
  }
18673
19108
  const snapped = clamp(duration, min, max);
18674
19109
  warnings.push({
@@ -18690,7 +19125,7 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
18690
19125
  const format = req.outputFormat;
18691
19126
  if (format !== void 0 && !imageOutputFormats(model).includes(format)) {
18692
19127
  if (onUnsupported === "error") {
18693
- refuse(
19128
+ refuse2(
18694
19129
  model,
18695
19130
  `${model.id} does not offer outputFormat ${format}. Supported: ${imageOutputFormats(model).join(", ")}.`
18696
19131
  );
@@ -18705,7 +19140,7 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
18705
19140
  }
18706
19141
  if (req.background !== void 0 && !(c.backgrounds ?? []).includes(req.background)) {
18707
19142
  if (onUnsupported === "error") {
18708
- refuse(model, `${model.id} does not offer background ${req.background}`);
19143
+ refuse2(model, `${model.id} does not offer background ${req.background}`);
18709
19144
  }
18710
19145
  warnings.push({
18711
19146
  code: "option_ignored",
@@ -18726,10 +19161,10 @@ function applyImageOutputRules(model, req, onUnsupported, warnings) {
18726
19161
  delete req.animation;
18727
19162
  }
18728
19163
  if (req.outputFormat === "svg") {
18729
- if (!c.svgModel) refuse(model, `${model.id} names no svgModel to write the SVG`);
19164
+ if (!c.svgModel) refuse2(model, `${model.id} names no svgModel to write the SVG`);
18730
19165
  if ((req.count ?? 1) > 1) {
18731
19166
  if (onUnsupported === "error") {
18732
- refuse(model, `${model.label} makes one SVG per call`);
19167
+ refuse2(model, `${model.label} makes one SVG per call`);
18733
19168
  }
18734
19169
  warnings.push({
18735
19170
  code: "option_ignored",
@@ -19391,7 +19826,13 @@ function resolveAudioOptions(model, request, onUnsupported = "error") {
19391
19826
  model: model.id
19392
19827
  });
19393
19828
  }
19394
- dropUnsupported(merged, model, warnings, ["seed", "negativePrompt", "instrumental", "lyrics"]);
19829
+ dropUnsupported(merged, model, warnings, [
19830
+ "seed",
19831
+ "negativePrompt",
19832
+ "instrumental",
19833
+ "lyrics",
19834
+ "loop"
19835
+ ]);
19395
19836
  applyFalAudioRules(model, merged);
19396
19837
  const format = resolveOutputFormat(model, request.outputFormat, onUnsupported, warnings);
19397
19838
  if (format !== void 0) merged.outputFormat = format;
@@ -19624,7 +20065,7 @@ function resolveTranscriptionOptions(model, request, onUnsupported = "error") {
19624
20065
  }
19625
20066
 
19626
20067
  // src/resolve-voice.ts
19627
- function refuse2(model, code, message) {
20068
+ function refuse3(model, code, message) {
19628
20069
  return new ModelKitError({ code, message: `${model.label} ${message}`, model: model.id });
19629
20070
  }
19630
20071
  function checkSample(model, sample, index) {
@@ -19633,7 +20074,7 @@ function checkSample(model, sample, index) {
19633
20074
  if (limits === void 0 || length === void 0) return;
19634
20075
  if (limits.min !== void 0 && length < limits.min || limits.max !== void 0 && length > limits.max) {
19635
20076
  const range2 = `${limits.min ?? 0}-${limits.max ?? "any"} s`;
19636
- throw refuse2(
20077
+ throw refuse3(
19637
20078
  model,
19638
20079
  "unsupported_option",
19639
20080
  `takes samples of ${range2}; sample ${index + 1} is ${length} s`
@@ -19642,11 +20083,11 @@ function checkSample(model, sample, index) {
19642
20083
  }
19643
20084
  function resolveVoiceCloneOptions(model, request) {
19644
20085
  const title = request.title.trim();
19645
- if (!title) throw refuse2(model, "missing_input", "needs a title");
19646
- if (request.samples.length === 0) throw refuse2(model, "missing_input", "needs a voice sample");
20086
+ if (!title) throw refuse3(model, "missing_input", "needs a title");
20087
+ if (request.samples.length === 0) throw refuse3(model, "missing_input", "needs a voice sample");
19647
20088
  const max = model.constraints.references?.audios;
19648
20089
  if (max !== void 0 && request.samples.length > max) {
19649
- throw refuse2(
20090
+ throw refuse3(
19650
20091
  model,
19651
20092
  "unsupported_option",
19652
20093
  `takes up to ${max} samples; got ${request.samples.length}`
@@ -19656,7 +20097,7 @@ function resolveVoiceCloneOptions(model, request) {
19656
20097
  const total = model.constraints.references?.audioSeconds?.total;
19657
20098
  const seconds3 = request.samples.reduce((sum, s) => sum + (s.audio.durationSeconds ?? 0), 0);
19658
20099
  if (total !== void 0 && seconds3 > total) {
19659
- throw refuse2(
20100
+ throw refuse3(
19660
20101
  model,
19661
20102
  "unsupported_option",
19662
20103
  `takes up to ${total} s of samples; got ${seconds3} s`
@@ -19665,7 +20106,7 @@ function resolveVoiceCloneOptions(model, request) {
19665
20106
  for (const field of ["transcript", "designSignature"]) {
19666
20107
  const set = request.samples.filter((s) => s[field]?.trim()).length;
19667
20108
  if (set !== 0 && set !== request.samples.length) {
19668
- throw refuse2(model, "missing_input", `needs ${field} on every sample or on none`);
20109
+ throw refuse3(model, "missing_input", `needs ${field} on every sample or on none`);
19669
20110
  }
19670
20111
  }
19671
20112
  return { request: { ...request, model: model.id, title }, warnings: [] };
@@ -19673,10 +20114,10 @@ function resolveVoiceCloneOptions(model, request) {
19673
20114
  function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
19674
20115
  const warnings = [];
19675
20116
  const prompt = request.prompt.trim();
19676
- if (!prompt) throw refuse2(model, "missing_input", "needs a voice description");
20117
+ if (!prompt) throw refuse3(model, "missing_input", "needs a voice description");
19677
20118
  const maxChars = promptConventions(model).maxChars;
19678
20119
  if (maxChars !== void 0 && prompt.length > maxChars) {
19679
- throw refuse2(
20120
+ throw refuse3(
19680
20121
  model,
19681
20122
  "unsupported_option",
19682
20123
  `takes up to ${maxChars} characters; got ${prompt.length}`
@@ -19687,7 +20128,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
19687
20128
  const preview2 = request.previewText?.trim();
19688
20129
  if (preview2) {
19689
20130
  if (limits !== void 0 && preview2.length > limits.previewMaxChars) {
19690
- throw refuse2(
20131
+ throw refuse3(
19691
20132
  model,
19692
20133
  "unsupported_option",
19693
20134
  `takes a preview line of up to ${limits.previewMaxChars} characters; got ${preview2.length}`
@@ -19703,7 +20144,7 @@ function resolveVoiceDesignOptions(model, request, onUnsupported = "error") {
19703
20144
  const cap = limits?.maxCandidates ?? count2;
19704
20145
  if (!Number.isInteger(count2) || count2 < 1 || count2 > cap) {
19705
20146
  if (onUnsupported === "error" || !Number.isInteger(count2)) {
19706
- throw refuse2(
20147
+ throw refuse3(
19707
20148
  model,
19708
20149
  "unsupported_option",
19709
20150
  `returns 1-${cap} candidates; got ${count2}`
@@ -20073,7 +20514,7 @@ async function testProviderKey(provider, secret, opts = {}) {
20073
20514
 
20074
20515
  // src/text.ts
20075
20516
  import "ai";
20076
- import { z as z37 } from "zod";
20517
+ import { z as z38 } from "zod";
20077
20518
  function mergeTextProviderOptions(catalog, caller) {
20078
20519
  const merged = {};
20079
20520
  const catalogOptions = catalog.providerOptions ?? {};
@@ -20112,17 +20553,17 @@ function passthroughTextModel(model) {
20112
20553
  pricingKind: "token"
20113
20554
  };
20114
20555
  }
20115
- var perplexityCostSchema = z37.object({
20116
- perplexity: z37.object({ cost: z37.object({ totalCost: z37.number().finite().nonnegative() }) })
20556
+ var perplexityCostSchema = z38.object({
20557
+ perplexity: z38.object({ cost: z38.object({ totalCost: z38.number().finite().nonnegative() }) })
20117
20558
  });
20118
20559
  function reportedCostUsd(metadata) {
20119
20560
  const parsed = perplexityCostSchema.safeParse(metadata);
20120
20561
  return parsed.success ? parsed.data.perplexity.cost.totalCost : void 0;
20121
20562
  }
20122
- function textUsageEvent(model, provider, usage5, providerMetadata) {
20123
- const inputTokens = usage5.inputTokens ?? 0;
20124
- const outputTokens = usage5.outputTokens ?? 0;
20125
- const total = usage5.totalTokens ?? inputTokens + outputTokens;
20563
+ function textUsageEvent(model, provider, usage6, providerMetadata) {
20564
+ const inputTokens = usage6.inputTokens ?? 0;
20565
+ const outputTokens = usage6.outputTokens ?? 0;
20566
+ const total = usage6.totalTokens ?? inputTokens + outputTokens;
20126
20567
  const event = {
20127
20568
  model: model.id,
20128
20569
  provider,
@@ -20157,7 +20598,7 @@ function createTextSteps(initial, resolve, callerProviderOptions) {
20157
20598
  return { ...prepared, providerOptions };
20158
20599
  };
20159
20600
  }
20160
- function usage5(results) {
20601
+ function usage6(results) {
20161
20602
  const grouped = /* @__PURE__ */ new Map();
20162
20603
  for (const [index, step] of results.entries()) {
20163
20604
  const target = steps.get(index) ?? initial;
@@ -20179,7 +20620,7 @@ function createTextSteps(initial, resolve, callerProviderOptions) {
20179
20620
  }
20180
20621
  return [...grouped.values()];
20181
20622
  }
20182
- return { wrap, usage: usage5 };
20623
+ return { wrap, usage: usage6 };
20183
20624
  }
20184
20625
 
20185
20626
  // src/client.ts
@@ -20191,7 +20632,7 @@ import {
20191
20632
  streamObject as aiStreamObject2,
20192
20633
  streamText as aiStreamText2
20193
20634
  } from "ai";
20194
- import { z as z38 } from "zod";
20635
+ import { z as z39 } from "zod";
20195
20636
 
20196
20637
  // src/generated-image.ts
20197
20638
  function toGeneratedImage(image) {
@@ -20313,9 +20754,9 @@ function providerJobMethods(kind, deps) {
20313
20754
  const { methods, adapter, ctx } = target(sub.model, rest);
20314
20755
  if (!methods.result) throw missing3(adapter, ctx.model);
20315
20756
  const result = await methods.result(sub, ctx, webhook);
20316
- const usage5 = deps.rowUsage(ctx, result.usage, sub.submittedAt);
20317
- await deps.emit(usage5);
20318
- return { ...result, usage: usage5 };
20757
+ const usage6 = deps.rowUsage(ctx, result.usage, sub.submittedAt);
20758
+ await deps.emit(usage6);
20759
+ return { ...result, usage: usage6 };
20319
20760
  },
20320
20761
  async cancel(sub, call = {}) {
20321
20762
  const { methods, adapter, ctx } = target(sub.model, call);
@@ -20555,10 +20996,10 @@ function audioNodeMethods(deps) {
20555
20996
  const startedAt = Date.now();
20556
20997
  const outcome = await adapter.dub(resolved, ctx);
20557
20998
  if (outcome.kind === "audio") {
20558
- const { audio, usage: usage5, raw } = outcome.result;
20999
+ const { audio, usage: usage6, raw } = outcome.result;
20559
21000
  return {
20560
21001
  audio,
20561
- usage: await deps.settle(ctx, usage5, startedAt),
21002
+ usage: await deps.settle(ctx, usage6, startedAt),
20562
21003
  ...raw !== void 0 && { raw }
20563
21004
  };
20564
21005
  }
@@ -20610,10 +21051,10 @@ function textAbortOptions(sdk, context) {
20610
21051
  if (abortSignal) return { abortSignal };
20611
21052
  return {};
20612
21053
  }
20613
- var catalogId = z38.string();
20614
- var exactSize = z38.templateLiteral([z38.number(), "x", z38.number()]);
20615
- var sdkRatio = z38.templateLiteral([z38.number(), ":", z38.number()]);
20616
- var sizeTier = z38.enum(["512", "1K", "2K", "4K", "8K"]);
21054
+ var catalogId = z39.string();
21055
+ var exactSize = z39.templateLiteral([z39.number(), "x", z39.number()]);
21056
+ var sdkRatio = z39.templateLiteral([z39.number(), ":", z39.number()]);
21057
+ var sizeTier = z39.enum(["512", "1K", "2K", "4K", "8K"]);
20617
21058
  function isCatalogId(model) {
20618
21059
  return catalogId.safeParse(model).success;
20619
21060
  }
@@ -20856,7 +21297,7 @@ function createModelKit(config, adapters) {
20856
21297
  const images = result.images.map(
20857
21298
  (file) => toGeneratedImage({ bytes: file.uint8Array, mime: file.mediaType })
20858
21299
  );
20859
- const usage5 = timed(
21300
+ const usage6 = timed(
20860
21301
  {
20861
21302
  model: model.modelId,
20862
21303
  provider: model.provider,
@@ -20866,8 +21307,8 @@ function createModelKit(config, adapters) {
20866
21307
  },
20867
21308
  startedAt
20868
21309
  );
20869
- await emit(usage5);
20870
- return { image: images[0], images, usage: usage5, raw: result, warnings };
21310
+ await emit(usage6);
21311
+ return { image: images[0], images, usage: usage6, raw: result, warnings };
20871
21312
  }
20872
21313
  function passthroughVideo(req, call) {
20873
21314
  const {
@@ -20885,7 +21326,7 @@ function createModelKit(config, adapters) {
20885
21326
  referenceVideos,
20886
21327
  referenceAudios,
20887
21328
  resolution,
20888
- generateAudio: generateAudio2,
21329
+ generateAudio: generateAudio3,
20889
21330
  negativePrompt: _negativePrompt,
20890
21331
  cfgScale: _cfgScale,
20891
21332
  promptExpansion: _promptExpansion,
@@ -20902,7 +21343,7 @@ function createModelKit(config, adapters) {
20902
21343
  pushIgnored(warnings, "aspectRatio", aspectRatio, model.modelId);
20903
21344
  if (seconds3 !== void 0) options.duration = seconds3;
20904
21345
  if (seed !== void 0) options.seed = seed;
20905
- if (generateAudio2 !== void 0) options.generateAudio = generateAudio2;
21346
+ if (generateAudio3 !== void 0) options.generateAudio = generateAudio3;
20906
21347
  const frames = [
20907
21348
  ...firstFrame ? [{ image: sdkDataContent(firstFrame), frameType: "first_frame" }] : [],
20908
21349
  ...lastFrame ? [{ image: sdkDataContent(lastFrame), frameType: "last_frame" }] : []
@@ -20943,7 +21384,7 @@ function createModelKit(config, adapters) {
20943
21384
  let settled;
20944
21385
  let failed = false;
20945
21386
  const done = pending.then(async (result) => {
20946
- const usage5 = timed(
21387
+ const usage6 = timed(
20947
21388
  {
20948
21389
  model: model.modelId,
20949
21390
  provider: model.provider,
@@ -20956,10 +21397,10 @@ function createModelKit(config, adapters) {
20956
21397
  );
20957
21398
  settled = {
20958
21399
  video: { bytes: result.video.uint8Array, mime: result.video.mediaType },
20959
- usage: usage5,
21400
+ usage: usage6,
20960
21401
  raw: result
20961
21402
  };
20962
- await emit(usage5);
21403
+ await emit(usage6);
20963
21404
  return settled;
20964
21405
  });
20965
21406
  done.catch(() => {
@@ -20986,9 +21427,9 @@ function createModelKit(config, adapters) {
20986
21427
  if (settled) return settled;
20987
21428
  const pending = result(opts).then(
20988
21429
  async (out) => {
20989
- const usage5 = rowUsage(ctx, out.usage, startedAt);
20990
- await emit(usage5);
20991
- return { ...out, usage: usage5 };
21430
+ const usage6 = rowUsage(ctx, out.usage, startedAt);
21431
+ await emit(usage6);
21432
+ return { ...out, usage: usage6 };
20992
21433
  },
20993
21434
  (cause) => {
20994
21435
  settled = void 0;
@@ -21008,9 +21449,9 @@ function createModelKit(config, adapters) {
21008
21449
  return context(model, signal ? { ...call, signal } : call, warnings);
21009
21450
  },
21010
21451
  async settle(ctx, event, startedAt) {
21011
- const usage5 = rowUsage(ctx, event, startedAt);
21012
- await emit(usage5);
21013
- return usage5;
21452
+ const usage6 = rowUsage(ctx, event, startedAt);
21453
+ await emit(usage6);
21454
+ return usage6;
21014
21455
  },
21015
21456
  wrapVideoJob
21016
21457
  });
@@ -21055,8 +21496,8 @@ function createModelKit(config, adapters) {
21055
21496
  throw billedFailure(ctx, err, err.usage, startedAt);
21056
21497
  throw err;
21057
21498
  }
21058
- const usage5 = rowUsage(ctx, result.usage, startedAt);
21059
- await emit(usage5);
21499
+ const usage6 = rowUsage(ctx, result.usage, startedAt);
21500
+ await emit(usage6);
21060
21501
  const images = result.images.map(toGeneratedImage);
21061
21502
  const first = images[0];
21062
21503
  if (!first)
@@ -21065,7 +21506,7 @@ function createModelKit(config, adapters) {
21065
21506
  message: `${model.id} returned no image`,
21066
21507
  model: model.id
21067
21508
  });
21068
- return { ...result, usage: usage5, image: first, images, warnings };
21509
+ return { ...result, usage: usage6, image: first, images, warnings };
21069
21510
  },
21070
21511
  async generateVideo(req, call = {}) {
21071
21512
  mediaRetryOptions(call);
@@ -21166,9 +21607,9 @@ function createModelKit(config, adapters) {
21166
21607
  }
21167
21608
  const startedAt = Date.now();
21168
21609
  const result = await adapter.generateAudio(resolved, ctx);
21169
- const usage5 = rowUsage(ctx, result.usage, startedAt);
21170
- await emit(usage5);
21171
- return { ...result, usage: usage5 };
21610
+ const usage6 = rowUsage(ctx, result.usage, startedAt);
21611
+ await emit(usage6);
21612
+ return { ...result, usage: usage6 };
21172
21613
  },
21173
21614
  async prepareMediaPart(modelId, ref, mediaType, call = {}) {
21174
21615
  mediaRetryOptions(call);
@@ -21249,8 +21690,8 @@ function createModelKit(config, adapters) {
21249
21690
  options.prepareStep ?? options.experimental_prepareStep
21250
21691
  ),
21251
21692
  onFinish: async (event) => {
21252
- for (const usage5 of steps.usage(event.steps))
21253
- await emit(textTimed(withRowUnit(usage5), event.steps.length, startedAt));
21693
+ for (const usage6 of steps.usage(event.steps))
21694
+ await emit(textTimed(withRowUnit(usage6), event.steps.length, startedAt));
21254
21695
  await callerOnFinish?.(event);
21255
21696
  }
21256
21697
  });
@@ -21330,7 +21771,7 @@ var generateObject = (options, call) => createDefaultModelKit().generateObject(o
21330
21771
  var streamObject = (options, call) => createDefaultModelKit().streamObject(options, call);
21331
21772
  var generateImage = (req, call) => createDefaultModelKit().generateImage(req, call);
21332
21773
  var generateVideo = (req, call) => createDefaultModelKit().generateVideo(req, call);
21333
- var generateAudio = (req, call) => createDefaultModelKit().generateAudio(req, call);
21774
+ var generateAudio2 = (req, call) => createDefaultModelKit().generateAudio(req, call);
21334
21775
  var prepareMediaPart = (modelId, ref, mediaType, call) => createDefaultModelKit().prepareMediaPart(modelId, ref, mediaType, call);
21335
21776
  var languageModel = (modelId, call) => createDefaultModelKit().languageModel(modelId, call);
21336
21777
  var describe = (modelId) => createDefaultModelKit().describe(modelId);
@@ -21346,6 +21787,7 @@ export {
21346
21787
  CatalogSchema,
21347
21788
  DEFAULT_ADAPTERS,
21348
21789
  ExposureSchema,
21790
+ GEMINI_VOICE_CONSENT,
21349
21791
  IMAGE_INPUT_SPEC_KEYS,
21350
21792
  INPUT_BILLINGS,
21351
21793
  INPUT_SPEC_SUPPORTS_KEYS,
@@ -21382,7 +21824,7 @@ export {
21382
21824
  falWebhookBodySchema,
21383
21825
  fileCatalogCache,
21384
21826
  fishAdapter,
21385
- generateAudio,
21827
+ generateAudio2 as generateAudio,
21386
21828
  generateImage,
21387
21829
  generateObject,
21388
21830
  generateText2 as generateText,