@fungi.computer/darkroom 0.6.0 → 0.8.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.
Files changed (53) hide show
  1. package/README.md +178 -0
  2. package/dist/app-media-contracts.d.ts +107 -12
  3. package/dist/audio-providers/elevenlabs.d.ts +40 -0
  4. package/dist/audio-providers/elevenlabs.js +69 -0
  5. package/dist/audio-reference-types.d.ts +28 -0
  6. package/dist/audio-reference-types.js +16 -0
  7. package/dist/audio-references.d.ts +14 -0
  8. package/dist/audio-references.js +69 -0
  9. package/dist/browser-failure.d.ts +2 -0
  10. package/dist/browser-failure.js +2 -0
  11. package/dist/cloudflare/provider.d.ts +6 -4
  12. package/dist/cloudflare/provider.js +39 -21
  13. package/dist/cloudflare/reference-images.d.ts +6 -0
  14. package/dist/cloudflare/reference-images.js +25 -7
  15. package/dist/cost-estimate.js +2 -2
  16. package/dist/daily-media-meter.d.ts +55 -0
  17. package/dist/daily-media-meter.js +81 -0
  18. package/dist/execution-error.d.ts +1 -1
  19. package/dist/gateway-models.d.ts +19 -9
  20. package/dist/gateway-models.js +57 -19
  21. package/dist/gateway-wire.d.ts +1 -0
  22. package/dist/gateway-wire.js +2 -0
  23. package/dist/index.d.ts +116 -24
  24. package/dist/index.js +147 -26
  25. package/dist/media-binding.d.ts +60 -7
  26. package/dist/media-binding.js +43 -21
  27. package/dist/media-generation.js +20 -7
  28. package/dist/media-operation-contract.d.ts +9 -3
  29. package/dist/media-operation-contract.js +6 -4
  30. package/dist/media-operation-do.d.ts +13 -2
  31. package/dist/media-operation-do.js +26 -1
  32. package/dist/media-operation-owner.d.ts +10 -2
  33. package/dist/media-operation-owner.js +56 -11
  34. package/dist/media-operation.js +5 -3
  35. package/dist/media-quote.d.ts +14 -0
  36. package/dist/media-quote.js +17 -0
  37. package/dist/model-catalog.d.ts +602 -6
  38. package/dist/model-catalog.js +309 -9
  39. package/dist/reference-image-size.d.ts +4 -3
  40. package/dist/reference-image-size.js +9 -9
  41. package/dist/server.d.ts +31 -8
  42. package/dist/server.js +51 -8
  43. package/dist/video-providers/reference-encoding.d.ts +7 -2
  44. package/dist/video-providers/reference-encoding.js +14 -3
  45. package/dist/video-providers/types.d.ts +2 -2
  46. package/dist/video-providers/unified.d.ts +1 -0
  47. package/dist/video-providers/unified.js +4 -2
  48. package/docs/api/app-media-contracts.md +50 -10
  49. package/docs/api/browser.md +4 -2
  50. package/docs/api/cloudflare.md +56 -3
  51. package/docs/api/index.md +1042 -121
  52. package/docs/api/server.md +306 -50
  53. package/package.json +3 -2
@@ -25,7 +25,7 @@ export declare const mediaModelTierSchema: z.ZodEnum<{
25
25
  }>;
26
26
  /** A model selection tier, independent of billing price. */
27
27
  export type MediaModelTier = z.output<typeof mediaModelTierSchema>;
