@howells/motif-sdk 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -171,7 +171,6 @@ interface FalPricing {
171
171
  }
172
172
  interface LeaderboardMetric {
173
173
  elo: number;
174
- pricePer1k?: number | null;
175
174
  rank: number;
176
175
  winRate?: number;
177
176
  }
@@ -387,6 +386,19 @@ interface JobStatus {
387
386
  queuePosition?: number;
388
387
  status: "queued" | "processing" | "completed" | "failed";
389
388
  }
389
+ /**
390
+ * A tool run accepted by the fal queue.
391
+ *
392
+ * Returned by `FalClient.submitTool`, and the handle passed back to
393
+ * `checkToolStatus` / `getToolResult`. The job itself carries no cost: the
394
+ * rate lives on the registry entry as `FalToolConfig.price`, and for a queued
395
+ * endpoint it is usually per-megapixel or metered, so the final cost is only
396
+ * known once the result is in.
397
+ */
398
+ interface QueuedToolJob {
399
+ endpoint: string;
400
+ requestId: string;
401
+ }
390
402
  /** ─── Configuration ──────────────────────────────────────────── */
391
403
  interface FalClientConfig {
392
404
  apiKey: string;
@@ -444,6 +456,11 @@ declare function buildGenerateBody(options: GenerateOptions): {
444
456
  };
445
457
 
446
458
  interface LeaderboardEntry {
459
+ /**
460
+ * What the model's own vendor charges to run it through their API, as Artificial Analysis
461
+ * quoted it. Not what fal charges us - fal resells several of these for a fraction of the
462
+ * price. For our cost, read `falPricing` on the model in `models.ts`.
463
+ */
447
464
  apiPricing?: string;
448
465
  creator: string;
449
466
  elo: number;
@@ -474,6 +491,23 @@ declare const RECRAFT_STYLES: readonly ["realistic_image", "realistic_image/b_an
474
491
  /** Ideogram v3 top-level style categories. Pass as the `style` field in GenerateOptions. */
475
492
  declare const IDEOGRAM_STYLES: readonly ["AUTO", "GENERAL", "REALISTIC", "DESIGN"];
476
493
 
494
+ /**
495
+ * `MotifError` and its coercion helper.
496
+ *
497
+ * Extracted from `server.ts` so `server-tools.ts` can construct errors without
498
+ * importing back into `server.ts` — that import was a dependency cycle. Both
499
+ * `server.ts` and `server-tools.ts` import from here, and `server.ts`
500
+ * re-exports `MotifError` so the package's public surface is unchanged.
501
+ */
502
+ declare class MotifError extends Error {
503
+ readonly status: number;
504
+ readonly code?: string;
505
+ /** fal's request-correlation id (from the `x-fal-request-id` header or the
506
+ * error body). Ties a failure back to fal's dashboard/support. */
507
+ readonly requestId?: string;
508
+ constructor(message: string, status: number, code?: string, requestId?: string);
509
+ }
510
+
477
511
  /**
478
512
  * FalClient — the fal-native client.
479
513
  *
@@ -540,6 +574,24 @@ declare class FalClient {
540
574
  /** ─── Utilities ───────────────────────────────────────────── */
541
575
  /** Run a registered fal utility/tool endpoint. */
542
576
  runTool(options: ToolRunOptions): Promise<Result<ToolResponse, MotifError>>;
577
+ /** ─── Queue-Based Tools ───────────────────────────────────── */
578
+ /**
579
+ * Submit a tool run to the fal queue. Returns as soon as fal accepts it.
580
+ *
581
+ * The queued counterpart to `runTool`, for endpoints that outrun the
582
+ * synchronous request timeout. Callers choose the path — neither one falls
583
+ * back to the other.
584
+ */
585
+ submitTool(options: ToolRunOptions): Promise<Result<QueuedToolJob, MotifError>>;
586
+ /** Poll one queued tool run. */
587
+ checkToolStatus(job: QueuedToolJob): Promise<Result<JobStatus, MotifError>>;
588
+ /** Fetch the finished payload for a queued tool run. */
589
+ getToolResult(job: QueuedToolJob): Promise<Result<ToolResponse, MotifError>>;
590
+ /**
591
+ * Submit, poll to completion, and return the result. The convenience path
592
+ * for tools whose registry entry sets `queued`.
593
+ */
594
+ runToolQueued(options: ToolRunOptions, onProgress?: (status: string, queuePosition?: number) => void): Promise<Result<ToolResponse, MotifError>>;
543
595
  /**
544
596
  * Delete fal's stored IO payloads for a completed request.
545
597
  *
@@ -563,64 +615,51 @@ declare class FalClient {
563
615
  get utilityModels(): readonly ["clarity", "crystal", "rmbg", "bria"];
564
616
  /** Registered fal utility/tool endpoints. */
565
617
  get tools(): {
566
- readonly birefnet: {
567
- readonly category: "background";
568
- readonly defaultOptions: {
569
- readonly model: "General Use (Light)";
570
- readonly operating_resolution: "1024x1024";
571
- readonly output_format: "png";
572
- readonly refine_foreground: true;
573
- };
574
- readonly description: "High-resolution dichotomous image segmentation and background removal.";
575
- readonly endpoint: "fal-ai/birefnet/v2";
618
+ readonly "depth-anything": {
619
+ readonly category: "preprocess";
620
+ readonly description: "Generate Depth Anything v2 depth maps from input images.";
621
+ readonly endpoint: "fal-ai/image-preprocessors/depth-anything/v2";
576
622
  readonly inputField: "image_url";
577
623
  readonly inputKind: "image";
578
- readonly name: "BirefNet Background Removal";
579
- readonly outputKeys: ["image", "mask_image"];
624
+ readonly name: "Depth Anything v2 Preprocessor";
625
+ readonly outputKeys: ["image"];
626
+ readonly price: {
627
+ readonly kind: "metered";
628
+ };
580
629
  readonly pricing: "$0/compute-second listed by fal";
581
- readonly sourceUrl: "https://fal.ai/models/fal-ai/birefnet/v2";
582
- readonly task: "image background removal";
630
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/depth-anything/v2";
631
+ readonly task: "depth preprocessing";
583
632
  };
584
- readonly "bria-rmbg": {
585
- readonly category: "background";
586
- readonly description: "Commercial-safe background removal for images.";
587
- readonly endpoint: "fal-ai/bria/background/remove";
633
+ readonly dwpose: {
634
+ readonly category: "preprocess";
635
+ readonly description: "Extract body, hand, and face pose skeletons from an image.";
636
+ readonly endpoint: "fal-ai/dwpose";
588
637
  readonly inputField: "image_url";
589
638
  readonly inputKind: "image";
590
- readonly name: "Bria RMBG 2.0";
639
+ readonly name: "DWPose Estimation";
591
640
  readonly outputKeys: ["image"];
592
- readonly pricing: "$0.02/image";
593
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/background/remove";
594
- readonly task: "image background removal";
595
- };
596
- readonly "bria-video-rmbg": {
597
- readonly category: "background";
598
- readonly defaultOptions: {
599
- readonly background_color: "Black";
600
- readonly output_container_and_codec: "webm_vp9";
601
- readonly preserve_audio: true;
641
+ readonly price: {
642
+ readonly kind: "second";
643
+ readonly usd: 0.0006;
602
644
  };
603
- readonly description: "Remove video backgrounds with configurable output container.";
604
- readonly endpoint: "bria/video/background-removal";
605
- readonly inputField: "video_url";
606
- readonly inputKind: "video";
607
- readonly name: "Bria Video Background Removal";
608
- readonly outputKeys: ["video"];
609
- readonly pricing: "$0.14/sec";
610
- readonly sourceUrl: "https://fal.ai/models/bria/video/background-removal";
611
- readonly task: "video background removal";
645
+ readonly pricing: "$0.0006/compute-second";
646
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/dwpose";
647
+ readonly task: "pose preprocessing";
612
648
  };
613
- readonly "depth-anything": {
649
+ readonly hed: {
614
650
  readonly category: "preprocess";
615
- readonly description: "Generate Depth Anything v2 depth maps from input images.";
616
- readonly endpoint: "fal-ai/image-preprocessors/depth-anything/v2";
651
+ readonly description: "Generate HED soft edge maps for ControlNet-style workflows.";
652
+ readonly endpoint: "fal-ai/image-preprocessors/hed";
617
653
  readonly inputField: "image_url";
618
654
  readonly inputKind: "image";
619
- readonly name: "Depth Anything v2 Preprocessor";
655
+ readonly name: "HED Edge Preprocessor";
620
656
  readonly outputKeys: ["image"];
657
+ readonly price: {
658
+ readonly kind: "metered";
659
+ };
621
660
  readonly pricing: "$0/compute-second listed by fal";
622
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/depth-anything/v2";
623
- readonly task: "depth preprocessing";
661
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/hed";
662
+ readonly task: "edge preprocessing";
624
663
  };
625
664
  readonly lineart: {
626
665
  readonly category: "preprocess";
@@ -633,6 +672,9 @@ declare class FalClient {
633
672
  readonly inputKind: "image";
634
673
  readonly name: "Line Art Preprocessor";
635
674
  readonly outputKeys: ["image"];
675
+ readonly price: {
676
+ readonly kind: "metered";
677
+ };
636
678
  readonly pricing: "$0/compute-second listed by fal";
637
679
  readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/lineart";
638
680
  readonly task: "image preprocessing";
@@ -649,6 +691,9 @@ declare class FalClient {
649
691
  readonly inputKind: "image";
650
692
  readonly name: "Marigold Depth Estimation";
651
693
  readonly outputKeys: ["image"];
694
+ readonly price: {
695
+ readonly kind: "metered";
696
+ };
652
697
  readonly pricing: "$0/compute-second listed by fal";
653
698
  readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/marigold-depth";
654
699
  readonly task: "depth map";
@@ -665,6 +710,9 @@ declare class FalClient {
665
710
  readonly inputKind: "image";
666
711
  readonly name: "MiDaS Depth Estimation";
667
712
  readonly outputKeys: ["image"];
713
+ readonly price: {
714
+ readonly kind: "metered";
715
+ };
668
716
  readonly pricing: "$0/compute-second listed by fal";
669
717
  readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/depth";
670
718
  readonly task: "depth map";
@@ -677,36 +725,42 @@ declare class FalClient {
677
725
  readonly inputKind: "image";
678
726
  readonly name: "MiDaS Preprocessor";
679
727
  readonly outputKeys: ["depth_map", "normal_map"];
728
+ readonly price: {
729
+ readonly kind: "metered";
730
+ };
680
731
  readonly pricing: "$0/compute-second listed by fal";
681
732
  readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/midas";
682
733
  readonly task: "depth and normal preprocessing";
683
734
  };
684
- readonly nsfw: {
685
- readonly category: "moderation";
686
- readonly description: "Predict whether one or more images contain NSFW concepts.";
687
- readonly endpoint: "fal-ai/x-ailab/nsfw";
688
- readonly inputField: "image_urls";
689
- readonly inputKind: "images";
690
- readonly name: "NSFW Checker";
691
- readonly outputKeys: ["has_nsfw_concepts"];
692
- readonly pricing: "$0.001/image";
693
- readonly sourceUrl: "https://fal.ai/models/fal-ai/x-ailab/nsfw";
694
- readonly task: "vision moderation";
695
- };
696
- readonly rembg: {
697
- readonly category: "background";
698
- readonly defaultOptions: {
699
- readonly crop_to_bbox: false;
735
+ readonly mlsd: {
736
+ readonly category: "preprocess";
737
+ readonly description: "Detect straight line segments for architectural and interior control maps.";
738
+ readonly endpoint: "fal-ai/image-preprocessors/mlsd";
739
+ readonly inputField: "image_url";
740
+ readonly inputKind: "image";
741
+ readonly name: "M-LSD Line Preprocessor";
742
+ readonly outputKeys: ["image"];
743
+ readonly price: {
744
+ readonly kind: "metered";
700
745
  };
701
- readonly description: "Generic image background removal utility.";
702
- readonly endpoint: "fal-ai/imageutils/rembg";
746
+ readonly pricing: "$0/compute-second listed by fal";
747
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/mlsd";
748
+ readonly task: "line segment preprocessing";
749
+ };
750
+ readonly pidi: {
751
+ readonly category: "preprocess";
752
+ readonly description: "Generate PiDiNet soft edge maps from an input image.";
753
+ readonly endpoint: "fal-ai/image-preprocessors/pidi";
703
754
  readonly inputField: "image_url";
704
755
  readonly inputKind: "image";
705
- readonly name: "Remove Background";
756
+ readonly name: "PiDiNet Edge Preprocessor";
706
757
  readonly outputKeys: ["image"];
758
+ readonly price: {
759
+ readonly kind: "metered";
760
+ };
707
761
  readonly pricing: "$0/compute-second listed by fal";
708
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/rembg";
709
- readonly task: "image background removal";
762
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/pidi";
763
+ readonly task: "edge preprocessing";
710
764
  };
711
765
  readonly "sam-preprocessor": {
712
766
  readonly category: "preprocess";
@@ -716,6 +770,9 @@ declare class FalClient {
716
770
  readonly inputKind: "image";
717
771
  readonly name: "SAM Preprocessor";
718
772
  readonly outputKeys: ["image"];
773
+ readonly price: {
774
+ readonly kind: "metered";
775
+ };
719
776
  readonly pricing: "$0/compute-second listed by fal";
720
777
  readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/sam";
721
778
  readonly task: "segmentation preprocessing";
@@ -735,7 +792,11 @@ declare class FalClient {
735
792
  readonly inputKind: "image";
736
793
  readonly name: "SAM 2 Auto Segment";
737
794
  readonly outputKeys: ["combined_mask", "individual_masks"];
795
+ readonly price: {
796
+ readonly kind: "metered";
797
+ };
738
798
  readonly pricing: "$0/compute-second listed by fal";
799
+ readonly queued: true;
739
800
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam2/auto-segment";
740
801
  readonly task: "automatic image segmentation";
741
802
  };
@@ -752,7 +813,11 @@ declare class FalClient {
752
813
  readonly inputKind: "image";
753
814
  readonly name: "SAM 3.1 Image";
754
815
  readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
755
- readonly pricing: "$0.005/request";
816
+ readonly price: {
817
+ readonly kind: "call";
818
+ readonly usd: 0.01;
819
+ };
820
+ readonly pricing: "$0.01/request";
756
821
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/image";
757
822
  readonly task: "promptable image segmentation";
758
823
  };
@@ -768,54 +833,14 @@ declare class FalClient {
768
833
  readonly inputKind: "video";
769
834
  readonly name: "SAM 3.1 Video";
770
835
  readonly outputKeys: ["video", "boundingbox_frames_zip"];
771
- readonly pricing: "fal pricing varies by frame count";
836
+ readonly price: {
837
+ readonly kind: "metered";
838
+ };
839
+ readonly pricing: "$0.01/16 frames of video input";
840
+ readonly queued: true;
772
841
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/video";
773
842
  readonly task: "multi-object video segmentation";
774
843
  };
775
- readonly "sam3-3d-align": {
776
- readonly category: "3d";
777
- readonly description: "Align SAM 3D objects and bodies into a shared scene.";
778
- readonly endpoint: "fal-ai/sam-3/3d-align";
779
- readonly inputField: "image_url";
780
- readonly inputKind: "image";
781
- readonly name: "SAM 3D Align";
782
- readonly outputKeys: ["scene_glb", "metadata", "artifacts_zip"];
783
- readonly pricing: "fal pricing varies by scene";
784
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-align";
785
- readonly task: "3D scene alignment";
786
- };
787
- readonly "sam3-3d-body": {
788
- readonly category: "3d";
789
- readonly defaultOptions: {
790
- readonly export_meshes: true;
791
- readonly include_3d_keypoints: true;
792
- readonly include_mhr_params: true;
793
- };
794
- readonly description: "Reconstruct human body meshes and keypoints from a single image.";
795
- readonly endpoint: "fal-ai/sam-3/3d-body";
796
- readonly inputField: "image_url";
797
- readonly inputKind: "image";
798
- readonly name: "SAM 3D Body";
799
- readonly outputKeys: ["model_glb", "visualization", "meshes", "metadata"];
800
- readonly pricing: "$0.015/inference";
801
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-body";
802
- readonly task: "single-image 3D body reconstruction";
803
- };
804
- readonly "sam3-3d-objects": {
805
- readonly category: "3d";
806
- readonly defaultOptions: {
807
- readonly prompt: "car";
808
- };
809
- readonly description: "Reconstruct one or more 3D objects from an image and prompts.";
810
- readonly endpoint: "fal-ai/sam-3/3d-objects";
811
- readonly inputField: "image_url";
812
- readonly inputKind: "image";
813
- readonly name: "SAM 3D Objects";
814
- readonly outputKeys: ["gaussian_splat", "model_glb", "metadata", "individual_splats", "individual_glbs", "artifacts_zip"];
815
- readonly pricing: "$0.02/generation";
816
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-objects";
817
- readonly task: "single-image 3D object reconstruction";
818
- };
819
844
  readonly "sam3-image": {
820
845
  readonly category: "segmentation";
821
846
  readonly defaultOptions: {
@@ -829,6 +854,10 @@ declare class FalClient {
829
854
  readonly inputKind: "image";
830
855
  readonly name: "SAM 3 Image";
831
856
  readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
857
+ readonly price: {
858
+ readonly kind: "call";
859
+ readonly usd: 0.005;
860
+ };
832
861
  readonly pricing: "$0.005/request";
833
862
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image";
834
863
  readonly task: "promptable image segmentation";
@@ -844,7 +873,11 @@ declare class FalClient {
844
873
  readonly inputField: "image_url";
845
874
  readonly inputKind: "image";
846
875
  readonly name: "SAM 3 Image RLE";
847
- readonly outputKeys: ["rle_masks", "metadata", "scores", "boxes"];
876
+ readonly outputKeys: ["rle", "scores", "boxes", "metadata"];
877
+ readonly price: {
878
+ readonly kind: "call";
879
+ readonly usd: 0.005;
880
+ };
848
881
  readonly pricing: "$0.005/request";
849
882
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image-rle";
850
883
  readonly task: "promptable image segmentation to RLE";
@@ -863,7 +896,11 @@ declare class FalClient {
863
896
  readonly inputKind: "video";
864
897
  readonly name: "SAM 3 Video";
865
898
  readonly outputKeys: ["video", "boundingbox_frames_zip"];
866
- readonly pricing: "$0.005/16 frames";
899
+ readonly price: {
900
+ readonly kind: "metered";
901
+ };
902
+ readonly pricing: "$0.005/16 frames of video input";
903
+ readonly queued: true;
867
904
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video";
868
905
  readonly task: "promptable video segmentation";
869
906
  };
@@ -879,104 +916,1680 @@ declare class FalClient {
879
916
  readonly inputField: "video_url";
880
917
  readonly inputKind: "video";
881
918
  readonly name: "SAM 3 Video RLE";
882
- readonly outputKeys: ["rle_masks", "metadata"];
883
- readonly pricing: "$0.005/16 frames";
919
+ readonly outputKeys: ["video", "boundingbox_frames_zip"];
920
+ readonly price: {
921
+ readonly kind: "metered";
922
+ };
923
+ readonly pricing: "$0.005/16 frames of video";
924
+ readonly queued: true;
884
925
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video-rle";
885
926
  readonly task: "promptable video segmentation to RLE";
886
927
  };
887
- readonly "topaz-image": {
888
- readonly category: "upscale";
889
- readonly defaultOptions: {
890
- readonly model: "Standard V2";
891
- readonly output_format: "jpeg";
892
- readonly upscale_factor: 2;
928
+ readonly scribble: {
929
+ readonly category: "preprocess";
930
+ readonly description: "Turn an image into a scribble-style control map.";
931
+ readonly endpoint: "fal-ai/image-preprocessors/scribble";
932
+ readonly inputField: "image_url";
933
+ readonly inputKind: "image";
934
+ readonly name: "Scribble Preprocessor";
935
+ readonly outputKeys: ["image"];
936
+ readonly price: {
937
+ readonly kind: "metered";
893
938
  };
894
- readonly description: "Professional Topaz image enhancement and upscaling.";
895
- readonly endpoint: "fal-ai/topaz/upscale/image";
939
+ readonly pricing: "$0/compute-second listed by fal";
940
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/scribble";
941
+ readonly task: "scribble preprocessing";
942
+ };
943
+ readonly teed: {
944
+ readonly category: "preprocess";
945
+ readonly description: "Generate TEED edge maps from an input image.";
946
+ readonly endpoint: "fal-ai/image-preprocessors/teed";
896
947
  readonly inputField: "image_url";
897
948
  readonly inputKind: "image";
898
- readonly name: "Topaz Image Upscale";
949
+ readonly name: "TEED Edge Preprocessor";
899
950
  readonly outputKeys: ["image"];
900
- readonly pricing: "$0.08+ by output megapixels";
901
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image";
902
- readonly task: "image enhancement";
951
+ readonly price: {
952
+ readonly kind: "metered";
953
+ };
954
+ readonly pricing: "$0/compute-second listed by fal";
955
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/teed";
956
+ readonly task: "edge preprocessing";
903
957
  };
904
- readonly "topaz-video": {
905
- readonly category: "upscale";
906
- readonly defaultOptions: {
907
- readonly model: "Proteus";
908
- readonly upscale_factor: 2;
958
+ readonly "zoe-depth": {
959
+ readonly category: "preprocess";
960
+ readonly description: "Generate ZoeDepth metric depth maps from an input image.";
961
+ readonly endpoint: "fal-ai/image-preprocessors/zoe";
962
+ readonly inputField: "image_url";
963
+ readonly inputKind: "image";
964
+ readonly name: "ZoeDepth Preprocessor";
965
+ readonly outputKeys: ["image"];
966
+ readonly price: {
967
+ readonly kind: "metered";
909
968
  };
910
- readonly description: "Professional Topaz video enhancement and upscaling.";
911
- readonly endpoint: "fal-ai/topaz/upscale/video";
912
- readonly inputField: "video_url";
913
- readonly inputKind: "video";
914
- readonly name: "Topaz Video Upscale";
915
- readonly outputKeys: ["video"];
916
- readonly pricing: "$0.01-$0.08/sec by output resolution";
917
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video";
918
- readonly task: "video enhancement";
969
+ readonly pricing: "$0/compute-second listed by fal";
970
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/zoe";
971
+ readonly task: "depth preprocessing";
919
972
  };
920
- };
921
- /** ─── Private ─────────────────────────────────────────────── */
922
- /** Authenticated fetch to fal.ai APIs with retry logic. */
923
- private request;
924
- private ephemeralHeaders;
925
- /**
926
- * Normalize fal.ai responses.
927
- * Some APIs return `{ image: {...} }` instead of `{ images: [...] }`.
928
- */
929
- private normalizeResponse;
930
- }
931
- declare class MotifError extends Error {
932
- readonly status: number;
933
- readonly code?: string;
934
- /** fal's request-correlation id (from the `x-fal-request-id` header or the
935
- * error body). Ties a failure back to fal's dashboard/support. */
936
- readonly requestId?: string;
937
- constructor(message: string, status: number, code?: string, requestId?: string);
938
- }
939
-
940
- type FalToolInputKind = "image" | "images" | "video";
941
- interface FalToolConfig {
942
- category: "3d" | "background" | "depth" | "moderation" | "preprocess" | "segmentation" | "upscale";
943
- defaultOptions?: Record<string, unknown>;
944
- description: string;
945
- endpoint: string;
946
- inputField: "image_url" | "image_urls" | "video_url";
947
- inputKind: FalToolInputKind;
948
- name: string;
949
- outputKeys: string[];
950
- pricing: string;
951
- sourceUrl: string;
952
- task: string;
953
- }
954
- interface FalToolRunOptions {
955
- input?: string;
956
- inputs?: string[];
957
- options?: Record<string, unknown>;
958
- tool: string;
959
- }
960
- interface FalToolRequest {
961
- body: Record<string, unknown>;
962
- endpoint: string;
963
- tool: FalToolConfig;
964
- }
965
- declare const FAL_TOOLS: {
966
- readonly birefnet: {
967
- readonly category: "background";
968
- readonly defaultOptions: {
969
- readonly model: "General Use (Light)";
970
- readonly operating_resolution: "1024x1024";
971
- readonly output_format: "png";
972
- readonly refine_foreground: true;
973
+ readonly "bria-eraser": {
974
+ readonly category: "erase";
975
+ readonly description: "Commercial-safe removal of a masked region, inpainted from surrounding context.";
976
+ readonly endpoint: "fal-ai/bria/eraser";
977
+ readonly inputField: "image_url";
978
+ readonly inputKind: "image";
979
+ readonly name: "Bria Eraser";
980
+ readonly outputKeys: ["image"];
981
+ readonly price: {
982
+ readonly kind: "call";
983
+ readonly usd: 0.04;
984
+ };
985
+ readonly pricing: "$0.04/generation";
986
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/eraser";
987
+ readonly task: "masked object erasure";
973
988
  };
974
- readonly description: "High-resolution dichotomous image segmentation and background removal.";
989
+ readonly "bria-expand": {
990
+ readonly category: "reframe";
991
+ readonly description: "Expand an image onto a larger canvas, generating the new border area.";
992
+ readonly endpoint: "fal-ai/bria/expand";
993
+ readonly inputField: "image_url";
994
+ readonly inputKind: "image";
995
+ readonly name: "Bria Image Expansion";
996
+ readonly outputKeys: ["image"];
997
+ readonly price: {
998
+ readonly kind: "call";
999
+ readonly usd: 0.04;
1000
+ };
1001
+ readonly pricing: "$0.04/generation";
1002
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/expand";
1003
+ readonly task: "image outpainting";
1004
+ };
1005
+ readonly "bria-genfill": {
1006
+ readonly category: "erase";
1007
+ readonly description: "Generative fill of a masked region from a prompt, commercial-safe.";
1008
+ readonly endpoint: "fal-ai/bria/genfill";
1009
+ readonly inputField: "image_url";
1010
+ readonly inputKind: "image";
1011
+ readonly name: "Bria GenFill";
1012
+ readonly outputKeys: ["images"];
1013
+ readonly price: {
1014
+ readonly kind: "call";
1015
+ readonly usd: 0.04;
1016
+ };
1017
+ readonly pricing: "$0.04/generation";
1018
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/genfill";
1019
+ readonly task: "masked generative fill";
1020
+ };
1021
+ readonly "finegrain-eraser": {
1022
+ readonly category: "erase";
1023
+ readonly description: "Remove a prompted object and its shadows and reflections, filling the gap.";
1024
+ readonly endpoint: "fal-ai/finegrain-eraser";
1025
+ readonly inputField: "image_url";
1026
+ readonly inputKind: "image";
1027
+ readonly name: "Finegrain Object Eraser";
1028
+ readonly outputKeys: ["image"];
1029
+ readonly price: {
1030
+ readonly kind: "call";
1031
+ readonly usd: 0.27;
1032
+ };
1033
+ readonly pricing: "$0.27/image at the default standard mode; $0.18 express, $0.36 premium";
1034
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/finegrain-eraser";
1035
+ readonly task: "prompted object erasure";
1036
+ };
1037
+ readonly "flux-outpaint": {
1038
+ readonly category: "reframe";
1039
+ readonly description: "Outpaint an image by a per-edge pixel expansion with FLUX.2 pro.";
1040
+ readonly endpoint: "fal-ai/flux-2-pro/outpaint";
1041
+ readonly inputField: "image_url";
1042
+ readonly inputKind: "image";
1043
+ readonly name: "FLUX.2 Pro Outpaint";
1044
+ readonly outputKeys: ["images"];
1045
+ readonly price: {
1046
+ readonly kind: "metered";
1047
+ };
1048
+ readonly pricing: "$0.03 for the first output megapixel, then $0.015 per extra megapixel of input and output, rounded up";
1049
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/flux-2-pro/outpaint";
1050
+ readonly task: "image outpainting";
1051
+ };
1052
+ readonly "iclight-v2": {
1053
+ readonly category: "relight";
1054
+ readonly description: "Relight a subject from a prompt, harmonising it with a new light direction.";
1055
+ readonly endpoint: "fal-ai/iclight-v2";
1056
+ readonly inputField: "image_url";
1057
+ readonly inputKind: "image";
1058
+ readonly name: "IC-Light v2";
1059
+ readonly outputKeys: ["images"];
1060
+ readonly price: {
1061
+ readonly kind: "megapixel";
1062
+ readonly usd: 0.1;
1063
+ };
1064
+ readonly pricing: "$0.10/megapixel";
1065
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/iclight-v2";
1066
+ readonly task: "prompted relighting";
1067
+ };
1068
+ readonly "ideogram-reframe": {
1069
+ readonly category: "reframe";
1070
+ readonly description: "Reframe an image to a new aspect ratio, generating the fill.";
1071
+ readonly endpoint: "fal-ai/ideogram/v3/reframe";
1072
+ readonly inputField: "image_url";
1073
+ readonly inputKind: "image";
1074
+ readonly name: "Ideogram v3 Reframe";
1075
+ readonly outputKeys: ["images"];
1076
+ readonly price: {
1077
+ readonly kind: "call";
1078
+ readonly usd: 0.06;
1079
+ };
1080
+ readonly pricing: "$0.06/image at the default BALANCED speed; $0.03 turbo, $0.09 quality";
1081
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/reframe";
1082
+ readonly task: "aspect ratio reframing";
1083
+ };
1084
+ readonly "lighting-restoration": {
1085
+ readonly category: "relight";
1086
+ readonly description: "Restore natural, even lighting across one or more input images.";
1087
+ readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
1088
+ readonly inputField: "image_urls";
1089
+ readonly inputKind: "images";
1090
+ readonly name: "Qwen Lighting Restoration";
1091
+ readonly outputKeys: ["images"];
1092
+ readonly price: {
1093
+ readonly kind: "megapixel";
1094
+ readonly usd: 0.035;
1095
+ };
1096
+ readonly pricing: "$0.035/megapixel";
1097
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
1098
+ readonly task: "lighting restoration";
1099
+ };
1100
+ readonly "object-removal": {
1101
+ readonly category: "erase";
1102
+ readonly description: "Remove a prompted object from an image and fill the gap.";
1103
+ readonly endpoint: "fal-ai/object-removal";
1104
+ readonly inputField: "image_url";
1105
+ readonly inputKind: "image";
1106
+ readonly name: "Object Removal";
1107
+ readonly outputKeys: ["images"];
1108
+ readonly price: {
1109
+ readonly kind: "call";
1110
+ readonly usd: 0.024;
1111
+ };
1112
+ readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
1113
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal";
1114
+ readonly task: "prompted object removal";
1115
+ };
1116
+ readonly "object-removal-bbox": {
1117
+ readonly category: "erase";
1118
+ readonly description: "Remove whatever falls inside supplied bounding boxes.";
1119
+ readonly endpoint: "fal-ai/object-removal/bbox";
1120
+ readonly inputField: "image_url";
1121
+ readonly inputKind: "image";
1122
+ readonly name: "Object Removal by Box";
1123
+ readonly outputKeys: ["images"];
1124
+ readonly price: {
1125
+ readonly kind: "call";
1126
+ readonly usd: 0.024;
1127
+ };
1128
+ readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
1129
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/bbox";
1130
+ readonly task: "bounding box object removal";
1131
+ };
1132
+ readonly "object-removal-mask": {
1133
+ readonly category: "erase";
1134
+ readonly description: "Remove the masked region of an image and fill the gap.";
1135
+ readonly endpoint: "fal-ai/object-removal/mask";
1136
+ readonly inputField: "image_url";
1137
+ readonly inputKind: "image";
1138
+ readonly name: "Object Removal by Mask";
1139
+ readonly outputKeys: ["images"];
1140
+ readonly price: {
1141
+ readonly kind: "call";
1142
+ readonly usd: 0.024;
1143
+ };
1144
+ readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
1145
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/mask";
1146
+ readonly task: "masked object removal";
1147
+ };
1148
+ readonly "remove-lighting": {
1149
+ readonly category: "relight";
1150
+ readonly description: "Strip baked-in lighting and shadows to leave a flat, neutral surface.";
1151
+ readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
1152
+ readonly inputField: "image_urls";
1153
+ readonly inputKind: "images";
1154
+ readonly name: "Qwen Remove Lighting";
1155
+ readonly outputKeys: ["images"];
1156
+ readonly price: {
1157
+ readonly kind: "megapixel";
1158
+ readonly usd: 0.035;
1159
+ };
1160
+ readonly pricing: "$0.035/megapixel";
1161
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
1162
+ readonly task: "lighting removal";
1163
+ };
1164
+ readonly "smart-resize": {
1165
+ readonly category: "reframe";
1166
+ readonly description: "Resize one image to several target sizes, recomposing rather than cropping.";
1167
+ readonly endpoint: "fal-ai/smart-resize";
1168
+ readonly inputField: "image_url";
1169
+ readonly inputKind: "image";
1170
+ readonly name: "Smart Resize";
1171
+ readonly outputKeys: ["images", "results"];
1172
+ readonly price: {
1173
+ readonly kind: "metered";
1174
+ };
1175
+ readonly pricing: "$0.15 per output image, doubled at 4K, plus a $0.05 vision analysis fee per request";
1176
+ readonly queued: true;
1177
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/smart-resize";
1178
+ readonly task: "multi-size recomposition";
1179
+ };
1180
+ readonly "text-removal": {
1181
+ readonly category: "erase";
1182
+ readonly defaultOptions: {
1183
+ readonly output_format: "png";
1184
+ };
1185
+ readonly description: "Remove all rendered text from an image, rebuilding what sat behind it.";
1186
+ readonly endpoint: "fal-ai/image-editing/text-removal";
1187
+ readonly inputField: "image_url";
1188
+ readonly inputKind: "image";
1189
+ readonly name: "Text Removal";
1190
+ readonly outputKeys: ["images"];
1191
+ readonly price: {
1192
+ readonly kind: "call";
1193
+ readonly usd: 0.04;
1194
+ };
1195
+ readonly pricing: "$0.04/image";
1196
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-editing/text-removal";
1197
+ readonly task: "text removal";
1198
+ };
1199
+ readonly "ben-v2": {
1200
+ readonly category: "background";
1201
+ readonly description: "Fast, high-quality background removal for images.";
1202
+ readonly endpoint: "fal-ai/ben/v2/image";
1203
+ readonly inputField: "image_url";
1204
+ readonly inputKind: "image";
1205
+ readonly name: "BEN v2 Background Removal";
1206
+ readonly outputKeys: ["image"];
1207
+ readonly price: {
1208
+ readonly kind: "megapixel";
1209
+ readonly usd: 0.025;
1210
+ };
1211
+ readonly pricing: "$0.025/megapixel";
1212
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ben/v2/image";
1213
+ readonly task: "image background removal";
1214
+ };
1215
+ readonly birefnet: {
1216
+ readonly category: "background";
1217
+ readonly defaultOptions: {
1218
+ readonly model: "General Use (Light)";
1219
+ readonly operating_resolution: "1024x1024";
1220
+ readonly output_format: "png";
1221
+ readonly refine_foreground: true;
1222
+ };
1223
+ readonly description: "High-resolution dichotomous image segmentation and background removal.";
1224
+ readonly endpoint: "fal-ai/birefnet/v2";
1225
+ readonly inputField: "image_url";
1226
+ readonly inputKind: "image";
1227
+ readonly name: "BirefNet Background Removal";
1228
+ readonly outputKeys: ["image", "mask_image"];
1229
+ readonly price: {
1230
+ readonly kind: "metered";
1231
+ };
1232
+ readonly pricing: "$0/compute-second listed by fal";
1233
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/birefnet/v2";
1234
+ readonly task: "image background removal";
1235
+ };
1236
+ readonly "bria-rmbg": {
1237
+ readonly category: "background";
1238
+ readonly description: "Commercial-safe background removal for images.";
1239
+ readonly endpoint: "fal-ai/bria/background/remove";
1240
+ readonly inputField: "image_url";
1241
+ readonly inputKind: "image";
1242
+ readonly name: "Bria RMBG 2.0";
1243
+ readonly outputKeys: ["image"];
1244
+ readonly price: {
1245
+ readonly kind: "call";
1246
+ readonly usd: 0.018;
1247
+ };
1248
+ readonly pricing: "$0.018/generation";
1249
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/background/remove";
1250
+ readonly task: "image background removal";
1251
+ };
1252
+ readonly "bria-video-rmbg": {
1253
+ readonly category: "background";
1254
+ readonly defaultOptions: {
1255
+ readonly background_color: "Black";
1256
+ readonly output_container_and_codec: "webm_vp9";
1257
+ readonly preserve_audio: true;
1258
+ };
1259
+ readonly description: "Remove video backgrounds with configurable output container.";
1260
+ readonly endpoint: "bria/video/background-removal";
1261
+ readonly inputField: "video_url";
1262
+ readonly inputKind: "video";
1263
+ readonly name: "Bria Video Background Removal";
1264
+ readonly outputKeys: ["video"];
1265
+ readonly price: {
1266
+ readonly kind: "second";
1267
+ readonly usd: 0.00425;
1268
+ };
1269
+ readonly pricing: "$0.00425/sec";
1270
+ readonly queued: true;
1271
+ readonly sourceUrl: "https://fal.ai/models/bria/video/background-removal";
1272
+ readonly task: "video background removal";
1273
+ };
1274
+ readonly ddcolor: {
1275
+ readonly category: "restoration";
1276
+ readonly description: "Colourise black-and-white photographs.";
1277
+ readonly endpoint: "fal-ai/ddcolor";
1278
+ readonly inputField: "image_url";
1279
+ readonly inputKind: "image";
1280
+ readonly name: "DDColor Colourisation";
1281
+ readonly outputKeys: ["image"];
1282
+ readonly price: {
1283
+ readonly kind: "megapixel";
1284
+ readonly usd: 0.001;
1285
+ };
1286
+ readonly pricing: "$0.001/megapixel";
1287
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ddcolor";
1288
+ readonly task: "photo colourisation";
1289
+ };
1290
+ readonly rembg: {
1291
+ readonly category: "background";
1292
+ readonly defaultOptions: {
1293
+ readonly crop_to_bbox: false;
1294
+ };
1295
+ readonly description: "Generic image background removal utility.";
1296
+ readonly endpoint: "fal-ai/imageutils/rembg";
1297
+ readonly inputField: "image_url";
1298
+ readonly inputKind: "image";
1299
+ readonly name: "Remove Background";
1300
+ readonly outputKeys: ["image"];
1301
+ readonly price: {
1302
+ readonly kind: "metered";
1303
+ };
1304
+ readonly pricing: "$0/compute-second listed by fal";
1305
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/rembg";
1306
+ readonly task: "image background removal";
1307
+ };
1308
+ readonly "seedvr-upscale": {
1309
+ readonly category: "restoration";
1310
+ readonly defaultOptions: {
1311
+ readonly output_format: "png";
1312
+ };
1313
+ readonly description: "Diffusion image restoration and upscaling with SeedVR.";
1314
+ readonly endpoint: "fal-ai/seedvr/upscale/image";
1315
+ readonly inputField: "image_url";
1316
+ readonly inputKind: "image";
1317
+ readonly name: "SeedVR Image Upscale";
1318
+ readonly outputKeys: ["image"];
1319
+ readonly price: {
1320
+ readonly kind: "megapixel";
1321
+ readonly usd: 0.001;
1322
+ };
1323
+ readonly pricing: "$0.001/megapixel";
1324
+ readonly queued: true;
1325
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image";
1326
+ readonly task: "image restoration and upscaling";
1327
+ };
1328
+ readonly "topaz-adjust": {
1329
+ readonly category: "restoration";
1330
+ readonly defaultOptions: {
1331
+ readonly output_format: "png";
1332
+ };
1333
+ readonly description: "Topaz exposure, white balance, and colour adjustment.";
1334
+ readonly endpoint: "topaz/adjust/image";
1335
+ readonly inputField: "image_url";
1336
+ readonly inputKind: "image";
1337
+ readonly name: "Topaz Adjust";
1338
+ readonly outputKeys: ["image"];
1339
+ readonly price: {
1340
+ readonly kind: "megapixel";
1341
+ readonly usd: number;
1342
+ };
1343
+ readonly pricing: "$0.08 per 24 output megapixels";
1344
+ readonly queued: true;
1345
+ readonly sourceUrl: "https://fal.ai/models/topaz/adjust/image";
1346
+ readonly task: "tonal adjustment";
1347
+ };
1348
+ readonly "topaz-creative": {
1349
+ readonly category: "restoration";
1350
+ readonly defaultOptions: {
1351
+ readonly output_format: "png";
1352
+ };
1353
+ readonly description: "Topaz Bloom upscaling, which reimagines detail rather than preserving it.";
1354
+ readonly endpoint: "topaz/upscale/image/creative";
1355
+ readonly inputField: "image_url";
1356
+ readonly inputKind: "image";
1357
+ readonly name: "Topaz Creative Upscale";
1358
+ readonly outputKeys: ["image"];
1359
+ readonly price: {
1360
+ readonly kind: "megapixel";
1361
+ readonly usd: number;
1362
+ };
1363
+ readonly pricing: "$0.96 per 24 output megapixels";
1364
+ readonly queued: true;
1365
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/creative";
1366
+ readonly task: "creative image upscaling";
1367
+ };
1368
+ readonly "topaz-denoise": {
1369
+ readonly category: "restoration";
1370
+ readonly defaultOptions: {
1371
+ readonly output_format: "png";
1372
+ };
1373
+ readonly description: "Topaz noise reduction at source resolution.";
1374
+ readonly endpoint: "topaz/denoise/image";
1375
+ readonly inputField: "image_url";
1376
+ readonly inputKind: "image";
1377
+ readonly name: "Topaz Denoise";
1378
+ readonly outputKeys: ["image"];
1379
+ readonly price: {
1380
+ readonly kind: "megapixel";
1381
+ readonly usd: number;
1382
+ };
1383
+ readonly pricing: "$0.08 per 24 output megapixels at the default Normal model; $0.16 with Denoise Max";
1384
+ readonly queued: true;
1385
+ readonly sourceUrl: "https://fal.ai/models/topaz/denoise/image";
1386
+ readonly task: "image denoising";
1387
+ };
1388
+ readonly "topaz-generative": {
1389
+ readonly category: "restoration";
1390
+ readonly defaultOptions: {
1391
+ readonly output_format: "png";
1392
+ };
1393
+ readonly description: "Topaz Wonder upscaling, which synthesises plausible detail as it enlarges.";
1394
+ readonly endpoint: "topaz/upscale/image/generative";
1395
+ readonly inputField: "image_url";
1396
+ readonly inputKind: "image";
1397
+ readonly name: "Topaz Generative Upscale";
1398
+ readonly outputKeys: ["image"];
1399
+ readonly price: {
1400
+ readonly kind: "megapixel";
1401
+ readonly usd: number;
1402
+ };
1403
+ readonly pricing: "$0.24 per 24 output megapixels at the default Wonder 3; $0.48 with Wonder, Wonder 2, Standard MAX, Redefine or Recover 3";
1404
+ readonly queued: true;
1405
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/generative";
1406
+ readonly task: "generative image upscaling";
1407
+ };
1408
+ readonly "topaz-image": {
1409
+ readonly category: "upscale";
1410
+ readonly defaultOptions: {
1411
+ readonly model: "Standard V2";
1412
+ readonly output_format: "jpeg";
1413
+ readonly upscale_factor: 2;
1414
+ };
1415
+ readonly description: "Professional Topaz image enhancement and upscaling.";
1416
+ readonly endpoint: "fal-ai/topaz/upscale/image";
1417
+ readonly inputField: "image_url";
1418
+ readonly inputKind: "image";
1419
+ readonly name: "Topaz Image Upscale";
1420
+ readonly outputKeys: ["image"];
1421
+ readonly price: {
1422
+ readonly kind: "megapixel";
1423
+ readonly usd: number;
1424
+ };
1425
+ readonly pricing: "$0.08 for output up to 24MP; $0.16 to 48MP, $0.32 to 96MP, up to $1.36 at 512MP";
1426
+ readonly queued: true;
1427
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image";
1428
+ readonly task: "image enhancement";
1429
+ };
1430
+ readonly "topaz-precision": {
1431
+ readonly category: "restoration";
1432
+ readonly defaultOptions: {
1433
+ readonly output_format: "png";
1434
+ };
1435
+ readonly description: "Topaz upscaling that preserves the original detail rather than inventing it.";
1436
+ readonly endpoint: "topaz/upscale/image/precision";
1437
+ readonly inputField: "image_url";
1438
+ readonly inputKind: "image";
1439
+ readonly name: "Topaz Precision Upscale";
1440
+ readonly outputKeys: ["image"];
1441
+ readonly price: {
1442
+ readonly kind: "megapixel";
1443
+ readonly usd: number;
1444
+ };
1445
+ readonly pricing: "$0.08 per 24 output megapixels, any precision model";
1446
+ readonly queued: true;
1447
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/precision";
1448
+ readonly task: "faithful image upscaling";
1449
+ };
1450
+ readonly "topaz-restore": {
1451
+ readonly category: "restoration";
1452
+ readonly defaultOptions: {
1453
+ readonly output_format: "png";
1454
+ };
1455
+ readonly description: "Topaz restoration of damaged or degraded photographs at source resolution.";
1456
+ readonly endpoint: "topaz/restore/image";
1457
+ readonly inputField: "image_url";
1458
+ readonly inputKind: "image";
1459
+ readonly name: "Topaz Restore";
1460
+ readonly outputKeys: ["image"];
1461
+ readonly price: {
1462
+ readonly kind: "megapixel";
1463
+ readonly usd: number;
1464
+ };
1465
+ readonly pricing: "$0.48 per 24 output megapixels at the default Recover 3; $0.08 with Dust-Scratch V2";
1466
+ readonly queued: true;
1467
+ readonly sourceUrl: "https://fal.ai/models/topaz/restore/image";
1468
+ readonly task: "photo restoration";
1469
+ };
1470
+ readonly "topaz-sharpen": {
1471
+ readonly category: "restoration";
1472
+ readonly defaultOptions: {
1473
+ readonly output_format: "png";
1474
+ };
1475
+ readonly description: "Topaz deblurring and sharpening at source resolution.";
1476
+ readonly endpoint: "topaz/sharpen/image";
1477
+ readonly inputField: "image_url";
1478
+ readonly inputKind: "image";
1479
+ readonly name: "Topaz Sharpen";
1480
+ readonly outputKeys: ["image"];
1481
+ readonly price: {
1482
+ readonly kind: "megapixel";
1483
+ readonly usd: number;
1484
+ };
1485
+ readonly pricing: "$0.08 per 24 output megapixels at the default Standard model; $0.16 with Super Focus";
1486
+ readonly queued: true;
1487
+ readonly sourceUrl: "https://fal.ai/models/topaz/sharpen/image";
1488
+ readonly task: "image sharpening";
1489
+ };
1490
+ readonly "topaz-transparent": {
1491
+ readonly category: "restoration";
1492
+ readonly description: "Topaz upscaling that preserves the alpha channel end to end.";
1493
+ readonly endpoint: "topaz/upscale/image/transparent";
1494
+ readonly inputField: "image_url";
1495
+ readonly inputKind: "image";
1496
+ readonly name: "Topaz Transparent Upscale";
1497
+ readonly outputKeys: ["image"];
1498
+ readonly price: {
1499
+ readonly kind: "megapixel";
1500
+ readonly usd: number;
1501
+ };
1502
+ readonly pricing: "$0.08 per 24 output megapixels";
1503
+ readonly queued: true;
1504
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/transparent";
1505
+ readonly task: "transparent image upscaling";
1506
+ };
1507
+ readonly "topaz-video": {
1508
+ readonly category: "upscale";
1509
+ readonly defaultOptions: {
1510
+ readonly model: "Proteus";
1511
+ readonly upscale_factor: 2;
1512
+ };
1513
+ readonly description: "Professional Topaz video enhancement and upscaling.";
1514
+ readonly endpoint: "fal-ai/topaz/upscale/video";
1515
+ readonly inputField: "video_url";
1516
+ readonly inputKind: "video";
1517
+ readonly name: "Topaz Video Upscale";
1518
+ readonly outputKeys: ["video"];
1519
+ readonly price: {
1520
+ readonly kind: "second";
1521
+ readonly usd: 0.01;
1522
+ };
1523
+ readonly pricing: "$0.01/sec up to 720p; $0.02 to 1080p, $0.08 above, doubled at 60fps, halved with Gaia 2";
1524
+ readonly queued: true;
1525
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video";
1526
+ readonly task: "video enhancement";
1527
+ };
1528
+ readonly "hunyuan3d-v3": {
1529
+ readonly category: "3d";
1530
+ readonly description: "Reconstruct a textured 3D mesh from a single image, with optional multi-view inputs.";
1531
+ readonly endpoint: "fal-ai/hunyuan3d-v3/image-to-3d";
1532
+ readonly inputField: "input_image_url";
1533
+ readonly inputKind: "image";
1534
+ readonly name: "Hunyuan3D v3 Image to 3D";
1535
+ readonly outputKeys: ["model_glb", "model_urls", "thumbnail"];
1536
+ readonly price: {
1537
+ readonly kind: "call";
1538
+ readonly usd: 0.375;
1539
+ };
1540
+ readonly pricing: "$0.375/generation at the default Normal type; $0.45 low poly, $0.225 geometry only, and $0.15 each for PBR, multi-view, or a custom face count";
1541
+ readonly queued: true;
1542
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/hunyuan3d-v3/image-to-3d";
1543
+ readonly task: "single-image 3D reconstruction";
1544
+ };
1545
+ readonly "ideogram-layerize-text": {
1546
+ readonly category: "layers";
1547
+ readonly description: "Split an image into background image layers plus editable HTML text containers.";
1548
+ readonly endpoint: "fal-ai/ideogram/v3/layerize-text";
1549
+ readonly inputField: "image_url";
1550
+ readonly inputKind: "image";
1551
+ readonly name: "Ideogram v3 Text Layerize";
1552
+ readonly outputKeys: ["image_layers", "image", "text_html", "text_containers"];
1553
+ readonly price: {
1554
+ readonly kind: "call";
1555
+ readonly usd: 0.09;
1556
+ };
1557
+ readonly pricing: "$0.09/image";
1558
+ readonly queued: true;
1559
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/layerize-text";
1560
+ readonly task: "text and image layer extraction";
1561
+ };
1562
+ readonly "ideogram-tiling": {
1563
+ readonly category: "material";
1564
+ readonly description: "Generate a seamlessly tiling texture, optionally conditioned on a source image.";
1565
+ readonly endpoint: "ideogram/v4/tiling";
1566
+ readonly inputField: "image_url";
1567
+ readonly inputKind: "image";
1568
+ readonly name: "Ideogram v4 Tiling";
1569
+ readonly outputKeys: ["images"];
1570
+ readonly price: {
1571
+ readonly kind: "megapixel";
1572
+ readonly usd: 0.06;
1573
+ };
1574
+ readonly pricing: "$0.06/megapixel at the default BALANCED speed; $0.03 turbo, $0.10 quality";
1575
+ readonly sourceUrl: "https://fal.ai/models/ideogram/v4/tiling";
1576
+ readonly task: "seamless texture generation";
1577
+ };
1578
+ readonly image2svg: {
1579
+ readonly category: "vector";
1580
+ readonly description: "Trace a raster image into layered SVG paths.";
1581
+ readonly endpoint: "fal-ai/image2svg";
1582
+ readonly inputField: "image_url";
1583
+ readonly inputKind: "image";
1584
+ readonly name: "Image to SVG";
1585
+ readonly outputKeys: ["images"];
1586
+ readonly price: {
1587
+ readonly kind: "call";
1588
+ readonly usd: 0.005;
1589
+ };
1590
+ readonly pricing: "$0.005/image";
1591
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image2svg";
1592
+ readonly task: "raster to vector tracing";
1593
+ };
1594
+ readonly patina: {
1595
+ readonly category: "material";
1596
+ readonly description: "Decompose a surface photograph into PBR maps: basecolor, normal, roughness, metalness, height.";
1597
+ readonly endpoint: "fal-ai/patina";
1598
+ readonly inputField: "image_url";
1599
+ readonly inputKind: "image";
1600
+ readonly name: "Patina PBR Maps";
1601
+ readonly outputKeys: ["images"];
1602
+ readonly outputLabels: {
1603
+ readonly images: {
1604
+ readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
1605
+ readonly fromOption: "maps";
1606
+ };
1607
+ };
1608
+ readonly price: {
1609
+ readonly kind: "metered";
1610
+ };
1611
+ readonly pricing: "$0.01 base plus $0.01/megapixel per output map, so all 5 maps on a 1MP image cost $0.06; the listed rate is per map";
1612
+ readonly queued: true;
1613
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/patina";
1614
+ readonly task: "PBR material decomposition";
1615
+ };
1616
+ readonly "patina-extract": {
1617
+ readonly category: "material";
1618
+ readonly description: "Extract a tiling PBR material from a prompted region of a photograph.";
1619
+ readonly endpoint: "fal-ai/patina/material/extract";
1620
+ readonly inputField: "image_url";
1621
+ readonly inputKind: "image";
1622
+ readonly name: "Patina Material Extract";
1623
+ readonly outputKeys: ["images"];
1624
+ readonly outputLabels: {
1625
+ readonly images: {
1626
+ readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
1627
+ readonly fromOption: "maps";
1628
+ };
1629
+ };
1630
+ readonly price: {
1631
+ readonly kind: "metered";
1632
+ };
1633
+ readonly pricing: "$0.10 base only; add $0.02/megapixel plus $0.01/megapixel per map, so 1MP with all 5 maps is $0.17";
1634
+ readonly queued: true;
1635
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/patina/material/extract";
1636
+ readonly task: "tiling material extraction";
1637
+ };
1638
+ readonly "qwen-layered": {
1639
+ readonly category: "layers";
1640
+ readonly description: "Split an image into a configurable number of stacked RGBA layers.";
1641
+ readonly endpoint: "fal-ai/qwen-image-layered";
1642
+ readonly inputField: "image_url";
1643
+ readonly inputKind: "image";
1644
+ readonly name: "Qwen Image Layered";
1645
+ readonly outputKeys: ["images"];
1646
+ readonly price: {
1647
+ readonly kind: "metered";
1648
+ };
1649
+ readonly pricing: "$0.05 per image; fal does not say whether that counts the input image or each of the generated layers, so no estimate is reported";
1650
+ readonly queued: true;
1651
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-layered";
1652
+ readonly task: "image layer decomposition";
1653
+ };
1654
+ readonly "recraft-vectorize": {
1655
+ readonly category: "vector";
1656
+ readonly description: "Convert a raster image into a clean SVG.";
1657
+ readonly endpoint: "fal-ai/recraft/vectorize";
1658
+ readonly inputField: "image_url";
1659
+ readonly inputKind: "image";
1660
+ readonly name: "Recraft Vectorize";
1661
+ readonly outputKeys: ["image"];
1662
+ readonly price: {
1663
+ readonly kind: "call";
1664
+ readonly usd: 0.04;
1665
+ };
1666
+ readonly pricing: "$0.04/image, $0.08 with a vector style";
1667
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/recraft/vectorize";
1668
+ readonly task: "raster to vector conversion";
1669
+ };
1670
+ readonly "sam3-3d-align": {
1671
+ readonly category: "3d";
1672
+ readonly description: "Align SAM 3D objects and bodies into a shared scene.";
1673
+ readonly endpoint: "fal-ai/sam-3/3d-align";
1674
+ readonly inputField: "image_url";
1675
+ readonly inputKind: "image";
1676
+ readonly name: "SAM 3D Align";
1677
+ readonly outputKeys: ["scene_glb", "model_glb", "visualization", "body_mesh_ply", "metadata"];
1678
+ readonly price: {
1679
+ readonly kind: "metered";
1680
+ };
1681
+ readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
1682
+ readonly queued: true;
1683
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-align";
1684
+ readonly task: "3D scene alignment";
1685
+ };
1686
+ readonly "sam3-3d-body": {
1687
+ readonly category: "3d";
1688
+ readonly defaultOptions: {
1689
+ readonly export_meshes: true;
1690
+ readonly include_3d_keypoints: true;
1691
+ readonly include_mhr_params: true;
1692
+ };
1693
+ readonly description: "Reconstruct human body meshes and keypoints from a single image.";
1694
+ readonly endpoint: "fal-ai/sam-3/3d-body";
1695
+ readonly inputField: "image_url";
1696
+ readonly inputKind: "image";
1697
+ readonly name: "SAM 3D Body";
1698
+ readonly outputKeys: ["model_glb", "visualization", "meshes", "metadata"];
1699
+ readonly price: {
1700
+ readonly kind: "metered";
1701
+ };
1702
+ readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
1703
+ readonly queued: true;
1704
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-body";
1705
+ readonly task: "single-image 3D body reconstruction";
1706
+ };
1707
+ readonly "sam3-3d-objects": {
1708
+ readonly category: "3d";
1709
+ readonly defaultOptions: {
1710
+ readonly prompt: "car";
1711
+ };
1712
+ readonly description: "Reconstruct one or more 3D objects from an image and prompts.";
1713
+ readonly endpoint: "fal-ai/sam-3/3d-objects";
1714
+ readonly inputField: "image_url";
1715
+ readonly inputKind: "image";
1716
+ readonly name: "SAM 3D Objects";
1717
+ readonly outputKeys: ["gaussian_splat", "model_glb", "metadata", "individual_splats", "individual_glbs", "artifacts_zip"];
1718
+ readonly price: {
1719
+ readonly kind: "metered";
1720
+ };
1721
+ readonly pricing: "$0.02 per unit; fal does not define a unit, and this endpoint returns one mesh per detected object, so no estimate is reported";
1722
+ readonly queued: true;
1723
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-objects";
1724
+ readonly task: "single-image 3D object reconstruction";
1725
+ };
1726
+ readonly "seedream-layerize": {
1727
+ readonly category: "layers";
1728
+ readonly description: "Split an image into editable Seedream layers plus flattened previews.";
1729
+ readonly endpoint: "bytedance/seedream/v5/pro/layerize";
1730
+ readonly inputField: "image_url";
1731
+ readonly inputKind: "image";
1732
+ readonly name: "Seedream v5 Pro Layerize";
1733
+ readonly outputKeys: ["layers", "images"];
1734
+ readonly outputLabels: {
1735
+ readonly layers: {
1736
+ readonly fromItem: {
1737
+ readonly nameField: "name";
1738
+ readonly orderField: "z_index";
1739
+ };
1740
+ };
1741
+ };
1742
+ readonly price: {
1743
+ readonly kind: "metered";
1744
+ };
1745
+ readonly pricing: "$0.03375 per generated layer below 1536x1536 total area, $0.0675 per layer above; the listed rate is per layer, not per call";
1746
+ readonly queued: true;
1747
+ readonly sourceUrl: "https://fal.ai/models/bytedance/seedream/v5/pro/layerize";
1748
+ readonly task: "image layer decomposition";
1749
+ };
1750
+ readonly "seedvr-seamless": {
1751
+ readonly category: "material";
1752
+ readonly description: "Upscale a tiling texture while keeping its edges seamless. ";
1753
+ readonly endpoint: "fal-ai/seedvr/upscale/image/seamless";
1754
+ readonly inputField: "image_url";
1755
+ readonly inputKind: "image";
1756
+ readonly name: "SeedVR Seamless Upscale";
1757
+ readonly outputKeys: ["image"];
1758
+ readonly price: {
1759
+ readonly kind: "megapixel";
1760
+ readonly usd: 0.0025;
1761
+ };
1762
+ readonly pricing: "$0.0025/megapixel";
1763
+ readonly queued: true;
1764
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image/seamless";
1765
+ readonly task: "seamless texture upscaling";
1766
+ };
1767
+ readonly "trellis-2": {
1768
+ readonly category: "3d";
1769
+ readonly description: "Reconstruct a textured 3D mesh from a single image, with UV unwrapping.";
1770
+ readonly endpoint: "fal-ai/trellis-2";
1771
+ readonly inputField: "image_url";
1772
+ readonly inputKind: "image";
1773
+ readonly name: "TRELLIS 2";
1774
+ readonly outputKeys: ["model_glb"];
1775
+ readonly price: {
1776
+ readonly kind: "call";
1777
+ readonly usd: 0.3;
1778
+ };
1779
+ readonly pricing: "$0.30 at the default 1024p; $0.25 at 512p, $0.35 at 1536p";
1780
+ readonly queued: true;
1781
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/trellis-2";
1782
+ readonly task: "single-image 3D reconstruction";
1783
+ };
1784
+ readonly "got-ocr": {
1785
+ readonly category: "analysis";
1786
+ readonly description: "Transcribe text from one or more images, optionally as formatted multi-page output.";
1787
+ readonly endpoint: "fal-ai/got-ocr/v2";
1788
+ readonly inputField: "input_image_urls";
1789
+ readonly inputKind: "images";
1790
+ readonly name: "GOT-OCR 2.0";
1791
+ readonly outputKeys: ["outputs"];
1792
+ readonly price: {
1793
+ readonly kind: "metered";
1794
+ };
1795
+ readonly pricing: "$0.05/image";
1796
+ readonly queued: true;
1797
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/got-ocr/v2";
1798
+ readonly task: "optical character recognition";
1799
+ };
1800
+ readonly "moondream-caption": {
1801
+ readonly category: "analysis";
1802
+ readonly description: "Write a short, normal, or long caption for an image.";
1803
+ readonly endpoint: "fal-ai/moondream3-preview/caption";
1804
+ readonly inputField: "image_url";
1805
+ readonly inputKind: "image";
1806
+ readonly name: "Moondream 3 Caption";
1807
+ readonly outputKeys: ["output"];
1808
+ readonly price: {
1809
+ readonly kind: "metered";
1810
+ };
1811
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
1812
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/caption";
1813
+ readonly task: "image captioning";
1814
+ };
1815
+ readonly "moondream-detect": {
1816
+ readonly category: "analysis";
1817
+ readonly description: "Detect prompted objects and return their bounding boxes, with an optional preview.";
1818
+ readonly endpoint: "fal-ai/moondream3-preview/detect";
1819
+ readonly inputField: "image_url";
1820
+ readonly inputKind: "image";
1821
+ readonly name: "Moondream 3 Detect";
1822
+ readonly outputKeys: ["objects", "image"];
1823
+ readonly price: {
1824
+ readonly kind: "metered";
1825
+ };
1826
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
1827
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/detect";
1828
+ readonly task: "object detection";
1829
+ };
1830
+ readonly "moondream-point": {
1831
+ readonly category: "analysis";
1832
+ readonly description: "Return point coordinates for every instance of a prompted subject.";
1833
+ readonly endpoint: "fal-ai/moondream3-preview/point";
1834
+ readonly inputField: "image_url";
1835
+ readonly inputKind: "image";
1836
+ readonly name: "Moondream 3 Point";
1837
+ readonly outputKeys: ["points", "image"];
1838
+ readonly price: {
1839
+ readonly kind: "metered";
1840
+ };
1841
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
1842
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/point";
1843
+ readonly task: "object pointing";
1844
+ };
1845
+ readonly "moondream-query": {
1846
+ readonly category: "analysis";
1847
+ readonly description: "Answer a free-form question about an image, with reasoning.";
1848
+ readonly endpoint: "fal-ai/moondream3-preview/query";
1849
+ readonly inputField: "image_url";
1850
+ readonly inputKind: "image";
1851
+ readonly name: "Moondream 3 Query";
1852
+ readonly outputKeys: ["output", "reasoning"];
1853
+ readonly price: {
1854
+ readonly kind: "metered";
1855
+ };
1856
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
1857
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/query";
1858
+ readonly task: "visual question answering";
1859
+ };
1860
+ readonly nsfw: {
1861
+ readonly category: "moderation";
1862
+ readonly description: "Predict whether one or more images contain NSFW concepts.";
1863
+ readonly endpoint: "fal-ai/x-ailab/nsfw";
1864
+ readonly inputField: "image_urls";
1865
+ readonly inputKind: "images";
1866
+ readonly name: "NSFW Checker";
1867
+ readonly outputKeys: ["has_nsfw_concepts"];
1868
+ readonly price: {
1869
+ readonly kind: "metered";
1870
+ };
1871
+ readonly pricing: "$0.001/image";
1872
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/x-ailab/nsfw";
1873
+ readonly task: "vision moderation";
1874
+ };
1875
+ };
1876
+ /**
1877
+ * The seam `server-tools.ts` runs against — the client's authenticated fetch
1878
+ * and its queue status parser, exposed without widening the public surface.
1879
+ */
1880
+ private get toolExecutor();
1881
+ /** ─── Private ─────────────────────────────────────────────── */
1882
+ /** Authenticated fetch to fal.ai APIs with retry logic. */
1883
+ private request;
1884
+ private ephemeralHeaders;
1885
+ /**
1886
+ * Normalize fal.ai responses.
1887
+ * Some APIs return `{ image: {...} }` instead of `{ images: [...] }`.
1888
+ */
1889
+ private normalizeResponse;
1890
+ }
1891
+
1892
+ type FalToolInputKind = "image" | "images" | "video";
1893
+ /**
1894
+ * Machine-readable cost, so `--dry-run` can emit a number rather than the
1895
+ * prose in `pricing`. Required on every entry: a missing price is what makes
1896
+ * an agent unable to budget across a registry spanning $0.001 to $0.48.
1897
+ */
1898
+ type FalToolPrice = {
1899
+ kind: "call";
1900
+ usd: number;
1901
+ } | {
1902
+ kind: "megapixel";
1903
+ usd: number;
1904
+ } | {
1905
+ kind: "second";
1906
+ usd: number;
1907
+ } | {
1908
+ kind: "metered";
1909
+ };
1910
+ interface FalToolConfig {
1911
+ category: "3d" | "analysis" | "background" | "depth" | "erase" | "layers" | "material" | "moderation" | "preprocess" | "reframe" | "relight" | "restoration" | "segmentation" | "upscale" | "vector";
1912
+ defaultOptions?: Record<string, unknown>;
1913
+ description: string;
1914
+ endpoint: string;
1915
+ inputField: "image_url" | "image_urls" | "input_image_url" | "input_image_urls" | "video_url";
1916
+ inputKind: FalToolInputKind;
1917
+ name: string;
1918
+ outputKeys: string[];
1919
+ /**
1920
+ * Names for the positions of an array-valued output. Used to name downloaded
1921
+ * files: without it a PBR set lands as images-2.png, images-3.png and the
1922
+ * caller cannot tell a roughness map from a normal map.
1923
+ *
1924
+ * Two rule shapes, because the names come from two different places.
1925
+ *
1926
+ * Request-driven: `fromOption` names the request option that actually
1927
+ * determines the order — read the resolved request body first and use its
1928
+ * value when present, since a caller may reorder or subset it. `fallback` is
1929
+ * the endpoint's schema default, used when the option is absent.
1930
+ *
1931
+ * Response-driven: `fromItem` reads the name off each element of the output
1932
+ * array itself, for endpoints that label what they produced (seedream's
1933
+ * layer stack names every layer). `nameField` holds the name and
1934
+ * `orderField`, when set, holds a non-negative integer that prefixes it so
1935
+ * the files sort in stack order. These strings come from a model, so the
1936
+ * consumer slugifies them into a filename and keeps positional naming when
1937
+ * nothing usable survives.
1938
+ *
1939
+ * Whichever is used, check the label count against the URL count before
1940
+ * applying it: a mislabelled map is worse than a positional one, because it
1941
+ * reads as authoritative.
1942
+ *
1943
+ * Only set this where the order or the naming is actually determined — by a
1944
+ * request option, by the schema, or by the response. Leave genuinely
1945
+ * unordered, unnamed arrays unlabelled.
1946
+ */
1947
+ outputLabels?: Record<string, {
1948
+ fallback: readonly string[];
1949
+ fromOption?: string;
1950
+ } | {
1951
+ fromItem: {
1952
+ nameField: string;
1953
+ orderField?: string;
1954
+ };
1955
+ }>;
1956
+ price: FalToolPrice;
1957
+ pricing: string;
1958
+ /**
1959
+ * Endpoint routinely exceeds the 120s sync timeout; callers should use the
1960
+ * queue path.
1961
+ */
1962
+ queued?: true;
1963
+ sourceUrl: string;
1964
+ task: string;
1965
+ }
1966
+ interface FalToolRunOptions {
1967
+ input?: string;
1968
+ inputs?: string[];
1969
+ options?: Record<string, unknown>;
1970
+ tool: string;
1971
+ }
1972
+ interface FalToolRequest {
1973
+ body: Record<string, unknown>;
1974
+ endpoint: string;
1975
+ tool: FalToolConfig;
1976
+ }
1977
+
1978
+ declare const FAL_TOOLS: {
1979
+ readonly "depth-anything": {
1980
+ readonly category: "preprocess";
1981
+ readonly description: "Generate Depth Anything v2 depth maps from input images.";
1982
+ readonly endpoint: "fal-ai/image-preprocessors/depth-anything/v2";
1983
+ readonly inputField: "image_url";
1984
+ readonly inputKind: "image";
1985
+ readonly name: "Depth Anything v2 Preprocessor";
1986
+ readonly outputKeys: ["image"];
1987
+ readonly price: {
1988
+ readonly kind: "metered";
1989
+ };
1990
+ readonly pricing: "$0/compute-second listed by fal";
1991
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/depth-anything/v2";
1992
+ readonly task: "depth preprocessing";
1993
+ };
1994
+ readonly dwpose: {
1995
+ readonly category: "preprocess";
1996
+ readonly description: "Extract body, hand, and face pose skeletons from an image.";
1997
+ readonly endpoint: "fal-ai/dwpose";
1998
+ readonly inputField: "image_url";
1999
+ readonly inputKind: "image";
2000
+ readonly name: "DWPose Estimation";
2001
+ readonly outputKeys: ["image"];
2002
+ readonly price: {
2003
+ readonly kind: "second";
2004
+ readonly usd: 0.0006;
2005
+ };
2006
+ readonly pricing: "$0.0006/compute-second";
2007
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/dwpose";
2008
+ readonly task: "pose preprocessing";
2009
+ };
2010
+ readonly hed: {
2011
+ readonly category: "preprocess";
2012
+ readonly description: "Generate HED soft edge maps for ControlNet-style workflows.";
2013
+ readonly endpoint: "fal-ai/image-preprocessors/hed";
2014
+ readonly inputField: "image_url";
2015
+ readonly inputKind: "image";
2016
+ readonly name: "HED Edge Preprocessor";
2017
+ readonly outputKeys: ["image"];
2018
+ readonly price: {
2019
+ readonly kind: "metered";
2020
+ };
2021
+ readonly pricing: "$0/compute-second listed by fal";
2022
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/hed";
2023
+ readonly task: "edge preprocessing";
2024
+ };
2025
+ readonly lineart: {
2026
+ readonly category: "preprocess";
2027
+ readonly defaultOptions: {
2028
+ readonly coarse: false;
2029
+ };
2030
+ readonly description: "Generate line art/control-style edges from an input image.";
2031
+ readonly endpoint: "fal-ai/image-preprocessors/lineart";
2032
+ readonly inputField: "image_url";
2033
+ readonly inputKind: "image";
2034
+ readonly name: "Line Art Preprocessor";
2035
+ readonly outputKeys: ["image"];
2036
+ readonly price: {
2037
+ readonly kind: "metered";
2038
+ };
2039
+ readonly pricing: "$0/compute-second listed by fal";
2040
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/lineart";
2041
+ readonly task: "image preprocessing";
2042
+ };
2043
+ readonly "marigold-depth": {
2044
+ readonly category: "depth";
2045
+ readonly defaultOptions: {
2046
+ readonly ensemble_size: 10;
2047
+ readonly num_inference_steps: 10;
2048
+ };
2049
+ readonly description: "Create depth maps using Marigold depth estimation.";
2050
+ readonly endpoint: "fal-ai/imageutils/marigold-depth";
2051
+ readonly inputField: "image_url";
2052
+ readonly inputKind: "image";
2053
+ readonly name: "Marigold Depth Estimation";
2054
+ readonly outputKeys: ["image"];
2055
+ readonly price: {
2056
+ readonly kind: "metered";
2057
+ };
2058
+ readonly pricing: "$0/compute-second listed by fal";
2059
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/marigold-depth";
2060
+ readonly task: "depth map";
2061
+ };
2062
+ readonly "midas-depth": {
2063
+ readonly category: "depth";
2064
+ readonly defaultOptions: {
2065
+ readonly a: number;
2066
+ readonly bg_th: 0.1;
2067
+ };
2068
+ readonly description: "Create MiDaS depth maps from input images.";
2069
+ readonly endpoint: "fal-ai/imageutils/depth";
2070
+ readonly inputField: "image_url";
2071
+ readonly inputKind: "image";
2072
+ readonly name: "MiDaS Depth Estimation";
2073
+ readonly outputKeys: ["image"];
2074
+ readonly price: {
2075
+ readonly kind: "metered";
2076
+ };
2077
+ readonly pricing: "$0/compute-second listed by fal";
2078
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/depth";
2079
+ readonly task: "depth map";
2080
+ };
2081
+ readonly "midas-preprocessor": {
2082
+ readonly category: "preprocess";
2083
+ readonly description: "Generate MiDaS depth and normal maps for image workflows.";
2084
+ readonly endpoint: "fal-ai/image-preprocessors/midas";
2085
+ readonly inputField: "image_url";
2086
+ readonly inputKind: "image";
2087
+ readonly name: "MiDaS Preprocessor";
2088
+ readonly outputKeys: ["depth_map", "normal_map"];
2089
+ readonly price: {
2090
+ readonly kind: "metered";
2091
+ };
2092
+ readonly pricing: "$0/compute-second listed by fal";
2093
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/midas";
2094
+ readonly task: "depth and normal preprocessing";
2095
+ };
2096
+ readonly mlsd: {
2097
+ readonly category: "preprocess";
2098
+ readonly description: "Detect straight line segments for architectural and interior control maps.";
2099
+ readonly endpoint: "fal-ai/image-preprocessors/mlsd";
2100
+ readonly inputField: "image_url";
2101
+ readonly inputKind: "image";
2102
+ readonly name: "M-LSD Line Preprocessor";
2103
+ readonly outputKeys: ["image"];
2104
+ readonly price: {
2105
+ readonly kind: "metered";
2106
+ };
2107
+ readonly pricing: "$0/compute-second listed by fal";
2108
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/mlsd";
2109
+ readonly task: "line segment preprocessing";
2110
+ };
2111
+ readonly pidi: {
2112
+ readonly category: "preprocess";
2113
+ readonly description: "Generate PiDiNet soft edge maps from an input image.";
2114
+ readonly endpoint: "fal-ai/image-preprocessors/pidi";
2115
+ readonly inputField: "image_url";
2116
+ readonly inputKind: "image";
2117
+ readonly name: "PiDiNet Edge Preprocessor";
2118
+ readonly outputKeys: ["image"];
2119
+ readonly price: {
2120
+ readonly kind: "metered";
2121
+ };
2122
+ readonly pricing: "$0/compute-second listed by fal";
2123
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/pidi";
2124
+ readonly task: "edge preprocessing";
2125
+ };
2126
+ readonly "sam-preprocessor": {
2127
+ readonly category: "preprocess";
2128
+ readonly description: "Generate a SAM segmentation map for ControlNet-style workflows.";
2129
+ readonly endpoint: "fal-ai/image-preprocessors/sam";
2130
+ readonly inputField: "image_url";
2131
+ readonly inputKind: "image";
2132
+ readonly name: "SAM Preprocessor";
2133
+ readonly outputKeys: ["image"];
2134
+ readonly price: {
2135
+ readonly kind: "metered";
2136
+ };
2137
+ readonly pricing: "$0/compute-second listed by fal";
2138
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/sam";
2139
+ readonly task: "segmentation preprocessing";
2140
+ };
2141
+ readonly "sam2-auto": {
2142
+ readonly category: "segmentation";
2143
+ readonly defaultOptions: {
2144
+ readonly min_mask_region_area: 100;
2145
+ readonly output_format: "png";
2146
+ readonly points_per_side: 32;
2147
+ readonly pred_iou_thresh: 0.88;
2148
+ readonly stability_score_thresh: 0.95;
2149
+ };
2150
+ readonly description: "Automatically segment an image into combined and individual masks.";
2151
+ readonly endpoint: "fal-ai/sam2/auto-segment";
2152
+ readonly inputField: "image_url";
2153
+ readonly inputKind: "image";
2154
+ readonly name: "SAM 2 Auto Segment";
2155
+ readonly outputKeys: ["combined_mask", "individual_masks"];
2156
+ readonly price: {
2157
+ readonly kind: "metered";
2158
+ };
2159
+ readonly pricing: "$0/compute-second listed by fal";
2160
+ readonly queued: true;
2161
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam2/auto-segment";
2162
+ readonly task: "automatic image segmentation";
2163
+ };
2164
+ readonly "sam3-1-image": {
2165
+ readonly category: "segmentation";
2166
+ readonly defaultOptions: {
2167
+ readonly apply_mask: true;
2168
+ readonly max_masks: 3;
2169
+ readonly output_format: "png";
2170
+ };
2171
+ readonly description: "Segment image objects with text, point, or box prompts. SAM 3.1 adds Object Multiplex for faster multi-object tracking.";
2172
+ readonly endpoint: "fal-ai/sam-3-1/image";
2173
+ readonly inputField: "image_url";
2174
+ readonly inputKind: "image";
2175
+ readonly name: "SAM 3.1 Image";
2176
+ readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
2177
+ readonly price: {
2178
+ readonly kind: "call";
2179
+ readonly usd: 0.01;
2180
+ };
2181
+ readonly pricing: "$0.01/request";
2182
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/image";
2183
+ readonly task: "promptable image segmentation";
2184
+ };
2185
+ readonly "sam3-1-video": {
2186
+ readonly category: "segmentation";
2187
+ readonly defaultOptions: {
2188
+ readonly apply_mask: true;
2189
+ readonly prompt: "person";
2190
+ };
2191
+ readonly description: "SAM 3.1 video segmentation with Object Multiplex tracking for multiple objects.";
2192
+ readonly endpoint: "fal-ai/sam-3-1/video";
2193
+ readonly inputField: "video_url";
2194
+ readonly inputKind: "video";
2195
+ readonly name: "SAM 3.1 Video";
2196
+ readonly outputKeys: ["video", "boundingbox_frames_zip"];
2197
+ readonly price: {
2198
+ readonly kind: "metered";
2199
+ };
2200
+ readonly pricing: "$0.01/16 frames of video input";
2201
+ readonly queued: true;
2202
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/video";
2203
+ readonly task: "multi-object video segmentation";
2204
+ };
2205
+ readonly "sam3-image": {
2206
+ readonly category: "segmentation";
2207
+ readonly defaultOptions: {
2208
+ readonly apply_mask: true;
2209
+ readonly max_masks: 3;
2210
+ readonly output_format: "png";
2211
+ };
2212
+ readonly description: "Segment image objects with text, point, or box prompts.";
2213
+ readonly endpoint: "fal-ai/sam-3/image";
2214
+ readonly inputField: "image_url";
2215
+ readonly inputKind: "image";
2216
+ readonly name: "SAM 3 Image";
2217
+ readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
2218
+ readonly price: {
2219
+ readonly kind: "call";
2220
+ readonly usd: 0.005;
2221
+ };
2222
+ readonly pricing: "$0.005/request";
2223
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image";
2224
+ readonly task: "promptable image segmentation";
2225
+ };
2226
+ readonly "sam3-image-rle": {
2227
+ readonly category: "segmentation";
2228
+ readonly defaultOptions: {
2229
+ readonly apply_mask: true;
2230
+ readonly max_masks: 3;
2231
+ };
2232
+ readonly description: "Segment image objects and return run-length encoded masks.";
2233
+ readonly endpoint: "fal-ai/sam-3/image-rle";
2234
+ readonly inputField: "image_url";
2235
+ readonly inputKind: "image";
2236
+ readonly name: "SAM 3 Image RLE";
2237
+ readonly outputKeys: ["rle", "scores", "boxes", "metadata"];
2238
+ readonly price: {
2239
+ readonly kind: "call";
2240
+ readonly usd: 0.005;
2241
+ };
2242
+ readonly pricing: "$0.005/request";
2243
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image-rle";
2244
+ readonly task: "promptable image segmentation to RLE";
2245
+ };
2246
+ readonly "sam3-video": {
2247
+ readonly category: "segmentation";
2248
+ readonly defaultOptions: {
2249
+ readonly apply_mask: true;
2250
+ readonly detection_threshold: 0.5;
2251
+ readonly prompt: "person";
2252
+ readonly video_output_type: "X264 (.mp4)";
2253
+ };
2254
+ readonly description: "Segment and track prompted objects across video frames.";
2255
+ readonly endpoint: "fal-ai/sam-3/video";
2256
+ readonly inputField: "video_url";
2257
+ readonly inputKind: "video";
2258
+ readonly name: "SAM 3 Video";
2259
+ readonly outputKeys: ["video", "boundingbox_frames_zip"];
2260
+ readonly price: {
2261
+ readonly kind: "metered";
2262
+ };
2263
+ readonly pricing: "$0.005/16 frames of video input";
2264
+ readonly queued: true;
2265
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video";
2266
+ readonly task: "promptable video segmentation";
2267
+ };
2268
+ readonly "sam3-video-rle": {
2269
+ readonly category: "segmentation";
2270
+ readonly defaultOptions: {
2271
+ readonly apply_mask: true;
2272
+ readonly detection_threshold: 0.5;
2273
+ readonly prompt: "person";
2274
+ };
2275
+ readonly description: "Track prompted video objects and return RLE mask data.";
2276
+ readonly endpoint: "fal-ai/sam-3/video-rle";
2277
+ readonly inputField: "video_url";
2278
+ readonly inputKind: "video";
2279
+ readonly name: "SAM 3 Video RLE";
2280
+ readonly outputKeys: ["video", "boundingbox_frames_zip"];
2281
+ readonly price: {
2282
+ readonly kind: "metered";
2283
+ };
2284
+ readonly pricing: "$0.005/16 frames of video";
2285
+ readonly queued: true;
2286
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video-rle";
2287
+ readonly task: "promptable video segmentation to RLE";
2288
+ };
2289
+ readonly scribble: {
2290
+ readonly category: "preprocess";
2291
+ readonly description: "Turn an image into a scribble-style control map.";
2292
+ readonly endpoint: "fal-ai/image-preprocessors/scribble";
2293
+ readonly inputField: "image_url";
2294
+ readonly inputKind: "image";
2295
+ readonly name: "Scribble Preprocessor";
2296
+ readonly outputKeys: ["image"];
2297
+ readonly price: {
2298
+ readonly kind: "metered";
2299
+ };
2300
+ readonly pricing: "$0/compute-second listed by fal";
2301
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/scribble";
2302
+ readonly task: "scribble preprocessing";
2303
+ };
2304
+ readonly teed: {
2305
+ readonly category: "preprocess";
2306
+ readonly description: "Generate TEED edge maps from an input image.";
2307
+ readonly endpoint: "fal-ai/image-preprocessors/teed";
2308
+ readonly inputField: "image_url";
2309
+ readonly inputKind: "image";
2310
+ readonly name: "TEED Edge Preprocessor";
2311
+ readonly outputKeys: ["image"];
2312
+ readonly price: {
2313
+ readonly kind: "metered";
2314
+ };
2315
+ readonly pricing: "$0/compute-second listed by fal";
2316
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/teed";
2317
+ readonly task: "edge preprocessing";
2318
+ };
2319
+ readonly "zoe-depth": {
2320
+ readonly category: "preprocess";
2321
+ readonly description: "Generate ZoeDepth metric depth maps from an input image.";
2322
+ readonly endpoint: "fal-ai/image-preprocessors/zoe";
2323
+ readonly inputField: "image_url";
2324
+ readonly inputKind: "image";
2325
+ readonly name: "ZoeDepth Preprocessor";
2326
+ readonly outputKeys: ["image"];
2327
+ readonly price: {
2328
+ readonly kind: "metered";
2329
+ };
2330
+ readonly pricing: "$0/compute-second listed by fal";
2331
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/zoe";
2332
+ readonly task: "depth preprocessing";
2333
+ };
2334
+ readonly "bria-eraser": {
2335
+ readonly category: "erase";
2336
+ readonly description: "Commercial-safe removal of a masked region, inpainted from surrounding context.";
2337
+ readonly endpoint: "fal-ai/bria/eraser";
2338
+ readonly inputField: "image_url";
2339
+ readonly inputKind: "image";
2340
+ readonly name: "Bria Eraser";
2341
+ readonly outputKeys: ["image"];
2342
+ readonly price: {
2343
+ readonly kind: "call";
2344
+ readonly usd: 0.04;
2345
+ };
2346
+ readonly pricing: "$0.04/generation";
2347
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/eraser";
2348
+ readonly task: "masked object erasure";
2349
+ };
2350
+ readonly "bria-expand": {
2351
+ readonly category: "reframe";
2352
+ readonly description: "Expand an image onto a larger canvas, generating the new border area.";
2353
+ readonly endpoint: "fal-ai/bria/expand";
2354
+ readonly inputField: "image_url";
2355
+ readonly inputKind: "image";
2356
+ readonly name: "Bria Image Expansion";
2357
+ readonly outputKeys: ["image"];
2358
+ readonly price: {
2359
+ readonly kind: "call";
2360
+ readonly usd: 0.04;
2361
+ };
2362
+ readonly pricing: "$0.04/generation";
2363
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/expand";
2364
+ readonly task: "image outpainting";
2365
+ };
2366
+ readonly "bria-genfill": {
2367
+ readonly category: "erase";
2368
+ readonly description: "Generative fill of a masked region from a prompt, commercial-safe.";
2369
+ readonly endpoint: "fal-ai/bria/genfill";
2370
+ readonly inputField: "image_url";
2371
+ readonly inputKind: "image";
2372
+ readonly name: "Bria GenFill";
2373
+ readonly outputKeys: ["images"];
2374
+ readonly price: {
2375
+ readonly kind: "call";
2376
+ readonly usd: 0.04;
2377
+ };
2378
+ readonly pricing: "$0.04/generation";
2379
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/genfill";
2380
+ readonly task: "masked generative fill";
2381
+ };
2382
+ readonly "finegrain-eraser": {
2383
+ readonly category: "erase";
2384
+ readonly description: "Remove a prompted object and its shadows and reflections, filling the gap.";
2385
+ readonly endpoint: "fal-ai/finegrain-eraser";
2386
+ readonly inputField: "image_url";
2387
+ readonly inputKind: "image";
2388
+ readonly name: "Finegrain Object Eraser";
2389
+ readonly outputKeys: ["image"];
2390
+ readonly price: {
2391
+ readonly kind: "call";
2392
+ readonly usd: 0.27;
2393
+ };
2394
+ readonly pricing: "$0.27/image at the default standard mode; $0.18 express, $0.36 premium";
2395
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/finegrain-eraser";
2396
+ readonly task: "prompted object erasure";
2397
+ };
2398
+ readonly "flux-outpaint": {
2399
+ readonly category: "reframe";
2400
+ readonly description: "Outpaint an image by a per-edge pixel expansion with FLUX.2 pro.";
2401
+ readonly endpoint: "fal-ai/flux-2-pro/outpaint";
2402
+ readonly inputField: "image_url";
2403
+ readonly inputKind: "image";
2404
+ readonly name: "FLUX.2 Pro Outpaint";
2405
+ readonly outputKeys: ["images"];
2406
+ readonly price: {
2407
+ readonly kind: "metered";
2408
+ };
2409
+ readonly pricing: "$0.03 for the first output megapixel, then $0.015 per extra megapixel of input and output, rounded up";
2410
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/flux-2-pro/outpaint";
2411
+ readonly task: "image outpainting";
2412
+ };
2413
+ readonly "iclight-v2": {
2414
+ readonly category: "relight";
2415
+ readonly description: "Relight a subject from a prompt, harmonising it with a new light direction.";
2416
+ readonly endpoint: "fal-ai/iclight-v2";
2417
+ readonly inputField: "image_url";
2418
+ readonly inputKind: "image";
2419
+ readonly name: "IC-Light v2";
2420
+ readonly outputKeys: ["images"];
2421
+ readonly price: {
2422
+ readonly kind: "megapixel";
2423
+ readonly usd: 0.1;
2424
+ };
2425
+ readonly pricing: "$0.10/megapixel";
2426
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/iclight-v2";
2427
+ readonly task: "prompted relighting";
2428
+ };
2429
+ readonly "ideogram-reframe": {
2430
+ readonly category: "reframe";
2431
+ readonly description: "Reframe an image to a new aspect ratio, generating the fill.";
2432
+ readonly endpoint: "fal-ai/ideogram/v3/reframe";
2433
+ readonly inputField: "image_url";
2434
+ readonly inputKind: "image";
2435
+ readonly name: "Ideogram v3 Reframe";
2436
+ readonly outputKeys: ["images"];
2437
+ readonly price: {
2438
+ readonly kind: "call";
2439
+ readonly usd: 0.06;
2440
+ };
2441
+ readonly pricing: "$0.06/image at the default BALANCED speed; $0.03 turbo, $0.09 quality";
2442
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/reframe";
2443
+ readonly task: "aspect ratio reframing";
2444
+ };
2445
+ readonly "lighting-restoration": {
2446
+ readonly category: "relight";
2447
+ readonly description: "Restore natural, even lighting across one or more input images.";
2448
+ readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
2449
+ readonly inputField: "image_urls";
2450
+ readonly inputKind: "images";
2451
+ readonly name: "Qwen Lighting Restoration";
2452
+ readonly outputKeys: ["images"];
2453
+ readonly price: {
2454
+ readonly kind: "megapixel";
2455
+ readonly usd: 0.035;
2456
+ };
2457
+ readonly pricing: "$0.035/megapixel";
2458
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
2459
+ readonly task: "lighting restoration";
2460
+ };
2461
+ readonly "object-removal": {
2462
+ readonly category: "erase";
2463
+ readonly description: "Remove a prompted object from an image and fill the gap.";
2464
+ readonly endpoint: "fal-ai/object-removal";
2465
+ readonly inputField: "image_url";
2466
+ readonly inputKind: "image";
2467
+ readonly name: "Object Removal";
2468
+ readonly outputKeys: ["images"];
2469
+ readonly price: {
2470
+ readonly kind: "call";
2471
+ readonly usd: 0.024;
2472
+ };
2473
+ readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
2474
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal";
2475
+ readonly task: "prompted object removal";
2476
+ };
2477
+ readonly "object-removal-bbox": {
2478
+ readonly category: "erase";
2479
+ readonly description: "Remove whatever falls inside supplied bounding boxes.";
2480
+ readonly endpoint: "fal-ai/object-removal/bbox";
2481
+ readonly inputField: "image_url";
2482
+ readonly inputKind: "image";
2483
+ readonly name: "Object Removal by Box";
2484
+ readonly outputKeys: ["images"];
2485
+ readonly price: {
2486
+ readonly kind: "call";
2487
+ readonly usd: 0.024;
2488
+ };
2489
+ readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
2490
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/bbox";
2491
+ readonly task: "bounding box object removal";
2492
+ };
2493
+ readonly "object-removal-mask": {
2494
+ readonly category: "erase";
2495
+ readonly description: "Remove the masked region of an image and fill the gap.";
2496
+ readonly endpoint: "fal-ai/object-removal/mask";
2497
+ readonly inputField: "image_url";
2498
+ readonly inputKind: "image";
2499
+ readonly name: "Object Removal by Mask";
2500
+ readonly outputKeys: ["images"];
2501
+ readonly price: {
2502
+ readonly kind: "call";
2503
+ readonly usd: 0.024;
2504
+ };
2505
+ readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
2506
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/mask";
2507
+ readonly task: "masked object removal";
2508
+ };
2509
+ readonly "remove-lighting": {
2510
+ readonly category: "relight";
2511
+ readonly description: "Strip baked-in lighting and shadows to leave a flat, neutral surface.";
2512
+ readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
2513
+ readonly inputField: "image_urls";
2514
+ readonly inputKind: "images";
2515
+ readonly name: "Qwen Remove Lighting";
2516
+ readonly outputKeys: ["images"];
2517
+ readonly price: {
2518
+ readonly kind: "megapixel";
2519
+ readonly usd: 0.035;
2520
+ };
2521
+ readonly pricing: "$0.035/megapixel";
2522
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
2523
+ readonly task: "lighting removal";
2524
+ };
2525
+ readonly "smart-resize": {
2526
+ readonly category: "reframe";
2527
+ readonly description: "Resize one image to several target sizes, recomposing rather than cropping.";
2528
+ readonly endpoint: "fal-ai/smart-resize";
2529
+ readonly inputField: "image_url";
2530
+ readonly inputKind: "image";
2531
+ readonly name: "Smart Resize";
2532
+ readonly outputKeys: ["images", "results"];
2533
+ readonly price: {
2534
+ readonly kind: "metered";
2535
+ };
2536
+ readonly pricing: "$0.15 per output image, doubled at 4K, plus a $0.05 vision analysis fee per request";
2537
+ readonly queued: true;
2538
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/smart-resize";
2539
+ readonly task: "multi-size recomposition";
2540
+ };
2541
+ readonly "text-removal": {
2542
+ readonly category: "erase";
2543
+ readonly defaultOptions: {
2544
+ readonly output_format: "png";
2545
+ };
2546
+ readonly description: "Remove all rendered text from an image, rebuilding what sat behind it.";
2547
+ readonly endpoint: "fal-ai/image-editing/text-removal";
2548
+ readonly inputField: "image_url";
2549
+ readonly inputKind: "image";
2550
+ readonly name: "Text Removal";
2551
+ readonly outputKeys: ["images"];
2552
+ readonly price: {
2553
+ readonly kind: "call";
2554
+ readonly usd: 0.04;
2555
+ };
2556
+ readonly pricing: "$0.04/image";
2557
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image-editing/text-removal";
2558
+ readonly task: "text removal";
2559
+ };
2560
+ readonly "ben-v2": {
2561
+ readonly category: "background";
2562
+ readonly description: "Fast, high-quality background removal for images.";
2563
+ readonly endpoint: "fal-ai/ben/v2/image";
2564
+ readonly inputField: "image_url";
2565
+ readonly inputKind: "image";
2566
+ readonly name: "BEN v2 Background Removal";
2567
+ readonly outputKeys: ["image"];
2568
+ readonly price: {
2569
+ readonly kind: "megapixel";
2570
+ readonly usd: 0.025;
2571
+ };
2572
+ readonly pricing: "$0.025/megapixel";
2573
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ben/v2/image";
2574
+ readonly task: "image background removal";
2575
+ };
2576
+ readonly birefnet: {
2577
+ readonly category: "background";
2578
+ readonly defaultOptions: {
2579
+ readonly model: "General Use (Light)";
2580
+ readonly operating_resolution: "1024x1024";
2581
+ readonly output_format: "png";
2582
+ readonly refine_foreground: true;
2583
+ };
2584
+ readonly description: "High-resolution dichotomous image segmentation and background removal.";
975
2585
  readonly endpoint: "fal-ai/birefnet/v2";
976
2586
  readonly inputField: "image_url";
977
2587
  readonly inputKind: "image";
978
2588
  readonly name: "BirefNet Background Removal";
979
2589
  readonly outputKeys: ["image", "mask_image"];
2590
+ readonly price: {
2591
+ readonly kind: "metered";
2592
+ };
980
2593
  readonly pricing: "$0/compute-second listed by fal";
981
2594
  readonly sourceUrl: "https://fal.ai/models/fal-ai/birefnet/v2";
982
2595
  readonly task: "image background removal";
@@ -989,7 +2602,11 @@ declare const FAL_TOOLS: {
989
2602
  readonly inputKind: "image";
990
2603
  readonly name: "Bria RMBG 2.0";
991
2604
  readonly outputKeys: ["image"];
992
- readonly pricing: "$0.02/image";
2605
+ readonly price: {
2606
+ readonly kind: "call";
2607
+ readonly usd: 0.018;
2608
+ };
2609
+ readonly pricing: "$0.018/generation";
993
2610
  readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/background/remove";
994
2611
  readonly task: "image background removal";
995
2612
  };
@@ -1006,171 +2623,410 @@ declare const FAL_TOOLS: {
1006
2623
  readonly inputKind: "video";
1007
2624
  readonly name: "Bria Video Background Removal";
1008
2625
  readonly outputKeys: ["video"];
1009
- readonly pricing: "$0.14/sec";
2626
+ readonly price: {
2627
+ readonly kind: "second";
2628
+ readonly usd: 0.00425;
2629
+ };
2630
+ readonly pricing: "$0.00425/sec";
2631
+ readonly queued: true;
1010
2632
  readonly sourceUrl: "https://fal.ai/models/bria/video/background-removal";
1011
2633
  readonly task: "video background removal";
1012
2634
  };
1013
- readonly "depth-anything": {
1014
- readonly category: "preprocess";
1015
- readonly description: "Generate Depth Anything v2 depth maps from input images.";
1016
- readonly endpoint: "fal-ai/image-preprocessors/depth-anything/v2";
2635
+ readonly ddcolor: {
2636
+ readonly category: "restoration";
2637
+ readonly description: "Colourise black-and-white photographs.";
2638
+ readonly endpoint: "fal-ai/ddcolor";
1017
2639
  readonly inputField: "image_url";
1018
2640
  readonly inputKind: "image";
1019
- readonly name: "Depth Anything v2 Preprocessor";
2641
+ readonly name: "DDColor Colourisation";
1020
2642
  readonly outputKeys: ["image"];
1021
- readonly pricing: "$0/compute-second listed by fal";
1022
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/depth-anything/v2";
1023
- readonly task: "depth preprocessing";
2643
+ readonly price: {
2644
+ readonly kind: "megapixel";
2645
+ readonly usd: 0.001;
2646
+ };
2647
+ readonly pricing: "$0.001/megapixel";
2648
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ddcolor";
2649
+ readonly task: "photo colourisation";
1024
2650
  };
1025
- readonly lineart: {
1026
- readonly category: "preprocess";
2651
+ readonly rembg: {
2652
+ readonly category: "background";
1027
2653
  readonly defaultOptions: {
1028
- readonly coarse: false;
2654
+ readonly crop_to_bbox: false;
1029
2655
  };
1030
- readonly description: "Generate line art/control-style edges from an input image.";
1031
- readonly endpoint: "fal-ai/image-preprocessors/lineart";
2656
+ readonly description: "Generic image background removal utility.";
2657
+ readonly endpoint: "fal-ai/imageutils/rembg";
1032
2658
  readonly inputField: "image_url";
1033
2659
  readonly inputKind: "image";
1034
- readonly name: "Line Art Preprocessor";
2660
+ readonly name: "Remove Background";
1035
2661
  readonly outputKeys: ["image"];
2662
+ readonly price: {
2663
+ readonly kind: "metered";
2664
+ };
1036
2665
  readonly pricing: "$0/compute-second listed by fal";
1037
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/lineart";
1038
- readonly task: "image preprocessing";
2666
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/rembg";
2667
+ readonly task: "image background removal";
1039
2668
  };
1040
- readonly "marigold-depth": {
1041
- readonly category: "depth";
2669
+ readonly "seedvr-upscale": {
2670
+ readonly category: "restoration";
1042
2671
  readonly defaultOptions: {
1043
- readonly ensemble_size: 10;
1044
- readonly num_inference_steps: 10;
2672
+ readonly output_format: "png";
1045
2673
  };
1046
- readonly description: "Create depth maps using Marigold depth estimation.";
1047
- readonly endpoint: "fal-ai/imageutils/marigold-depth";
2674
+ readonly description: "Diffusion image restoration and upscaling with SeedVR.";
2675
+ readonly endpoint: "fal-ai/seedvr/upscale/image";
1048
2676
  readonly inputField: "image_url";
1049
2677
  readonly inputKind: "image";
1050
- readonly name: "Marigold Depth Estimation";
2678
+ readonly name: "SeedVR Image Upscale";
1051
2679
  readonly outputKeys: ["image"];
1052
- readonly pricing: "$0/compute-second listed by fal";
1053
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/marigold-depth";
1054
- readonly task: "depth map";
2680
+ readonly price: {
2681
+ readonly kind: "megapixel";
2682
+ readonly usd: 0.001;
2683
+ };
2684
+ readonly pricing: "$0.001/megapixel";
2685
+ readonly queued: true;
2686
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image";
2687
+ readonly task: "image restoration and upscaling";
1055
2688
  };
1056
- readonly "midas-depth": {
1057
- readonly category: "depth";
2689
+ readonly "topaz-adjust": {
2690
+ readonly category: "restoration";
1058
2691
  readonly defaultOptions: {
1059
- readonly a: number;
1060
- readonly bg_th: 0.1;
2692
+ readonly output_format: "png";
1061
2693
  };
1062
- readonly description: "Create MiDaS depth maps from input images.";
1063
- readonly endpoint: "fal-ai/imageutils/depth";
2694
+ readonly description: "Topaz exposure, white balance, and colour adjustment.";
2695
+ readonly endpoint: "topaz/adjust/image";
1064
2696
  readonly inputField: "image_url";
1065
2697
  readonly inputKind: "image";
1066
- readonly name: "MiDaS Depth Estimation";
2698
+ readonly name: "Topaz Adjust";
1067
2699
  readonly outputKeys: ["image"];
1068
- readonly pricing: "$0/compute-second listed by fal";
1069
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/depth";
1070
- readonly task: "depth map";
2700
+ readonly price: {
2701
+ readonly kind: "megapixel";
2702
+ readonly usd: number;
2703
+ };
2704
+ readonly pricing: "$0.08 per 24 output megapixels";
2705
+ readonly queued: true;
2706
+ readonly sourceUrl: "https://fal.ai/models/topaz/adjust/image";
2707
+ readonly task: "tonal adjustment";
1071
2708
  };
1072
- readonly "midas-preprocessor": {
1073
- readonly category: "preprocess";
1074
- readonly description: "Generate MiDaS depth and normal maps for image workflows.";
1075
- readonly endpoint: "fal-ai/image-preprocessors/midas";
2709
+ readonly "topaz-creative": {
2710
+ readonly category: "restoration";
2711
+ readonly defaultOptions: {
2712
+ readonly output_format: "png";
2713
+ };
2714
+ readonly description: "Topaz Bloom upscaling, which reimagines detail rather than preserving it.";
2715
+ readonly endpoint: "topaz/upscale/image/creative";
1076
2716
  readonly inputField: "image_url";
1077
2717
  readonly inputKind: "image";
1078
- readonly name: "MiDaS Preprocessor";
1079
- readonly outputKeys: ["depth_map", "normal_map"];
1080
- readonly pricing: "$0/compute-second listed by fal";
1081
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/midas";
1082
- readonly task: "depth and normal preprocessing";
2718
+ readonly name: "Topaz Creative Upscale";
2719
+ readonly outputKeys: ["image"];
2720
+ readonly price: {
2721
+ readonly kind: "megapixel";
2722
+ readonly usd: number;
2723
+ };
2724
+ readonly pricing: "$0.96 per 24 output megapixels";
2725
+ readonly queued: true;
2726
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/creative";
2727
+ readonly task: "creative image upscaling";
1083
2728
  };
1084
- readonly nsfw: {
1085
- readonly category: "moderation";
1086
- readonly description: "Predict whether one or more images contain NSFW concepts.";
1087
- readonly endpoint: "fal-ai/x-ailab/nsfw";
1088
- readonly inputField: "image_urls";
1089
- readonly inputKind: "images";
1090
- readonly name: "NSFW Checker";
1091
- readonly outputKeys: ["has_nsfw_concepts"];
1092
- readonly pricing: "$0.001/image";
1093
- readonly sourceUrl: "https://fal.ai/models/fal-ai/x-ailab/nsfw";
1094
- readonly task: "vision moderation";
2729
+ readonly "topaz-denoise": {
2730
+ readonly category: "restoration";
2731
+ readonly defaultOptions: {
2732
+ readonly output_format: "png";
2733
+ };
2734
+ readonly description: "Topaz noise reduction at source resolution.";
2735
+ readonly endpoint: "topaz/denoise/image";
2736
+ readonly inputField: "image_url";
2737
+ readonly inputKind: "image";
2738
+ readonly name: "Topaz Denoise";
2739
+ readonly outputKeys: ["image"];
2740
+ readonly price: {
2741
+ readonly kind: "megapixel";
2742
+ readonly usd: number;
2743
+ };
2744
+ readonly pricing: "$0.08 per 24 output megapixels at the default Normal model; $0.16 with Denoise Max";
2745
+ readonly queued: true;
2746
+ readonly sourceUrl: "https://fal.ai/models/topaz/denoise/image";
2747
+ readonly task: "image denoising";
2748
+ };
2749
+ readonly "topaz-generative": {
2750
+ readonly category: "restoration";
2751
+ readonly defaultOptions: {
2752
+ readonly output_format: "png";
2753
+ };
2754
+ readonly description: "Topaz Wonder upscaling, which synthesises plausible detail as it enlarges.";
2755
+ readonly endpoint: "topaz/upscale/image/generative";
2756
+ readonly inputField: "image_url";
2757
+ readonly inputKind: "image";
2758
+ readonly name: "Topaz Generative Upscale";
2759
+ readonly outputKeys: ["image"];
2760
+ readonly price: {
2761
+ readonly kind: "megapixel";
2762
+ readonly usd: number;
2763
+ };
2764
+ readonly pricing: "$0.24 per 24 output megapixels at the default Wonder 3; $0.48 with Wonder, Wonder 2, Standard MAX, Redefine or Recover 3";
2765
+ readonly queued: true;
2766
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/generative";
2767
+ readonly task: "generative image upscaling";
2768
+ };
2769
+ readonly "topaz-image": {
2770
+ readonly category: "upscale";
2771
+ readonly defaultOptions: {
2772
+ readonly model: "Standard V2";
2773
+ readonly output_format: "jpeg";
2774
+ readonly upscale_factor: 2;
2775
+ };
2776
+ readonly description: "Professional Topaz image enhancement and upscaling.";
2777
+ readonly endpoint: "fal-ai/topaz/upscale/image";
2778
+ readonly inputField: "image_url";
2779
+ readonly inputKind: "image";
2780
+ readonly name: "Topaz Image Upscale";
2781
+ readonly outputKeys: ["image"];
2782
+ readonly price: {
2783
+ readonly kind: "megapixel";
2784
+ readonly usd: number;
2785
+ };
2786
+ readonly pricing: "$0.08 for output up to 24MP; $0.16 to 48MP, $0.32 to 96MP, up to $1.36 at 512MP";
2787
+ readonly queued: true;
2788
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image";
2789
+ readonly task: "image enhancement";
2790
+ };
2791
+ readonly "topaz-precision": {
2792
+ readonly category: "restoration";
2793
+ readonly defaultOptions: {
2794
+ readonly output_format: "png";
2795
+ };
2796
+ readonly description: "Topaz upscaling that preserves the original detail rather than inventing it.";
2797
+ readonly endpoint: "topaz/upscale/image/precision";
2798
+ readonly inputField: "image_url";
2799
+ readonly inputKind: "image";
2800
+ readonly name: "Topaz Precision Upscale";
2801
+ readonly outputKeys: ["image"];
2802
+ readonly price: {
2803
+ readonly kind: "megapixel";
2804
+ readonly usd: number;
2805
+ };
2806
+ readonly pricing: "$0.08 per 24 output megapixels, any precision model";
2807
+ readonly queued: true;
2808
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/precision";
2809
+ readonly task: "faithful image upscaling";
2810
+ };
2811
+ readonly "topaz-restore": {
2812
+ readonly category: "restoration";
2813
+ readonly defaultOptions: {
2814
+ readonly output_format: "png";
2815
+ };
2816
+ readonly description: "Topaz restoration of damaged or degraded photographs at source resolution.";
2817
+ readonly endpoint: "topaz/restore/image";
2818
+ readonly inputField: "image_url";
2819
+ readonly inputKind: "image";
2820
+ readonly name: "Topaz Restore";
2821
+ readonly outputKeys: ["image"];
2822
+ readonly price: {
2823
+ readonly kind: "megapixel";
2824
+ readonly usd: number;
2825
+ };
2826
+ readonly pricing: "$0.48 per 24 output megapixels at the default Recover 3; $0.08 with Dust-Scratch V2";
2827
+ readonly queued: true;
2828
+ readonly sourceUrl: "https://fal.ai/models/topaz/restore/image";
2829
+ readonly task: "photo restoration";
1095
2830
  };
1096
- readonly rembg: {
1097
- readonly category: "background";
2831
+ readonly "topaz-sharpen": {
2832
+ readonly category: "restoration";
1098
2833
  readonly defaultOptions: {
1099
- readonly crop_to_bbox: false;
2834
+ readonly output_format: "png";
1100
2835
  };
1101
- readonly description: "Generic image background removal utility.";
1102
- readonly endpoint: "fal-ai/imageutils/rembg";
2836
+ readonly description: "Topaz deblurring and sharpening at source resolution.";
2837
+ readonly endpoint: "topaz/sharpen/image";
1103
2838
  readonly inputField: "image_url";
1104
2839
  readonly inputKind: "image";
1105
- readonly name: "Remove Background";
2840
+ readonly name: "Topaz Sharpen";
1106
2841
  readonly outputKeys: ["image"];
1107
- readonly pricing: "$0/compute-second listed by fal";
1108
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/rembg";
1109
- readonly task: "image background removal";
2842
+ readonly price: {
2843
+ readonly kind: "megapixel";
2844
+ readonly usd: number;
2845
+ };
2846
+ readonly pricing: "$0.08 per 24 output megapixels at the default Standard model; $0.16 with Super Focus";
2847
+ readonly queued: true;
2848
+ readonly sourceUrl: "https://fal.ai/models/topaz/sharpen/image";
2849
+ readonly task: "image sharpening";
1110
2850
  };
1111
- readonly "sam-preprocessor": {
1112
- readonly category: "preprocess";
1113
- readonly description: "Generate a SAM segmentation map for ControlNet-style workflows.";
1114
- readonly endpoint: "fal-ai/image-preprocessors/sam";
2851
+ readonly "topaz-transparent": {
2852
+ readonly category: "restoration";
2853
+ readonly description: "Topaz upscaling that preserves the alpha channel end to end.";
2854
+ readonly endpoint: "topaz/upscale/image/transparent";
1115
2855
  readonly inputField: "image_url";
1116
2856
  readonly inputKind: "image";
1117
- readonly name: "SAM Preprocessor";
2857
+ readonly name: "Topaz Transparent Upscale";
1118
2858
  readonly outputKeys: ["image"];
1119
- readonly pricing: "$0/compute-second listed by fal";
1120
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/sam";
1121
- readonly task: "segmentation preprocessing";
2859
+ readonly price: {
2860
+ readonly kind: "megapixel";
2861
+ readonly usd: number;
2862
+ };
2863
+ readonly pricing: "$0.08 per 24 output megapixels";
2864
+ readonly queued: true;
2865
+ readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/transparent";
2866
+ readonly task: "transparent image upscaling";
1122
2867
  };
1123
- readonly "sam2-auto": {
1124
- readonly category: "segmentation";
2868
+ readonly "topaz-video": {
2869
+ readonly category: "upscale";
1125
2870
  readonly defaultOptions: {
1126
- readonly min_mask_region_area: 100;
1127
- readonly output_format: "png";
1128
- readonly points_per_side: 32;
1129
- readonly pred_iou_thresh: 0.88;
1130
- readonly stability_score_thresh: 0.95;
2871
+ readonly model: "Proteus";
2872
+ readonly upscale_factor: 2;
1131
2873
  };
1132
- readonly description: "Automatically segment an image into combined and individual masks.";
1133
- readonly endpoint: "fal-ai/sam2/auto-segment";
2874
+ readonly description: "Professional Topaz video enhancement and upscaling.";
2875
+ readonly endpoint: "fal-ai/topaz/upscale/video";
2876
+ readonly inputField: "video_url";
2877
+ readonly inputKind: "video";
2878
+ readonly name: "Topaz Video Upscale";
2879
+ readonly outputKeys: ["video"];
2880
+ readonly price: {
2881
+ readonly kind: "second";
2882
+ readonly usd: 0.01;
2883
+ };
2884
+ readonly pricing: "$0.01/sec up to 720p; $0.02 to 1080p, $0.08 above, doubled at 60fps, halved with Gaia 2";
2885
+ readonly queued: true;
2886
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video";
2887
+ readonly task: "video enhancement";
2888
+ };
2889
+ readonly "hunyuan3d-v3": {
2890
+ readonly category: "3d";
2891
+ readonly description: "Reconstruct a textured 3D mesh from a single image, with optional multi-view inputs.";
2892
+ readonly endpoint: "fal-ai/hunyuan3d-v3/image-to-3d";
2893
+ readonly inputField: "input_image_url";
2894
+ readonly inputKind: "image";
2895
+ readonly name: "Hunyuan3D v3 Image to 3D";
2896
+ readonly outputKeys: ["model_glb", "model_urls", "thumbnail"];
2897
+ readonly price: {
2898
+ readonly kind: "call";
2899
+ readonly usd: 0.375;
2900
+ };
2901
+ readonly pricing: "$0.375/generation at the default Normal type; $0.45 low poly, $0.225 geometry only, and $0.15 each for PBR, multi-view, or a custom face count";
2902
+ readonly queued: true;
2903
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/hunyuan3d-v3/image-to-3d";
2904
+ readonly task: "single-image 3D reconstruction";
2905
+ };
2906
+ readonly "ideogram-layerize-text": {
2907
+ readonly category: "layers";
2908
+ readonly description: "Split an image into background image layers plus editable HTML text containers.";
2909
+ readonly endpoint: "fal-ai/ideogram/v3/layerize-text";
1134
2910
  readonly inputField: "image_url";
1135
2911
  readonly inputKind: "image";
1136
- readonly name: "SAM 2 Auto Segment";
1137
- readonly outputKeys: ["combined_mask", "individual_masks"];
1138
- readonly pricing: "$0/compute-second listed by fal";
1139
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam2/auto-segment";
1140
- readonly task: "automatic image segmentation";
2912
+ readonly name: "Ideogram v3 Text Layerize";
2913
+ readonly outputKeys: ["image_layers", "image", "text_html", "text_containers"];
2914
+ readonly price: {
2915
+ readonly kind: "call";
2916
+ readonly usd: 0.09;
2917
+ };
2918
+ readonly pricing: "$0.09/image";
2919
+ readonly queued: true;
2920
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/layerize-text";
2921
+ readonly task: "text and image layer extraction";
1141
2922
  };
1142
- readonly "sam3-1-image": {
1143
- readonly category: "segmentation";
1144
- readonly defaultOptions: {
1145
- readonly apply_mask: true;
1146
- readonly max_masks: 3;
1147
- readonly output_format: "png";
2923
+ readonly "ideogram-tiling": {
2924
+ readonly category: "material";
2925
+ readonly description: "Generate a seamlessly tiling texture, optionally conditioned on a source image.";
2926
+ readonly endpoint: "ideogram/v4/tiling";
2927
+ readonly inputField: "image_url";
2928
+ readonly inputKind: "image";
2929
+ readonly name: "Ideogram v4 Tiling";
2930
+ readonly outputKeys: ["images"];
2931
+ readonly price: {
2932
+ readonly kind: "megapixel";
2933
+ readonly usd: 0.06;
1148
2934
  };
1149
- readonly description: "Segment image objects with text, point, or box prompts. SAM 3.1 adds Object Multiplex for faster multi-object tracking.";
1150
- readonly endpoint: "fal-ai/sam-3-1/image";
2935
+ readonly pricing: "$0.06/megapixel at the default BALANCED speed; $0.03 turbo, $0.10 quality";
2936
+ readonly sourceUrl: "https://fal.ai/models/ideogram/v4/tiling";
2937
+ readonly task: "seamless texture generation";
2938
+ };
2939
+ readonly image2svg: {
2940
+ readonly category: "vector";
2941
+ readonly description: "Trace a raster image into layered SVG paths.";
2942
+ readonly endpoint: "fal-ai/image2svg";
1151
2943
  readonly inputField: "image_url";
1152
2944
  readonly inputKind: "image";
1153
- readonly name: "SAM 3.1 Image";
1154
- readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
1155
- readonly pricing: "$0.005/request";
1156
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/image";
1157
- readonly task: "promptable image segmentation";
2945
+ readonly name: "Image to SVG";
2946
+ readonly outputKeys: ["images"];
2947
+ readonly price: {
2948
+ readonly kind: "call";
2949
+ readonly usd: 0.005;
2950
+ };
2951
+ readonly pricing: "$0.005/image";
2952
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/image2svg";
2953
+ readonly task: "raster to vector tracing";
1158
2954
  };
1159
- readonly "sam3-1-video": {
1160
- readonly category: "segmentation";
1161
- readonly defaultOptions: {
1162
- readonly apply_mask: true;
1163
- readonly prompt: "person";
2955
+ readonly patina: {
2956
+ readonly category: "material";
2957
+ readonly description: "Decompose a surface photograph into PBR maps: basecolor, normal, roughness, metalness, height.";
2958
+ readonly endpoint: "fal-ai/patina";
2959
+ readonly inputField: "image_url";
2960
+ readonly inputKind: "image";
2961
+ readonly name: "Patina PBR Maps";
2962
+ readonly outputKeys: ["images"];
2963
+ readonly outputLabels: {
2964
+ readonly images: {
2965
+ readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
2966
+ readonly fromOption: "maps";
2967
+ };
1164
2968
  };
1165
- readonly description: "SAM 3.1 video segmentation with Object Multiplex tracking for multiple objects.";
1166
- readonly endpoint: "fal-ai/sam-3-1/video";
1167
- readonly inputField: "video_url";
1168
- readonly inputKind: "video";
1169
- readonly name: "SAM 3.1 Video";
1170
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
1171
- readonly pricing: "fal pricing varies by frame count";
1172
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/video";
1173
- readonly task: "multi-object video segmentation";
2969
+ readonly price: {
2970
+ readonly kind: "metered";
2971
+ };
2972
+ readonly pricing: "$0.01 base plus $0.01/megapixel per output map, so all 5 maps on a 1MP image cost $0.06; the listed rate is per map";
2973
+ readonly queued: true;
2974
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/patina";
2975
+ readonly task: "PBR material decomposition";
2976
+ };
2977
+ readonly "patina-extract": {
2978
+ readonly category: "material";
2979
+ readonly description: "Extract a tiling PBR material from a prompted region of a photograph.";
2980
+ readonly endpoint: "fal-ai/patina/material/extract";
2981
+ readonly inputField: "image_url";
2982
+ readonly inputKind: "image";
2983
+ readonly name: "Patina Material Extract";
2984
+ readonly outputKeys: ["images"];
2985
+ readonly outputLabels: {
2986
+ readonly images: {
2987
+ readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
2988
+ readonly fromOption: "maps";
2989
+ };
2990
+ };
2991
+ readonly price: {
2992
+ readonly kind: "metered";
2993
+ };
2994
+ readonly pricing: "$0.10 base only; add $0.02/megapixel plus $0.01/megapixel per map, so 1MP with all 5 maps is $0.17";
2995
+ readonly queued: true;
2996
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/patina/material/extract";
2997
+ readonly task: "tiling material extraction";
2998
+ };
2999
+ readonly "qwen-layered": {
3000
+ readonly category: "layers";
3001
+ readonly description: "Split an image into a configurable number of stacked RGBA layers.";
3002
+ readonly endpoint: "fal-ai/qwen-image-layered";
3003
+ readonly inputField: "image_url";
3004
+ readonly inputKind: "image";
3005
+ readonly name: "Qwen Image Layered";
3006
+ readonly outputKeys: ["images"];
3007
+ readonly price: {
3008
+ readonly kind: "metered";
3009
+ };
3010
+ readonly pricing: "$0.05 per image; fal does not say whether that counts the input image or each of the generated layers, so no estimate is reported";
3011
+ readonly queued: true;
3012
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-layered";
3013
+ readonly task: "image layer decomposition";
3014
+ };
3015
+ readonly "recraft-vectorize": {
3016
+ readonly category: "vector";
3017
+ readonly description: "Convert a raster image into a clean SVG.";
3018
+ readonly endpoint: "fal-ai/recraft/vectorize";
3019
+ readonly inputField: "image_url";
3020
+ readonly inputKind: "image";
3021
+ readonly name: "Recraft Vectorize";
3022
+ readonly outputKeys: ["image"];
3023
+ readonly price: {
3024
+ readonly kind: "call";
3025
+ readonly usd: 0.04;
3026
+ };
3027
+ readonly pricing: "$0.04/image, $0.08 with a vector style";
3028
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/recraft/vectorize";
3029
+ readonly task: "raster to vector conversion";
1174
3030
  };
1175
3031
  readonly "sam3-3d-align": {
1176
3032
  readonly category: "3d";
@@ -1179,8 +3035,12 @@ declare const FAL_TOOLS: {
1179
3035
  readonly inputField: "image_url";
1180
3036
  readonly inputKind: "image";
1181
3037
  readonly name: "SAM 3D Align";
1182
- readonly outputKeys: ["scene_glb", "metadata", "artifacts_zip"];
1183
- readonly pricing: "fal pricing varies by scene";
3038
+ readonly outputKeys: ["scene_glb", "model_glb", "visualization", "body_mesh_ply", "metadata"];
3039
+ readonly price: {
3040
+ readonly kind: "metered";
3041
+ };
3042
+ readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
3043
+ readonly queued: true;
1184
3044
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-align";
1185
3045
  readonly task: "3D scene alignment";
1186
3046
  };
@@ -1197,7 +3057,11 @@ declare const FAL_TOOLS: {
1197
3057
  readonly inputKind: "image";
1198
3058
  readonly name: "SAM 3D Body";
1199
3059
  readonly outputKeys: ["model_glb", "visualization", "meshes", "metadata"];
1200
- readonly pricing: "$0.015/inference";
3060
+ readonly price: {
3061
+ readonly kind: "metered";
3062
+ };
3063
+ readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
3064
+ readonly queued: true;
1201
3065
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-body";
1202
3066
  readonly task: "single-image 3D body reconstruction";
1203
3067
  };
@@ -1212,116 +3076,311 @@ declare const FAL_TOOLS: {
1212
3076
  readonly inputKind: "image";
1213
3077
  readonly name: "SAM 3D Objects";
1214
3078
  readonly outputKeys: ["gaussian_splat", "model_glb", "metadata", "individual_splats", "individual_glbs", "artifacts_zip"];
1215
- readonly pricing: "$0.02/generation";
3079
+ readonly price: {
3080
+ readonly kind: "metered";
3081
+ };
3082
+ readonly pricing: "$0.02 per unit; fal does not define a unit, and this endpoint returns one mesh per detected object, so no estimate is reported";
3083
+ readonly queued: true;
1216
3084
  readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-objects";
1217
3085
  readonly task: "single-image 3D object reconstruction";
1218
3086
  };
1219
- readonly "sam3-image": {
1220
- readonly category: "segmentation";
1221
- readonly defaultOptions: {
1222
- readonly apply_mask: true;
1223
- readonly max_masks: 3;
1224
- readonly output_format: "png";
1225
- };
1226
- readonly description: "Segment image objects with text, point, or box prompts.";
1227
- readonly endpoint: "fal-ai/sam-3/image";
3087
+ readonly "seedream-layerize": {
3088
+ readonly category: "layers";
3089
+ readonly description: "Split an image into editable Seedream layers plus flattened previews.";
3090
+ readonly endpoint: "bytedance/seedream/v5/pro/layerize";
1228
3091
  readonly inputField: "image_url";
1229
3092
  readonly inputKind: "image";
1230
- readonly name: "SAM 3 Image";
1231
- readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
1232
- readonly pricing: "$0.005/request";
1233
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image";
1234
- readonly task: "promptable image segmentation";
3093
+ readonly name: "Seedream v5 Pro Layerize";
3094
+ readonly outputKeys: ["layers", "images"];
3095
+ readonly outputLabels: {
3096
+ readonly layers: {
3097
+ readonly fromItem: {
3098
+ readonly nameField: "name";
3099
+ readonly orderField: "z_index";
3100
+ };
3101
+ };
3102
+ };
3103
+ readonly price: {
3104
+ readonly kind: "metered";
3105
+ };
3106
+ readonly pricing: "$0.03375 per generated layer below 1536x1536 total area, $0.0675 per layer above; the listed rate is per layer, not per call";
3107
+ readonly queued: true;
3108
+ readonly sourceUrl: "https://fal.ai/models/bytedance/seedream/v5/pro/layerize";
3109
+ readonly task: "image layer decomposition";
1235
3110
  };
1236
- readonly "sam3-image-rle": {
1237
- readonly category: "segmentation";
1238
- readonly defaultOptions: {
1239
- readonly apply_mask: true;
1240
- readonly max_masks: 3;
3111
+ readonly "seedvr-seamless": {
3112
+ readonly category: "material";
3113
+ readonly description: "Upscale a tiling texture while keeping its edges seamless. ";
3114
+ readonly endpoint: "fal-ai/seedvr/upscale/image/seamless";
3115
+ readonly inputField: "image_url";
3116
+ readonly inputKind: "image";
3117
+ readonly name: "SeedVR Seamless Upscale";
3118
+ readonly outputKeys: ["image"];
3119
+ readonly price: {
3120
+ readonly kind: "megapixel";
3121
+ readonly usd: 0.0025;
1241
3122
  };
1242
- readonly description: "Segment image objects and return run-length encoded masks.";
1243
- readonly endpoint: "fal-ai/sam-3/image-rle";
3123
+ readonly pricing: "$0.0025/megapixel";
3124
+ readonly queued: true;
3125
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image/seamless";
3126
+ readonly task: "seamless texture upscaling";
3127
+ };
3128
+ readonly "trellis-2": {
3129
+ readonly category: "3d";
3130
+ readonly description: "Reconstruct a textured 3D mesh from a single image, with UV unwrapping.";
3131
+ readonly endpoint: "fal-ai/trellis-2";
1244
3132
  readonly inputField: "image_url";
1245
3133
  readonly inputKind: "image";
1246
- readonly name: "SAM 3 Image RLE";
1247
- readonly outputKeys: ["rle_masks", "metadata", "scores", "boxes"];
1248
- readonly pricing: "$0.005/request";
1249
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image-rle";
1250
- readonly task: "promptable image segmentation to RLE";
3134
+ readonly name: "TRELLIS 2";
3135
+ readonly outputKeys: ["model_glb"];
3136
+ readonly price: {
3137
+ readonly kind: "call";
3138
+ readonly usd: 0.3;
3139
+ };
3140
+ readonly pricing: "$0.30 at the default 1024p; $0.25 at 512p, $0.35 at 1536p";
3141
+ readonly queued: true;
3142
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/trellis-2";
3143
+ readonly task: "single-image 3D reconstruction";
1251
3144
  };
1252
- readonly "sam3-video": {
1253
- readonly category: "segmentation";
1254
- readonly defaultOptions: {
1255
- readonly apply_mask: true;
1256
- readonly detection_threshold: 0.5;
1257
- readonly prompt: "person";
1258
- readonly video_output_type: "X264 (.mp4)";
3145
+ readonly "got-ocr": {
3146
+ readonly category: "analysis";
3147
+ readonly description: "Transcribe text from one or more images, optionally as formatted multi-page output.";
3148
+ readonly endpoint: "fal-ai/got-ocr/v2";
3149
+ readonly inputField: "input_image_urls";
3150
+ readonly inputKind: "images";
3151
+ readonly name: "GOT-OCR 2.0";
3152
+ readonly outputKeys: ["outputs"];
3153
+ readonly price: {
3154
+ readonly kind: "metered";
1259
3155
  };
1260
- readonly description: "Segment and track prompted objects across video frames.";
1261
- readonly endpoint: "fal-ai/sam-3/video";
1262
- readonly inputField: "video_url";
1263
- readonly inputKind: "video";
1264
- readonly name: "SAM 3 Video";
1265
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
1266
- readonly pricing: "$0.005/16 frames";
1267
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video";
1268
- readonly task: "promptable video segmentation";
3156
+ readonly pricing: "$0.05/image";
3157
+ readonly queued: true;
3158
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/got-ocr/v2";
3159
+ readonly task: "optical character recognition";
1269
3160
  };
1270
- readonly "sam3-video-rle": {
1271
- readonly category: "segmentation";
1272
- readonly defaultOptions: {
1273
- readonly apply_mask: true;
1274
- readonly detection_threshold: 0.5;
1275
- readonly prompt: "person";
3161
+ readonly "moondream-caption": {
3162
+ readonly category: "analysis";
3163
+ readonly description: "Write a short, normal, or long caption for an image.";
3164
+ readonly endpoint: "fal-ai/moondream3-preview/caption";
3165
+ readonly inputField: "image_url";
3166
+ readonly inputKind: "image";
3167
+ readonly name: "Moondream 3 Caption";
3168
+ readonly outputKeys: ["output"];
3169
+ readonly price: {
3170
+ readonly kind: "metered";
1276
3171
  };
1277
- readonly description: "Track prompted video objects and return RLE mask data.";
1278
- readonly endpoint: "fal-ai/sam-3/video-rle";
1279
- readonly inputField: "video_url";
1280
- readonly inputKind: "video";
1281
- readonly name: "SAM 3 Video RLE";
1282
- readonly outputKeys: ["rle_masks", "metadata"];
1283
- readonly pricing: "$0.005/16 frames";
1284
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video-rle";
1285
- readonly task: "promptable video segmentation to RLE";
3172
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
3173
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/caption";
3174
+ readonly task: "image captioning";
1286
3175
  };
1287
- readonly "topaz-image": {
1288
- readonly category: "upscale";
1289
- readonly defaultOptions: {
1290
- readonly model: "Standard V2";
1291
- readonly output_format: "jpeg";
1292
- readonly upscale_factor: 2;
3176
+ readonly "moondream-detect": {
3177
+ readonly category: "analysis";
3178
+ readonly description: "Detect prompted objects and return their bounding boxes, with an optional preview.";
3179
+ readonly endpoint: "fal-ai/moondream3-preview/detect";
3180
+ readonly inputField: "image_url";
3181
+ readonly inputKind: "image";
3182
+ readonly name: "Moondream 3 Detect";
3183
+ readonly outputKeys: ["objects", "image"];
3184
+ readonly price: {
3185
+ readonly kind: "metered";
1293
3186
  };
1294
- readonly description: "Professional Topaz image enhancement and upscaling.";
1295
- readonly endpoint: "fal-ai/topaz/upscale/image";
3187
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
3188
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/detect";
3189
+ readonly task: "object detection";
3190
+ };
3191
+ readonly "moondream-point": {
3192
+ readonly category: "analysis";
3193
+ readonly description: "Return point coordinates for every instance of a prompted subject.";
3194
+ readonly endpoint: "fal-ai/moondream3-preview/point";
1296
3195
  readonly inputField: "image_url";
1297
3196
  readonly inputKind: "image";
1298
- readonly name: "Topaz Image Upscale";
1299
- readonly outputKeys: ["image"];
1300
- readonly pricing: "$0.08+ by output megapixels";
1301
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image";
1302
- readonly task: "image enhancement";
3197
+ readonly name: "Moondream 3 Point";
3198
+ readonly outputKeys: ["points", "image"];
3199
+ readonly price: {
3200
+ readonly kind: "metered";
3201
+ };
3202
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
3203
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/point";
3204
+ readonly task: "object pointing";
1303
3205
  };
1304
- readonly "topaz-video": {
1305
- readonly category: "upscale";
1306
- readonly defaultOptions: {
1307
- readonly model: "Proteus";
1308
- readonly upscale_factor: 2;
3206
+ readonly "moondream-query": {
3207
+ readonly category: "analysis";
3208
+ readonly description: "Answer a free-form question about an image, with reasoning.";
3209
+ readonly endpoint: "fal-ai/moondream3-preview/query";
3210
+ readonly inputField: "image_url";
3211
+ readonly inputKind: "image";
3212
+ readonly name: "Moondream 3 Query";
3213
+ readonly outputKeys: ["output", "reasoning"];
3214
+ readonly price: {
3215
+ readonly kind: "metered";
1309
3216
  };
1310
- readonly description: "Professional Topaz video enhancement and upscaling.";
1311
- readonly endpoint: "fal-ai/topaz/upscale/video";
1312
- readonly inputField: "video_url";
1313
- readonly inputKind: "video";
1314
- readonly name: "Topaz Video Upscale";
1315
- readonly outputKeys: ["video"];
1316
- readonly pricing: "$0.01-$0.08/sec by output resolution";
1317
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video";
1318
- readonly task: "video enhancement";
3217
+ readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
3218
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/query";
3219
+ readonly task: "visual question answering";
3220
+ };
3221
+ readonly nsfw: {
3222
+ readonly category: "moderation";
3223
+ readonly description: "Predict whether one or more images contain NSFW concepts.";
3224
+ readonly endpoint: "fal-ai/x-ailab/nsfw";
3225
+ readonly inputField: "image_urls";
3226
+ readonly inputKind: "images";
3227
+ readonly name: "NSFW Checker";
3228
+ readonly outputKeys: ["has_nsfw_concepts"];
3229
+ readonly price: {
3230
+ readonly kind: "metered";
3231
+ };
3232
+ readonly pricing: "$0.001/image";
3233
+ readonly sourceUrl: "https://fal.ai/models/fal-ai/x-ailab/nsfw";
3234
+ readonly task: "vision moderation";
1319
3235
  };
1320
3236
  };
1321
- declare const FAL_TOOLS_CHECKED_AT = "2026-05-12";
3237
+ declare const FAL_TOOLS_CHECKED_AT = "2026-08-23";
1322
3238
  declare const FAL_TOOL_IDS: (keyof typeof FAL_TOOLS)[];
1323
3239
  type FalToolId = (typeof FAL_TOOL_IDS)[number];
1324
3240
  declare function isFalToolId(tool: string): tool is FalToolId;
1325
3241
  declare function buildFalToolRequest(options: FalToolRunOptions): FalToolRequest;
1326
3242
 
1327
- export { ASPECT_RATIOS, type AspectRatio, type BackgroundMode, CREATIVE_FIELDS, CREATIVE_TAXONOMY, type CreativeDirection, type CreativeField, type CreativeOption, CreativeOptionError, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, EDIT_CAPABLE_MODELS, type EnrichPromptOptions, FAL_TOOLS, FAL_TOOLS_CHECKED_AT, FAL_TOOL_IDS, FORMAT_PRESETS, FalClient, type FalClientConfig, type FalImageSizePreset, type FalToolConfig, type FalToolId, type FalToolInputKind, type FalToolRequest, type FalToolRunOptions, GENERATION_MODELS, type GenerateOptions, type GenerationModelName, type GptImageSize, IDEOGRAM_STYLES, IMAGE_EDITING_TOP_20, IMAGE_TEXT_TO_IMAGE_TOP_20, type ImageOutputFormat, type ImageQuality, type ImageSize, type JobStatus, type LeaderboardEntry, type LeaderboardSnapshot, MODELS, type ModelConfig, type ModelType, type MotifEnv, MotifError, type MotifImage, type MotifResponse, type QueuedJob, RECRAFT_STYLES, RESOLUTIONS, type RemoveBackgroundOptions, type Resolution, type SizeMode, type ThinkingLevel, type ToolResponse, type ToolRunOptions, UTILITY_MODELS, type UpscaleOptions, VIDEO_IMAGE_TO_VIDEO_TOP_15, VIDEO_MODELS, VIDEO_TEXT_TO_VIDEO_TOP_15, type VideoOptions, type VideoResponse, aspectToFalImageSize, aspectToGptSize, buildFalToolRequest, buildGenerateBody, enrichPrompt, estimateCost, estimateVideoCost, getFalKeyFromEnv, isFalToolId, motifEnvSchema, parseMotifEnv, sanitizePrompt };
3243
+ /**
3244
+ * What a tool run costs, before it happens and after.
3245
+ *
3246
+ * The registry's `price` is a rate, not a total. Turning a rate into a figure
3247
+ * needs something only one of the two moments has:
3248
+ *
3249
+ * - Before the call, a `call` price is the whole answer and nothing else is.
3250
+ * A per-megapixel rate depends on an output that does not exist yet.
3251
+ * - After the call, the output exists and has been measured, so a
3252
+ * per-megapixel rate resolves exactly. Most of the restoration suite is
3253
+ * priced this way, which means most of what looked unknowable at dry-run
3254
+ * time is knowable by the time it reaches history.
3255
+ *
3256
+ * Both functions return `null` rather than `0` where the figure is genuinely
3257
+ * unavailable. Zero is a claim that something was free, and every price defect
3258
+ * found in this registry has been a confident wrong number rather than an
3259
+ * absent one.
3260
+ */
3261
+
3262
+ /** Pixel dimensions of one file an endpoint returned. */
3263
+ interface OutputDimensions {
3264
+ height?: number;
3265
+ width?: number;
3266
+ }
3267
+ /** A cost, and enough context for a caller to say why it is what it is. */
3268
+ interface ResolvedCost {
3269
+ /** USD, or null when the rate cannot be resolved against what we know. */
3270
+ usd: number | null;
3271
+ /**
3272
+ * Whether `usd` was measured from real output or projected from the rate
3273
+ * alone. Callers that display a figure should say which; an estimate and a
3274
+ * bill are not the same claim.
3275
+ */
3276
+ basis: "measured" | "projected" | "unknown";
3277
+ }
3278
+ /**
3279
+ * The figure to show before a run, from the rate alone.
3280
+ *
3281
+ * Only a flat per-call price survives this: everything else depends on an
3282
+ * output that does not exist yet, and guessing its size is how a dry run comes
3283
+ * to promise a number the invoice contradicts.
3284
+ */
3285
+ declare function projectedToolCost(price: FalToolPrice): ResolvedCost;
3286
+ /**
3287
+ * The figure to record after a run, from the rate and the output it produced.
3288
+ *
3289
+ * A per-megapixel rate becomes exact here, because the files have been written
3290
+ * and measured. Per-second rates need a duration nothing in the image path
3291
+ * carries, and metered endpoints publish no rate at all, so both stay unknown.
3292
+ */
3293
+ declare function measuredToolCost(price: FalToolPrice, outputs: readonly OutputDimensions[]): ResolvedCost;
3294
+ /**
3295
+ * Render a cost for a human. `null` never becomes "$0.000" - it says what it
3296
+ * means, which is that nobody knows.
3297
+ */
3298
+ declare function formatCost(usd: number | null): string;
3299
+ /**
3300
+ * Sum costs that are known, and count the ones that are not.
3301
+ *
3302
+ * A running total that silently drops unknown runs reads as complete. Callers
3303
+ * are expected to show both halves: "$1.23 plus 4 metered runs" is honest where
3304
+ * "$1.23" is not.
3305
+ */
3306
+ declare function sumCosts(costs: readonly (number | null)[]): {
3307
+ known: number;
3308
+ unknown: number;
3309
+ };
3310
+
3311
+ /** One argument an endpoint accepts. */
3312
+ interface FalToolParameter {
3313
+ /** Argument name, exactly as fal expects it in the request body. */
3314
+ key: string;
3315
+ /** fal's own default when the caller sends nothing. */
3316
+ fallback?: boolean | number | string | readonly unknown[];
3317
+ /** Whether fal rejects the request without it. */
3318
+ required?: true;
3319
+ /** Compact rendering of fal's declared type, e.g. `enum(a|b)`, `list[string]`. */
3320
+ type: string;
3321
+ }
3322
+ declare const FAL_TOOL_PARAMETERS: Record<string, readonly FalToolParameter[]>;
3323
+ /** Arguments a tool accepts, including ones Motif does not surface as flags. */
3324
+ declare function falToolParameters(tool: string): readonly FalToolParameter[];
3325
+
3326
+ interface ModelOutputShape {
3327
+ /** File container the endpoint returns. */
3328
+ container: string;
3329
+ /** Whether the encoding preserves every pixel exactly. */
3330
+ lossless: boolean;
3331
+ /** Bits per channel. */
3332
+ bitDepth?: number;
3333
+ /** Whether the returned file carries an alpha channel. */
3334
+ hasAlpha?: boolean;
3335
+ /** JPEG chroma subsampling, e.g. "4:4:4" or "4:2:0". Absent for lossless containers. */
3336
+ subsampling?: string;
3337
+ }
3338
+ declare const MODEL_OUTPUT: Record<string, ModelOutputShape>;
3339
+
3340
+ /**
3341
+ * What a model returns, and whether you can get something lossless out of it.
3342
+ *
3343
+ * Two facts live in different places and neither is useful alone:
3344
+ *
3345
+ * - `MODEL_OUTPUT` (generated, measured from real bytes) says what arrives
3346
+ * when you ask for nothing.
3347
+ * - `supportsOutputFormat` on the model says whether you are allowed to ask
3348
+ * for something else.
3349
+ *
3350
+ * A caller who reads only the first concludes `flux2-pro` is lossy; it defaults
3351
+ * to JPEG but returns PNG on request. A caller who reads only the second
3352
+ * concludes `seedream5` is fine; the flag is false, and what that actually
3353
+ * means is 4:2:0 chroma - averaged over 2x2 blocks, invisible in a photograph
3354
+ * and destructive to anything dividing by alpha at a soft edge.
3355
+ *
3356
+ * So the answer is derived from both at read time rather than written down a
3357
+ * third time. Every price and output-key defect in this registry came from one
3358
+ * fact stored twice.
3359
+ */
3360
+
3361
+ /** Whether a lossless file can be obtained, and what it costs to ask. */
3362
+ type LosslessAvailability =
3363
+ /** Lossless by default; ask for nothing. */
3364
+ "default"
3365
+ /** Lossy by default, lossless when `outputFormat` is set. */
3366
+ | "on-request"
3367
+ /** No lossless route: the endpoint returns a lossy container and rejects the argument. */
3368
+ | "unavailable"
3369
+ /** Not probed. Absence of evidence, not evidence of a limitation. */
3370
+ | "unknown";
3371
+ /** Measured shape of what a model returns by default, if it has been probed. */
3372
+ declare function modelOutput(model: string): ModelOutputShape | undefined;
3373
+ /**
3374
+ * Whether this model can produce a lossless file at all.
3375
+ *
3376
+ * The question a caller actually has, answered from the measured default and
3377
+ * the accepted arguments together.
3378
+ */
3379
+ declare function losslessAvailability(model: string): LosslessAvailability;
3380
+ /**
3381
+ * One line a human or an agent can act on, e.g.
3382
+ * `"jpeg 4:2:0, no lossless route"` or `"jpeg 4:4:4, PNG on request"`.
3383
+ */
3384
+ declare function describeModelOutput(model: string): string;
3385
+
3386
+ export { ASPECT_RATIOS, type AspectRatio, type BackgroundMode, CREATIVE_FIELDS, CREATIVE_TAXONOMY, type CreativeDirection, type CreativeField, type CreativeOption, CreativeOptionError, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, EDIT_CAPABLE_MODELS, type EnrichPromptOptions, FAL_TOOLS, FAL_TOOLS_CHECKED_AT, FAL_TOOL_IDS, FAL_TOOL_PARAMETERS, FORMAT_PRESETS, FalClient, type FalClientConfig, type FalImageSizePreset, type FalToolConfig, type FalToolId, type FalToolInputKind, type FalToolParameter, type FalToolPrice, type FalToolRequest, type FalToolRunOptions, GENERATION_MODELS, type GenerateOptions, type GenerationModelName, type GptImageSize, IDEOGRAM_STYLES, IMAGE_EDITING_TOP_20, IMAGE_TEXT_TO_IMAGE_TOP_20, type ImageOutputFormat, type ImageQuality, type ImageSize, type JobStatus, type LeaderboardEntry, type LeaderboardSnapshot, type LosslessAvailability, MODELS, MODEL_OUTPUT, type ModelConfig, type ModelOutputShape, type ModelType, type MotifEnv, MotifError, type MotifImage, type MotifResponse, type OutputDimensions, type QueuedJob, type QueuedToolJob, RECRAFT_STYLES, RESOLUTIONS, type RemoveBackgroundOptions, type Resolution, type ResolvedCost, type SizeMode, type ThinkingLevel, type ToolResponse, type ToolRunOptions, UTILITY_MODELS, type UpscaleOptions, VIDEO_IMAGE_TO_VIDEO_TOP_15, VIDEO_MODELS, VIDEO_TEXT_TO_VIDEO_TOP_15, type VideoOptions, type VideoResponse, aspectToFalImageSize, aspectToGptSize, buildFalToolRequest, buildGenerateBody, describeModelOutput, enrichPrompt, estimateCost, estimateVideoCost, falToolParameters, formatCost, getFalKeyFromEnv, isFalToolId, losslessAvailability, measuredToolCost, modelOutput, motifEnvSchema, parseMotifEnv, projectedToolCost, sanitizePrompt, sumCosts };