28
- /** Media's provider catalog: Workers AI images plus gateway image and video models. */
28
+ /** Media's provider catalog: Workers AI images plus gateway image, video and audio models. */
29
29
  export declare const mediaModelInputSchema: z.ZodLazy<z.ZodReadonly<z.ZodObject<{
30
30
  transport: z.ZodEnum<{
31
31
  /** JSON provider input. */
@@ -264,6 +264,10 @@ export declare const mediaVideoSchema: z.ZodLazy<z.ZodReadonly<z.ZodObject<{
264
264
  /** 4k, admitted only by Seedance 2.0. */
265
265
  readonly p4k: "4k";
266
266
  }>>>;
267
+ audioReferences: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
268
+ max: z.ZodNumber;
269
+ totalSeconds: z.ZodNumber;
270
+ }, z.core.$strict>>>;
267
271
  prices: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
268
272
  resolution: z.ZodEnum<{
269
273
  /** 480p. */
@@ -283,6 +287,56 @@ export declare const mediaVideoSchema: z.ZodLazy<z.ZodReadonly<z.ZodObject<{
283
287
  }, z.core.$strict>>>;
284
288
  /** Immutable video capability and price metadata. */
285
289
  export type MediaVideoModel = z.output<typeof mediaVideoSchema>;
290
+ /**
291
+ * Verified ElevenLabs model identifiers on Cloudflare's Unified Billing, from
292
+ * the model pages under https://developers.cloudflare.com/ai/models/elevenlabs/
293
+ * (checked 2026-11-13). Cloudflare offers no sound-effects model. Eleven Flash
294
+ * v2.5 and Turbo v2.5 are listed there but a live Unified Billing call to Flash
295
+ * answered 403 code 2047 ("not available via unified billing. Please use
296
+ * BYOK"), so they are not offered. Multilingual v2 is the default voice model.
297
+ */
298
+ export declare const mediaAudioModelIdSchema: z.ZodEnum<{
299
+ /** Eleven Multilingual v2 text to speech. */
300
+ readonly multilingual: "elevenlabs/eleven-multilingual-v2";
301
+ /** Eleven v3 expressive text to speech. */
302
+ readonly v3: "elevenlabs/eleven-v3";
303
+ /** Eleven Music v2. */
304
+ readonly music: "elevenlabs/music-v2";
305
+ }>;
306
+ /** Verified audio model identifier. */
307
+ export type MediaAudioModelId = z.output<typeof mediaAudioModelIdSchema>;
308
+ /** One premade voice a speech model may speak with. */
309
+ export declare const mediaAudioVoiceSchema: z.ZodLazy<z.ZodReadonly<z.ZodObject<{
310
+ id: z.ZodString;
311
+ label: z.ZodString;
312
+ }, z.core.$strict>>>;
313
+ /** One premade speech voice. */
314
+ export type MediaAudioVoice = z.output<typeof mediaAudioVoiceSchema>;
315
+ /** Verified audio parameters and provider cost, checked 2026-11-13. */
316
+ export declare const mediaAudioSchema: z.ZodLazy<z.ZodReadonly<z.ZodObject<{
317
+ provider: z.ZodLiteral<"elevenlabs">;
318
+ mode: z.ZodEnum<{
319
+ /** Text to speech: the prompt is the spoken text. */
320
+ readonly speech: "speech";
321
+ /** Music: the prompt describes the track. */
322
+ readonly music: "music";
323
+ }>;
324
+ voices: z.ZodReadonly<z.ZodArray<z.ZodLazy<z.ZodReadonly<z.ZodObject<{
325
+ id: z.ZodString;
326
+ label: z.ZodString;
327
+ }, z.core.$strict>>>>>;
328
+ defaultVoiceId: z.ZodNullable<z.ZodString>;
329
+ seconds: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
330
+ min: z.ZodNumber;
331
+ max: z.ZodNumber;
332
+ default: z.ZodNumber;
333
+ }, z.core.$strict>>>;
334
+ milliunitsPerUnit: z.ZodNumber;
335
+ }, z.core.$strict>>>;
336
+ /** Immutable audio capability and price metadata. */
337
+ export type MediaAudioModel = z.output<typeof mediaAudioSchema>;
338
+ /** Characters one speech billing block covers. */
339
+ export declare const AUDIO_CHARACTER_BLOCK = 100;
286
340
  /**
287
341
  * Structural ceiling for any prompt on the wire. Each model's own
288
342
  * `maxPromptLength` is the real bound; no model may exceed this ceiling.
@@ -297,6 +351,8 @@ export declare const mediaModelSchema: z.ZodReadonly<z.ZodObject<{
297
351
  readonly image: "image";
298
352
  /** Video generation. */
299
353
  readonly video: "video";
354
+ /** Speech or music generation. */
355
+ readonly audio: "audio";
300
356
  }>;
301
357
  tier: z.ZodEnum<{
302
358
  /** Cheap, fast draft model. */
@@ -451,6 +507,10 @@ export declare const mediaModelSchema: z.ZodReadonly<z.ZodObject<{
451
507
  /** 4k, admitted only by Seedance 2.0. */
452
508
  readonly p4k: "4k";
453
509
  }>>>;
510
+ audioReferences: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
511
+ max: z.ZodNumber;
512
+ totalSeconds: z.ZodNumber;
513
+ }, z.core.$strict>>>;
454
514
  prices: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
455
515
  resolution: z.ZodEnum<{
456
516
  /** 480p. */
@@ -468,18 +528,554 @@ export declare const mediaModelSchema: z.ZodReadonly<z.ZodObject<{
468
528
  audioMilliunitsPerSecond: z.ZodNumber;
469
529
  }, z.core.$strict>>>>;
470
530
  }, z.core.$strict>>>>;
531
+ audio: z.ZodNullable<z.ZodLazy<z.ZodReadonly<z.ZodObject<{
532
+ provider: z.ZodLiteral<"elevenlabs">;
533
+ mode: z.ZodEnum<{
534
+ /** Text to speech: the prompt is the spoken text. */
535
+ readonly speech: "speech";
536
+ /** Music: the prompt describes the track. */
537
+ readonly music: "music";
538
+ }>;
539
+ voices: z.ZodReadonly<z.ZodArray<z.ZodLazy<z.ZodReadonly<z.ZodObject<{
540
+ id: z.ZodString;
541
+ label: z.ZodString;
542
+ }, z.core.$strict>>>>>;
543
+ defaultVoiceId: z.ZodNullable<z.ZodString>;
544
+ seconds: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
545
+ min: z.ZodNumber;
546
+ max: z.ZodNumber;
547
+ default: z.ZodNumber;
548
+ }, z.core.$strict>>>;
549
+ milliunitsPerUnit: z.ZodNumber;
550
+ }, z.core.$strict>>>>;
471
551
  }, z.core.$strict>>;
472
552
  /** Model-specific dimensions, steps, transport and reference limits. */
473
553
  export type MediaModelInput = z.output<typeof mediaModelInputSchema>;
474
554
  /** One immutable provider catalog entry. */
475
555
  export type MediaModel = z.output<typeof mediaModelSchema>;
476
- /** The immutable image and video model catalog. */
556
+ /** The Fungi gateway provider's own immutable image, video and audio model catalog. */
477
557
  export declare const mediaModels: readonly MediaModel[];
478
- /** List all image and video models in catalog order. */
558
+ /**
559
+ * One catalogue entry. Same grammar as the gateway's wire entry, except that a
560
+ * video model may name `host` as its provider family: the injected provider
561
+ * owns that model's wire grammar and Darkroom builds no gateway request for it.
562
+ */
563
+ export declare const mediaCatalogueModelSchema: z.ZodReadonly<z.ZodObject<{
564
+ id: z.ZodString;
565
+ label: z.ZodString;
566
+ kind: z.ZodEnum<{
567
+ /** Still-image generation. */
568
+ readonly image: "image";
569
+ /** Video generation. */
570
+ readonly video: "video";
571
+ /** Speech or music generation. */
572
+ readonly audio: "audio";
573
+ }>;
574
+ tier: z.ZodEnum<{
575
+ /** Cheap, fast draft model. */
576
+ readonly draft: "draft";
577
+ /** Balanced model selection. */
578
+ readonly balanced: "balanced";
579
+ /** Premium model selection. */
580
+ readonly premium: "premium";
581
+ /** Most expensive model selection. */
582
+ readonly max: "max";
583
+ }>;
584
+ outputFormats: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
585
+ /** PNG image encoding. */
586
+ readonly png: "png";
587
+ /** JPEG image encoding. */
588
+ readonly jpeg: "jpeg";
589
+ /** WebP image encoding. */
590
+ readonly webp: "webp";
591
+ }>>>;
592
+ maxPromptLength: z.ZodNumber;
593
+ input: z.ZodLazy<z.ZodReadonly<z.ZodObject<{
594
+ transport: z.ZodEnum<{
595
+ /** JSON provider input. */
596
+ readonly json: "json";
597
+ /** Multipart provider input. */
598
+ readonly multipart: "multipart";
599
+ }>;
600
+ dimensions: z.ZodEnum<{
601
+ /** Provider chooses its own dimensions. */
602
+ readonly none: "none";
603
+ /** Provider accepts the requested dimensions. */
604
+ readonly own: "own";
605
+ }>;
606
+ maxDimension: z.ZodNullable<z.ZodNumber>;
607
+ maxDimensionDocumented: z.ZodBoolean;
608
+ defaultWidth: z.ZodNumber;
609
+ defaultHeight: z.ZodNumber;
610
+ steps: z.ZodEnum<{
611
+ /** Provider reads the steps field. */
612
+ readonly steps: "steps";
613
+ /** Provider reads the num_steps field. */
614
+ readonly num_steps: "num_steps";
615
+ /** Provider uses fixed inference steps. */
616
+ readonly fixed: "fixed";
617
+ }>;
618
+ maxSteps: z.ZodNullable<z.ZodNumber>;
619
+ defaultSteps: z.ZodNullable<z.ZodNumber>;
620
+ referenceField: z.ZodNullable<z.ZodString>;
621
+ maxReferences: z.ZodNumber;
622
+ referenceDimension: z.ZodNullable<z.ZodNumber>;
623
+ referenceFormat: z.ZodEnum<{
624
+ /** Lossless PNG. */
625
+ readonly png: "png";
626
+ /** Lossy WebP. */
627
+ readonly webp: "webp";
628
+ }>;
629
+ }, z.core.$strict>>>;
630
+ sizes: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
631
+ audio: z.ZodDefault<z.ZodNullable<z.ZodReadonly<z.ZodObject<{
632
+ provider: z.ZodLiteral<"elevenlabs">;
633
+ mode: z.ZodEnum<{
634
+ /** Text to speech: the prompt is the spoken text. */
635
+ readonly speech: "speech";
636
+ /** Music: the prompt describes the track. */
637
+ readonly music: "music";
638
+ }>;
639
+ voices: z.ZodReadonly<z.ZodArray<z.ZodLazy<z.ZodReadonly<z.ZodObject<{
640
+ id: z.ZodString;
641
+ label: z.ZodString;
642
+ }, z.core.$strict>>>>>;
643
+ defaultVoiceId: z.ZodNullable<z.ZodString>;
644
+ seconds: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
645
+ min: z.ZodNumber;
646
+ max: z.ZodNumber;
647
+ default: z.ZodNumber;
648
+ }, z.core.$strict>>>;
649
+ milliunitsPerUnit: z.ZodNumber;
650
+ }, z.core.$strict>>>>;
651
+ video: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
652
+ minSeconds: z.ZodNumber;
653
+ maxSeconds: z.ZodNumber;
654
+ defaultSeconds: z.ZodNumber;
655
+ durations: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
656
+ formats: z.ZodReadonly<z.ZodArray<z.ZodLazy<z.ZodReadonly<z.ZodObject<{
657
+ resolution: z.ZodEnum<{
658
+ /** 480p. */
659
+ readonly p480: "480p";
660
+ /** 720p. */
661
+ readonly p720: "720p";
662
+ /** 768p, admitted only by MiniMax H3 Max. */
663
+ readonly p768: "768p";
664
+ /** 1080p. */
665
+ readonly p1080: "1080p";
666
+ /** 4k, admitted only by Seedance 2.0. */
667
+ readonly p4k: "4k";
668
+ }>;
669
+ aspectRatio: z.ZodEnum<{
670
+ /** Landscape widescreen. */
671
+ readonly wide: "16:9";
672
+ /** Landscape standard. */
673
+ readonly landscape: "4:3";
674
+ /** Square. */
675
+ readonly square: "1:1";
676
+ /** Portrait standard. */
677
+ readonly portrait: "3:4";
678
+ /** Portrait widescreen. */
679
+ readonly tall: "9:16";
680
+ /** Landscape ultrawide. */
681
+ readonly ultrawide: "21:9";
682
+ /** Portrait ultrawide. */
683
+ readonly ultratall: "9:21";
684
+ }>;
685
+ width: z.ZodNumber;
686
+ height: z.ZodNumber;
687
+ }, z.core.$strict>>>>>;
688
+ defaultResolution: z.ZodEnum<{
689
+ /** 480p. */
690
+ readonly p480: "480p";
691
+ /** 720p. */
692
+ readonly p720: "720p";
693
+ /** 768p, admitted only by MiniMax H3 Max. */
694
+ readonly p768: "768p";
695
+ /** 1080p. */
696
+ readonly p1080: "1080p";
697
+ /** 4k, admitted only by Seedance 2.0. */
698
+ readonly p4k: "4k";
699
+ }>;
700
+ defaultAspectRatio: z.ZodEnum<{
701
+ /** Landscape widescreen. */
702
+ readonly wide: "16:9";
703
+ /** Landscape standard. */
704
+ readonly landscape: "4:3";
705
+ /** Square. */
706
+ readonly square: "1:1";
707
+ /** Portrait standard. */
708
+ readonly portrait: "3:4";
709
+ /** Portrait widescreen. */
710
+ readonly tall: "9:16";
711
+ /** Landscape ultrawide. */
712
+ readonly ultrawide: "21:9";
713
+ /** Portrait ultrawide. */
714
+ readonly ultratall: "9:21";
715
+ }>;
716
+ supportsAudio: z.ZodBoolean;
717
+ defaultGenerateAudio: z.ZodNullable<z.ZodBoolean>;
718
+ referenceRoles: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
719
+ /** First frame; required when a last frame is supplied. */
720
+ readonly first: "first-frame";
721
+ /** Last frame, supported by Seedance only (`last_frame_image`). */
722
+ readonly last: "last-frame";
723
+ /** One image in Seedance reference-image mode. */
724
+ readonly reference: "reference";
725
+ }>>>;
726
+ maxReferenceImages: z.ZodNumber;
727
+ referenceResolutions: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
728
+ /** 480p. */
729
+ readonly p480: "480p";
730
+ /** 720p. */
731
+ readonly p720: "720p";
732
+ /** 768p, admitted only by MiniMax H3 Max. */
733
+ readonly p768: "768p";
734
+ /** 1080p. */
735
+ readonly p1080: "1080p";
736
+ /** 4k, admitted only by Seedance 2.0. */
737
+ readonly p4k: "4k";
738
+ }>>>;
739
+ prices: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
740
+ resolution: z.ZodEnum<{
741
+ /** 480p. */
742
+ readonly p480: "480p";
743
+ /** 720p. */
744
+ readonly p720: "720p";
745
+ /** 768p, admitted only by MiniMax H3 Max. */
746
+ readonly p768: "768p";
747
+ /** 1080p. */
748
+ readonly p1080: "1080p";
749
+ /** 4k, admitted only by Seedance 2.0. */
750
+ readonly p4k: "4k";
751
+ }>;
752
+ silentMilliunitsPerSecond: z.ZodNumber;
753
+ audioMilliunitsPerSecond: z.ZodNumber;
754
+ }, z.core.$strict>>>>;
755
+ audioReferences: z.ZodDefault<z.ZodNullable<z.ZodReadonly<z.ZodObject<{
756
+ max: z.ZodNumber;
757
+ totalSeconds: z.ZodNumber;
758
+ }, z.core.$strict>>>>;
759
+ provider: z.ZodEnum<{
760
+ /** Seedance integer duration and data-URI image fields. */
761
+ readonly seedance: "seedance";
762
+ /** Veo duration string and base64 image_input. */
763
+ readonly veo: "veo";
764
+ /** MiniMax multimodal `content[]` array and uppercase resolution. */
765
+ readonly minimax: "minimax";
766
+ /** The injected provider owns the wire grammar. */
767
+ readonly host: "host";
768
+ }>;
769
+ }, z.core.$strict>>>;
770
+ }, z.core.$strict>>;
771
+ /** One provider's catalogue entry. */
772
+ export type MediaCatalogueModel = z.output<typeof mediaCatalogueModelSchema>;
773
+ /** One provider's model list: the typed bounds every request is checked against. */
774
+ export type MediaCatalogue = readonly MediaCatalogueModel[];
775
+ /**
776
+ * Decode a host-supplied provider catalogue. Each entry is the same typed wire
777
+ * grammar the built-in catalogue uses; this adds the cross-field facts the
778
+ * validator relies on (unique ids, video metadata iff `kind` is video, defaults
779
+ * inside their own bounds).
780
+ */
781
+ export declare const mediaCatalogueSchema: z.ZodPipe<z.ZodArray<z.ZodReadonly<z.ZodObject<{
782
+ id: z.ZodString;
783
+ label: z.ZodString;
784
+ kind: z.ZodEnum<{
785
+ /** Still-image generation. */
786
+ readonly image: "image";
787
+ /** Video generation. */
788
+ readonly video: "video";
789
+ /** Speech or music generation. */
790
+ readonly audio: "audio";
791
+ }>;
792
+ tier: z.ZodEnum<{
793
+ /** Cheap, fast draft model. */
794
+ readonly draft: "draft";
795
+ /** Balanced model selection. */
796
+ readonly balanced: "balanced";
797
+ /** Premium model selection. */
798
+ readonly premium: "premium";
799
+ /** Most expensive model selection. */
800
+ readonly max: "max";
801
+ }>;
802
+ outputFormats: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
803
+ /** PNG image encoding. */
804
+ readonly png: "png";
805
+ /** JPEG image encoding. */
806
+ readonly jpeg: "jpeg";
807
+ /** WebP image encoding. */
808
+ readonly webp: "webp";
809
+ }>>>;
810
+ maxPromptLength: z.ZodNumber;
811
+ input: z.ZodLazy<z.ZodReadonly<z.ZodObject<{
812
+ transport: z.ZodEnum<{
813
+ /** JSON provider input. */
814
+ readonly json: "json";
815
+ /** Multipart provider input. */
816
+ readonly multipart: "multipart";
817
+ }>;
818
+ dimensions: z.ZodEnum<{
819
+ /** Provider chooses its own dimensions. */
820
+ readonly none: "none";
821
+ /** Provider accepts the requested dimensions. */
822
+ readonly own: "own";
823
+ }>;
824
+ maxDimension: z.ZodNullable<z.ZodNumber>;
825
+ maxDimensionDocumented: z.ZodBoolean;
826
+ defaultWidth: z.ZodNumber;
827
+ defaultHeight: z.ZodNumber;
828
+ steps: z.ZodEnum<{
829
+ /** Provider reads the steps field. */
830
+ readonly steps: "steps";
831
+ /** Provider reads the num_steps field. */
832
+ readonly num_steps: "num_steps";
833
+ /** Provider uses fixed inference steps. */
834
+ readonly fixed: "fixed";
835
+ }>;
836
+ maxSteps: z.ZodNullable<z.ZodNumber>;
837
+ defaultSteps: z.ZodNullable<z.ZodNumber>;
838
+ referenceField: z.ZodNullable<z.ZodString>;
839
+ maxReferences: z.ZodNumber;
840
+ referenceDimension: z.ZodNullable<z.ZodNumber>;
841
+ referenceFormat: z.ZodEnum<{
842
+ /** Lossless PNG. */
843
+ readonly png: "png";
844
+ /** Lossy WebP. */
845
+ readonly webp: "webp";
846
+ }>;
847
+ }, z.core.$strict>>>;
848
+ sizes: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
849
+ audio: z.ZodDefault<z.ZodNullable<z.ZodReadonly<z.ZodObject<{
850
+ provider: z.ZodLiteral<"elevenlabs">;
851
+ mode: z.ZodEnum<{
852
+ /** Text to speech: the prompt is the spoken text. */
853
+ readonly speech: "speech";
854
+ /** Music: the prompt describes the track. */
855
+ readonly music: "music";
856
+ }>;
857
+ voices: z.ZodReadonly<z.ZodArray<z.ZodLazy<z.ZodReadonly<z.ZodObject<{
858
+ id: z.ZodString;
859
+ label: z.ZodString;
860
+ }, z.core.$strict>>>>>;
861
+ defaultVoiceId: z.ZodNullable<z.ZodString>;
862
+ seconds: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
863
+ min: z.ZodNumber;
864
+ max: z.ZodNumber;
865
+ default: z.ZodNumber;
866
+ }, z.core.$strict>>>;
867
+ milliunitsPerUnit: z.ZodNumber;
868
+ }, z.core.$strict>>>>;
869
+ video: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
870
+ minSeconds: z.ZodNumber;
871
+ maxSeconds: z.ZodNumber;
872
+ defaultSeconds: z.ZodNumber;
873
+ durations: z.ZodReadonly<z.ZodArray<z.ZodNumber>>;
874
+ formats: z.ZodReadonly<z.ZodArray<z.ZodLazy<z.ZodReadonly<z.ZodObject<{
875
+ resolution: z.ZodEnum<{
876
+ /** 480p. */
877
+ readonly p480: "480p";
878
+ /** 720p. */
879
+ readonly p720: "720p";
880
+ /** 768p, admitted only by MiniMax H3 Max. */
881
+ readonly p768: "768p";
882
+ /** 1080p. */
883
+ readonly p1080: "1080p";
884
+ /** 4k, admitted only by Seedance 2.0. */
885
+ readonly p4k: "4k";
886
+ }>;
887
+ aspectRatio: z.ZodEnum<{
888
+ /** Landscape widescreen. */
889
+ readonly wide: "16:9";
890
+ /** Landscape standard. */
891
+ readonly landscape: "4:3";
892
+ /** Square. */
893
+ readonly square: "1:1";
894
+ /** Portrait standard. */
895
+ readonly portrait: "3:4";
896
+ /** Portrait widescreen. */
897
+ readonly tall: "9:16";
898
+ /** Landscape ultrawide. */
899
+ readonly ultrawide: "21:9";
900
+ /** Portrait ultrawide. */
901
+ readonly ultratall: "9:21";
902
+ }>;
903
+ width: z.ZodNumber;
904
+ height: z.ZodNumber;
905
+ }, z.core.$strict>>>>>;
906
+ defaultResolution: z.ZodEnum<{
907
+ /** 480p. */
908
+ readonly p480: "480p";
909
+ /** 720p. */
910
+ readonly p720: "720p";
911
+ /** 768p, admitted only by MiniMax H3 Max. */
912
+ readonly p768: "768p";
913
+ /** 1080p. */
914
+ readonly p1080: "1080p";
915
+ /** 4k, admitted only by Seedance 2.0. */
916
+ readonly p4k: "4k";
917
+ }>;
918
+ defaultAspectRatio: z.ZodEnum<{
919
+ /** Landscape widescreen. */
920
+ readonly wide: "16:9";
921
+ /** Landscape standard. */
922
+ readonly landscape: "4:3";
923
+ /** Square. */
924
+ readonly square: "1:1";
925
+ /** Portrait standard. */
926
+ readonly portrait: "3:4";
927
+ /** Portrait widescreen. */
928
+ readonly tall: "9:16";
929
+ /** Landscape ultrawide. */
930
+ readonly ultrawide: "21:9";
931
+ /** Portrait ultrawide. */
932
+ readonly ultratall: "9:21";
933
+ }>;
934
+ supportsAudio: z.ZodBoolean;
935
+ defaultGenerateAudio: z.ZodNullable<z.ZodBoolean>;
936
+ referenceRoles: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
937
+ /** First frame; required when a last frame is supplied. */
938
+ readonly first: "first-frame";
939
+ /** Last frame, supported by Seedance only (`last_frame_image`). */
940
+ readonly last: "last-frame";
941
+ /** One image in Seedance reference-image mode. */
942
+ readonly reference: "reference";
943
+ }>>>;
944
+ maxReferenceImages: z.ZodNumber;
945
+ referenceResolutions: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
946
+ /** 480p. */
947
+ readonly p480: "480p";
948
+ /** 720p. */
949
+ readonly p720: "720p";
950
+ /** 768p, admitted only by MiniMax H3 Max. */
951
+ readonly p768: "768p";
952
+ /** 1080p. */
953
+ readonly p1080: "1080p";
954
+ /** 4k, admitted only by Seedance 2.0. */
955
+ readonly p4k: "4k";
956
+ }>>>;
957
+ prices: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
958
+ resolution: z.ZodEnum<{
959
+ /** 480p. */
960
+ readonly p480: "480p";
961
+ /** 720p. */
962
+ readonly p720: "720p";
963
+ /** 768p, admitted only by MiniMax H3 Max. */
964
+ readonly p768: "768p";
965
+ /** 1080p. */
966
+ readonly p1080: "1080p";
967
+ /** 4k, admitted only by Seedance 2.0. */
968
+ readonly p4k: "4k";
969
+ }>;
970
+ silentMilliunitsPerSecond: z.ZodNumber;
971
+ audioMilliunitsPerSecond: z.ZodNumber;
972
+ }, z.core.$strict>>>>;
973
+ audioReferences: z.ZodDefault<z.ZodNullable<z.ZodReadonly<z.ZodObject<{
974
+ max: z.ZodNumber;
975
+ totalSeconds: z.ZodNumber;
976
+ }, z.core.$strict>>>>;
977
+ provider: z.ZodEnum<{
978
+ /** Seedance integer duration and data-URI image fields. */
979
+ readonly seedance: "seedance";
980
+ /** Veo duration string and base64 image_input. */
981
+ readonly veo: "veo";
982
+ /** MiniMax multimodal `content[]` array and uppercase resolution. */
983
+ readonly minimax: "minimax";
984
+ /** The injected provider owns the wire grammar. */
985
+ readonly host: "host";
986
+ }>;
987
+ }, z.core.$strict>>>;
988
+ }, z.core.$strict>>>, z.ZodTransform<MediaCatalogue, Readonly<{
989
+ id: string;
990
+ label: string;
991
+ kind: "image" | "video" | "audio";
992
+ tier: "draft" | "balanced" | "premium" | "max";
993
+ outputFormats: readonly ("png" | "jpeg" | "webp")[];
994
+ maxPromptLength: number;
995
+ input: Readonly<{
996
+ transport: "json" | "multipart";
997
+ dimensions: "none" | "own";
998
+ maxDimension: number | null;
999
+ maxDimensionDocumented: boolean;
1000
+ defaultWidth: number;
1001
+ defaultHeight: number;
1002
+ steps: "steps" | "num_steps" | "fixed";
1003
+ maxSteps: number | null;
1004
+ defaultSteps: number | null;
1005
+ referenceField: string | null;
1006
+ maxReferences: number;
1007
+ referenceDimension: number | null;
1008
+ referenceFormat: "png" | "webp";
1009
+ }>;
1010
+ sizes: readonly string[] | null;
1011
+ audio: Readonly<{
1012
+ provider: "elevenlabs";
1013
+ mode: "music" | "speech";
1014
+ voices: readonly Readonly<{
1015
+ id: string;
1016
+ label: string;
1017
+ }>[];
1018
+ defaultVoiceId: string | null;
1019
+ seconds: Readonly<{
1020
+ min: number;
1021
+ max: number;
1022
+ default: number;
1023
+ }> | null;
1024
+ milliunitsPerUnit: number;
1025
+ }> | null;
1026
+ video: Readonly<{
1027
+ minSeconds: number;
1028
+ maxSeconds: number;
1029
+ defaultSeconds: number;
1030
+ durations: readonly number[];
1031
+ formats: readonly Readonly<{
1032
+ resolution: "480p" | "720p" | "768p" | "1080p" | "4k";
1033
+ aspectRatio: "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
1034
+ width: number;
1035
+ height: number;
1036
+ }>[];
1037
+ defaultResolution: "480p" | "720p" | "768p" | "1080p" | "4k";
1038
+ defaultAspectRatio: "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
1039
+ supportsAudio: boolean;
1040
+ defaultGenerateAudio: boolean | null;
1041
+ referenceRoles: readonly ("first-frame" | "last-frame" | "reference")[];
1042
+ maxReferenceImages: number;
1043
+ referenceResolutions: readonly ("480p" | "720p" | "768p" | "1080p" | "4k")[];
1044
+ prices: readonly Readonly<{
1045
+ resolution: "480p" | "720p" | "768p" | "1080p" | "4k";
1046
+ silentMilliunitsPerSecond: number;
1047
+ audioMilliunitsPerSecond: number;
1048
+ }>[];
1049
+ audioReferences: Readonly<{
1050
+ max: number;
1051
+ totalSeconds: number;
1052
+ }> | null;
1053
+ provider: "seedance" | "veo" | "minimax" | "host";
1054
+ }> | null;
1055
+ }>[]>>;
1056
+ /** Decode untrusted catalogue data, throwing a MediaSettingsError that names the first problem. */
1057
+ export declare const parseMediaCatalogue: (raw: unknown) => MediaCatalogue;
1058
+ /** List the gateway provider's models in catalog order. */
479
1059
  export declare const listMediaModels: () => readonly MediaModel[];
480
- /** Find a model by provider identifier, returning undefined when it is absent. */
481
- export declare const getMediaModel: (id: string) => MediaModel | undefined;
1060
+ /** A catalog entry that is a picture or video model. */
1061
+ export type MediaPictureModel = Omit<MediaModel, "kind" | "audio"> & {
1062
+ /** Still-image or video generation; never audio. */
1063
+ readonly kind: "image" | "video";
1064
+ /** Always null for a picture or video model. */
1065
+ readonly audio: null;
1066
+ };
1067
+ /**
1068
+ * The gateway models Apps and browsers list and pick from: pictures and video.
1069
+ * The Agar and Prints catalog decoders know no `audio` kind yet, and one unknown
1070
+ * row fails the whole list, so audio models are generated by id until the
1071
+ * Prints audio UI lands and lists them.
1072
+ */
1073
+ export declare const listPictureMediaModels: () => readonly MediaPictureModel[];
1074
+ /** Find a model in the Fungi gateway's own catalogue; gateway-internal code never sees a custom provider's models. */
1075
+ export declare const getGatewayModel: (id: string) => MediaModel | undefined;
1076
+ /** Find a model in `catalogue` (the gateway's by default), or undefined when absent. */
1077
+ export declare const getMediaModel: (id: string, catalogue?: MediaCatalogue) => MediaCatalogueModel | undefined;
482
1078
  /** Invalid generation settings or unsupported model parameters. */
483
1079
  export declare class MediaSettingsError extends Error {
484
- constructor(message: string);
1080
+ constructor(message: string, options?: ErrorOptions);
485
1081
  }