@howells/motif-sdk 2.0.0 → 4.0.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.ts CHANGED
@@ -4,10 +4,11 @@ import { z } from "zod";
4
4
  /**
5
5
  * Creative direction fields applied to prompts in Motif's canonical order.
6
6
  *
7
- * The order matters when multiple fields are selected because prompt clauses
8
- * are appended in this sequence for stable dry runs, tests, and history.
7
+ * A look sets the overall register of the image; a mood sets its light. The
8
+ * order matters because clauses are appended look first, then mood, for
9
+ * stable dry runs, tests, and history.
9
10
  */
10
- type CreativeField = "recipe" | "shot" | "lighting" | "genre" | "camera" | "color" | "material" | "motion";
11
+ type CreativeField = "look" | "mood";
11
12
  /**
12
13
  * Selected creative option ids keyed by direction field.
13
14
  *
@@ -17,7 +18,7 @@ type CreativeField = "recipe" | "shot" | "lighting" | "genre" | "camera" | "colo
17
18
  type CreativeDirection = Partial<Record<CreativeField, string>>;
18
19
  /** A single selectable creative direction option exposed to CLI and MCP schemas. */
19
20
  interface CreativeOption {
20
- /** Prompt fragment appended when this option is selected. */
21
+ /** Prompt sentence appended when this option is selected. */
21
22
  clause: string;
22
23
  /** Human-facing explanation used in schema metadata and generated docs. */
23
24
  description: string;
@@ -26,6 +27,26 @@ interface CreativeOption {
26
27
  /** Short display label for UIs and schema enum descriptions. */
27
28
  label: string;
28
29
  }
30
+ /**
31
+ * A house look: a creative option that also carries the aspect ratio and
32
+ * model it was tuned for. Callers apply these only when the user named none.
33
+ */
34
+ interface LookOption extends CreativeOption {
35
+ /**
36
+ * Whether a mood may be combined with this look. Flat looks (surfaces,
37
+ * prints, paintings, studio objects) carry their own light and refuse one.
38
+ */
39
+ acceptsMood: boolean;
40
+ /** Default aspect ratio, e.g. `"3:2"`. */
41
+ aspect: AspectRatio;
42
+ /**
43
+ * Marks a look still being tuned. It works, but its text and defaults may
44
+ * change more than the others.
45
+ */
46
+ experimental?: boolean;
47
+ /** Default generation Model id, e.g. `"flux2-pro"`. */
48
+ model: string;
49
+ }
29
50
  /** Structured details returned when a creative direction id is not recognized. */
30
51
  interface CreativeOptionErrorDetails {
31
52
  availableIds: string[];
@@ -44,66 +65,160 @@ export declare class CreativeOptionError extends Error implements CreativeOption
44
65
  readonly code = "INVALID_OPTION";
45
66
  readonly field: CreativeField;
46
67
  readonly value: string;
47
- constructor(details: Omit<CreativeOptionErrorDetails, "code">);
68
+ constructor(details: Omit<CreativeOptionErrorDetails, "code">, message?: string);
48
69
  }
49
70
  /** Canonical creative field order used for prompt enrichment and schema output. */
50
- export declare const CREATIVE_FIELDS: readonly ["recipe", "shot", "lighting", "genre", "camera", "color", "material", "motion"];
71
+ export declare const CREATIVE_FIELDS: readonly ["look", "mood"];
51
72
  /**
52
- * Built-in creative direction catalog.
73
+ * Built-in creative direction catalogue: twelve house looks and six light moods.
53
74
  *
54
- * Each field contains the option ids accepted by `CreativeDirection` and the
55
- * exact prompt clause that will be appended when selected.
75
+ * Each option carries the exact prompt sentence appended when it is selected.
76
+ * Looks also carry the aspect ratio and model they were tuned for.
56
77
  */
57
78
  export declare const CREATIVE_TAXONOMY: {
58
- readonly camera: readonly [{
59
- readonly clause: "macro product photography with crisp surface detail";
60
- readonly description: "Product-oriented macro camera language for close detail.";
61
- readonly id: "macro-product";
62
- readonly label: "Macro product";
79
+ readonly look: readonly [{
80
+ readonly acceptsMood: true;
81
+ readonly aspect: "1:1";
82
+ readonly clause: "Editorial photograph in the register of Atelier Ellis, Aman hotels, Kinfolk magazine and Aesop, pigment-rich mineral colour on named matte surfaces, quiet composition with generous negative space, shallow depth of field, shot on film with fine grain, restrained and materially rich. No text, no logos, no people";
83
+ readonly description: "Quiet, materially rich editorial photography for brand and mood imagery.";
84
+ readonly id: "editorial";
85
+ readonly label: "Quiet editorial";
86
+ readonly model: "flux2-pro";
87
+ }, {
88
+ readonly acceptsMood: true;
89
+ readonly aspect: "1:1";
90
+ readonly clause: "Editorial still life on a warm bone plaster ground, chalky unglazed surfaces, a long soft shadow, generous empty space, shot on film with fine grain. No text, no logos, no people";
91
+ readonly description: "Objects and material samples on a plaster ground, for product and swatch shots.";
92
+ readonly id: "still-life";
93
+ readonly label: "Material still life";
94
+ readonly model: "flux2-pro";
95
+ }, {
96
+ readonly acceptsMood: true;
97
+ readonly aspect: "3:2";
98
+ readonly clause: "Interior photograph shot square-on at eye level on a 35mm lens, warm off-white plaster, wide oak floorboards, linen, brass and a little pattern, light, bright and layered, collected rather than styled, slightly imperfect and lived-in rather than showroom-perfect, photographic realism. No text, no logos, no people";
99
+ readonly description: "Bright, collected rooms that feel lived in, for interior scenes.";
100
+ readonly id: "lived-in";
101
+ readonly label: "Lived-in interior";
102
+ readonly model: "flux2-pro";
103
+ }, {
104
+ readonly acceptsMood: true;
105
+ readonly aspect: "4:5";
106
+ readonly clause: "Architectural editorial photograph at full room scale, honest materials meeting precise detailing, one hero element genuinely installed, plausible light and shadow, generous negative space, empty of people. No text, no logos";
107
+ readonly description: "Whole rooms with one product installed, for showing a material at scale.";
108
+ readonly id: "architectural";
109
+ readonly label: "Architectural scale";
110
+ readonly model: "banana";
111
+ }, {
112
+ readonly acceptsMood: true;
113
+ readonly aspect: "4:3";
114
+ readonly clause: "Amateur phone photo of a real home taken by the homeowner, slightly wonky framing, unstyled domestic photography, ordinary exposure. No text, no people";
115
+ readonly description: "Unstyled phone snapshots of real homes, for believable before and after shots.";
116
+ readonly id: "homeowner";
117
+ readonly label: "Homeowner snapshot";
118
+ readonly model: "seedream45";
119
+ }, {
120
+ readonly acceptsMood: true;
121
+ readonly aspect: "1:1";
122
+ readonly clause: "Stylised architectural illustration of the room, colour laid as flat planes on walls, joinery and trim, fine hand-drawn line with a gentle gouache wash, clearly a drawing of a design decision rather than a photograph. No text, no people";
123
+ readonly description: "Line and gouache room drawings, for showing a colour scheme as a design idea.";
124
+ readonly experimental: true;
125
+ readonly id: "drawing";
126
+ readonly label: "Palette drawing";
127
+ readonly model: "gpt2";
128
+ }, {
129
+ readonly acceptsMood: false;
130
+ readonly aspect: "1:1";
131
+ readonly clause: "Straight-on orthographic photograph of the surface filling the entire frame edge to edge, even shadowless studio light, crisp macro texture, colour-accurate. No text, no logos";
132
+ readonly description: "Flat, edge-to-edge surface photographs, for textures and material swatches.";
133
+ readonly id: "plate";
134
+ readonly label: "Flat plate";
135
+ readonly model: "flux2-pro";
136
+ }, {
137
+ readonly acceptsMood: false;
138
+ readonly aspect: "1:1";
139
+ readonly clause: "Fine hand-engraved botanical plate with delicate hatching and dry brush, grey ink only, reaching near-black at its densest, on matte uncoated stock under flat even light, cropped mid-motif and running past all four edges, never simplified or cartoonish. No text";
140
+ readonly description: "Grey-ink botanical engravings that run off the edges, for patterns and backgrounds.";
141
+ readonly id: "engraved";
142
+ readonly label: "Engraved grey ink";
143
+ readonly model: "gpt2";
144
+ }, {
145
+ readonly acceptsMood: false;
146
+ readonly aspect: "2:3";
147
+ readonly clause: "Tightly cropped photograph of a single piece of late-1940s American printed matter, flat and square-on in even light, every pixel paper, letterpress and wood type, sun-faded ink, foxing, soft creases and thumbtack holes, era-correct typography, nothing that looks like a digital photo run through a filter";
148
+ readonly description: "Aged mid-century printed matter such as posters and cards, where the lettering matters.";
149
+ readonly id: "ephemera";
150
+ readonly label: "Period ephemera";
151
+ readonly model: "ideogram4";
152
+ }, {
153
+ readonly acceptsMood: false;
154
+ readonly aspect: "3:4";
155
+ readonly clause: "Physical mineral pigment and chalk gesso on coarse natural linen, two or three confident gestures, warm ivory, oatmeal, putty and soft charcoal, flat diffuse museum reproduction lighting, shown unframed. No text";
156
+ readonly description: "Loose abstract paintings on linen, for wall art and calm backgrounds.";
157
+ readonly id: "canvas";
158
+ readonly label: "Linen abstract";
159
+ readonly model: "banana";
160
+ }, {
161
+ readonly acceptsMood: true;
162
+ readonly aspect: "1:1";
163
+ readonly clause: "Editorial documentary portrait, muted warm palette, waist-up, unposed, plain clothing with no logos. No text";
164
+ readonly description: "Natural, unposed documentary portraits of people. Pair with a mood for the light.";
165
+ readonly id: "portrait";
166
+ readonly label: "Documentary portrait";
167
+ readonly model: "seedream45";
168
+ }, {
169
+ readonly acceptsMood: false;
170
+ readonly aspect: "1:1";
171
+ readonly clause: "A single matte object centred with generous empty space, soft diffused studio light, minimal and quiet, one committed colour. No text, no logos, no people";
172
+ readonly description: "One object in one colour on a clean ground, for icons and simple product shots.";
173
+ readonly id: "object";
174
+ readonly label: "Studio object";
175
+ readonly model: "flux2-pro";
63
176
  }];
64
- readonly color: readonly [{
65
- readonly clause: "monochrome palette with tonal contrast";
66
- readonly description: "Black-and-white or single-channel tonal treatment.";
67
- readonly id: "monochrome";
68
- readonly label: "Monochrome";
69
- }];
70
- readonly genre: readonly [{
71
- readonly clause: "film noir mood with high contrast shadows";
72
- readonly description: "High-contrast cinematic mood with shadow-forward drama.";
73
- readonly id: "film-noir";
74
- readonly label: "Film noir";
75
- }];
76
- readonly lighting: readonly [{
77
- readonly clause: "rim lighting with defined edge highlights";
78
- readonly description: "Back or side light that separates the subject edge.";
79
- readonly id: "rim";
80
- readonly label: "Rim";
81
- }];
82
- readonly material: readonly [{
83
- readonly clause: "reflective material surfaces with controlled highlights";
84
- readonly description: "Emphasizes reflections and highlight control on surfaces.";
85
- readonly id: "reflective";
86
- readonly label: "Reflective";
87
- }];
88
- readonly motion: readonly [{
89
- readonly clause: "still composition with no motion blur";
90
- readonly description: "Freezes the subject without implied movement.";
91
- readonly id: "still";
92
- readonly label: "Still";
93
- }];
94
- readonly recipe: readonly [{
95
- readonly clause: "cinematic scene";
96
- readonly description: "Frames the prompt as a cinematic still or scene.";
97
- readonly id: "cinematic";
98
- readonly label: "Cinematic";
99
- }];
100
- readonly shot: readonly [{
101
- readonly clause: "close-up composition with controlled depth of field";
102
- readonly description: "Tight framing that emphasizes subject detail.";
103
- readonly id: "close-up";
104
- readonly label: "Close-up";
177
+ readonly mood: readonly [{
178
+ readonly clause: "soft natural daylight from a window out of frame, gentle falloff into the corners, low contrast, even diffused light with soft, held highlights";
179
+ readonly description: "Soft, even daylight from a window. The safe default.";
180
+ readonly id: "window";
181
+ readonly label: "Window light";
182
+ }, {
183
+ readonly clause: "early morning light through tall glazing, cool and clear";
184
+ readonly description: "Cool, clear early morning light.";
185
+ readonly id: "dawn";
186
+ readonly label: "Dawn";
187
+ }, {
188
+ readonly clause: "low raking daylight from the left, long soft shadows that reveal texture";
189
+ readonly description: "Low side light that brings out surface texture.";
190
+ readonly id: "raking";
191
+ readonly label: "Raking light";
192
+ }, {
193
+ readonly clause: "overcast afternoon with rain on a tall window, soft even grey light";
194
+ readonly description: "Soft grey light on a rainy afternoon.";
195
+ readonly id: "overcast";
196
+ readonly label: "Overcast";
197
+ }, {
198
+ readonly clause: "evening, warm practical lamps around 2400K, candles and a lit fire, cosy and warm, never gloomy";
199
+ readonly description: "Warm evening light from lamps, candles and a fire.";
200
+ readonly id: "lamplit";
201
+ readonly label: "Lamplit evening";
202
+ }, {
203
+ readonly clause: "night, one warm low practical light, deep shadow, candlelit";
204
+ readonly description: "Dark night scene lit by one warm low light.";
205
+ readonly id: "nocturne";
206
+ readonly label: "Nocturne";
105
207
  }];
106
208
  };
209
+ /** Every house look, in catalogue order. */
210
+ export declare const LOOKS: readonly LookOption[];
211
+ /** Stable id of a house look, e.g. `"lived-in"`. */
212
+ type LookId = (typeof CREATIVE_TAXONOMY.look)[number]["id"];
213
+ /** Stable id of a light mood, e.g. `"overcast"`. */
214
+ type MoodId = (typeof CREATIVE_TAXONOMY.mood)[number]["id"];
215
+ /**
216
+ * Look up a house look by id.
217
+ *
218
+ * Returns `undefined` for unknown ids; `enrichPrompt` is the validating path
219
+ * and throws `CreativeOptionError` for the same input.
220
+ */
221
+ export declare function getLook(id: string): LookOption | undefined;
107
222
  /** Result of applying creative direction to a base prompt. */
108
223
  interface CreativePromptResult {
109
224
  /** Sanitized user prompt before Motif adds creative clauses. */
@@ -131,10 +246,21 @@ interface EnrichPromptOptions {
131
246
  */
132
247
  export declare function sanitizePrompt(prompt: string): string;
133
248
  /**
134
- * Append selected creative direction clauses to a prompt.
249
+ * Validate a creative direction and return its clauses in canonical order.
135
250
  *
136
- * Options are validated against `CREATIVE_TAXONOMY`, applied in
137
- * `CREATIVE_FIELDS` order, and returned as metadata alongside the final prompt.
251
+ * Throws `CreativeOptionError` for an unknown id, and for a mood paired with a
252
+ * look whose `acceptsMood` is false; that error is on field `mood` and its
253
+ * `availableIds` lists the looks that do accept a mood. A mood with no look is
254
+ * valid. Empty-string ids are treated as unset.
255
+ */
256
+ export declare function validateCreativeDirection(creative: CreativeDirection | undefined): CreativePromptResult["creative"];
257
+ /**
258
+ * Append selected creative direction clauses to a prompt as sentences.
259
+ *
260
+ * Options are validated by `validateCreativeDirection` and applied in
261
+ * `CREATIVE_FIELDS` order (look, then mood). The base prompt comes first; each
262
+ * part loses any trailing period and gets a capital first letter, then they
263
+ * are joined with `". "` and closed with a period. With no clauses the sanitized prompt is returned unchanged.
138
264
  */
139
265
  export declare function enrichPrompt(options: EnrichPromptOptions): CreativePromptResult;
140
266
  //#endregion
@@ -142,286 +268,40 @@ export declare function enrichPrompt(options: EnrichPromptOptions): CreativeProm
142
268
  /** ─── Model Types ─────────────────────────────────────────────── */
143
269
  type AspectRatio = "auto" | "8:1" | "4:1" | "21:9" | "16:9" | "3:2" | "4:3" | "5:4" | "1:1" | "4:5" | "3:4" | "2:3" | "9:16" | "1:4" | "1:8";
144
270
  type Resolution = "0.5K" | "1K" | "2K" | "4K";
145
- type ModelType = "generation" | "utility" | "video";
146
271
  type ImageOutputFormat = "jpeg" | "png" | "webp";
147
- type BackgroundMode = "auto" | "transparent" | "opaque";
148
- type ImageQuality = "auto" | "low" | "medium" | "high" | "xhigh" | "max";
149
- type ThinkingLevel = "minimal" | "high";
150
- type GptImageSize = "auto" | "1024x1024" | "1536x1024" | "1024x1536";
151
- type FalImageSizePreset = "auto" | "square_hd" | "square" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9";
152
272
  interface CustomImageSize {
153
273
  height: number;
154
274
  width: number;
155
275
  }
156
- type ImageSize = GptImageSize | FalImageSizePreset | CustomImageSize;
157
- /** How the model accepts image dimensions */
158
- type SizeMode = "aspect_ratio" | "image_size_enum" | "gpt_size" | "none";
159
- type QualityTier = "good" | "better" | "best" | "frontier";
160
- type SpeedTier = "fast" | "balanced" | "slow" | "very_slow" | "unknown";
161
- type PriceTier = "budget" | "standard" | "premium" | "ultra" | "variable";
162
- interface FalPricing {
163
- checkedAt: string;
164
- currency: "USD";
165
- endpointId: string;
166
- estimatedCostPerImageUsd?: number;
167
- source: "fal-pricing-api";
168
- unit: string;
169
- unitPrice: number;
170
- }
171
- interface LeaderboardMetric {
172
- elo: number;
173
- rank: number;
174
- winRate?: number;
175
- }
176
- interface ModelBenchmark {
177
- artificialAnalysis?: {
178
- editing?: LeaderboardMetric;
179
- sourceUrls: string[];
180
- snapshotDate: string;
181
- textToImage?: LeaderboardMetric;
182
- };
183
- speed?: {
184
- medianSeconds?: number;
185
- p95Seconds?: number;
186
- source: "artificial-analysis-models";
187
- };
188
- tiers?: {
189
- price: PriceTier;
190
- quality: QualityTier;
191
- speed: SpeedTier;
192
- };
193
- useCase?: string;
194
- }
195
- interface ModelConfig {
196
- benchmark?: ModelBenchmark;
197
- editEndpoint?: string;
198
- editImagesField?: "image_urls" | "image_url";
199
- endpoint: string;
200
- falPricing?: FalPricing;
201
- maxReferenceImages?: number;
202
- name: string;
203
- pricing: string;
204
- /** Null means token-metered with no per-image estimate. */
205
- pricePerImageUsd?: number | null;
206
- /** How this model accepts dimensions (default: "aspect_ratio") */
207
- sizeMode?: SizeMode;
208
- supportsAspect: boolean;
209
- supportsBackground?: boolean;
210
- supportsEdit: boolean;
211
- supportsEnhancePrompt?: boolean;
212
- supportsExpandPrompt?: boolean;
213
- supportsGuidanceScale?: boolean;
214
- supportsGoogleSearch?: boolean;
215
- supportsImagePromptStrength?: boolean;
216
- supportsInferenceSteps?: boolean;
217
- supportsLimitGenerations?: boolean;
218
- supportsMaskImage?: boolean;
219
- maskImageField?: "mask_image_url" | "mask_url";
220
- supportsNegativePrompt?: boolean;
221
- supportsNumImages: boolean;
222
- supportsOutputFormat?: boolean;
223
- supportedOutputFormats?: readonly ImageOutputFormat[];
224
- supportsQuality?: boolean;
225
- supportedQualities?: readonly ImageQuality[];
226
- supportsRaw?: boolean;
227
- supportsRenderingSpeed?: boolean;
228
- supportsResolution: boolean;
229
- supportsSafetyTolerance?: boolean;
230
- supportsSafetyChecker?: boolean;
231
- supportsSeed?: boolean;
232
- supportsStyle?: boolean;
233
- supportsSyncMode?: boolean;
234
- supportsThinkingLevel?: boolean;
235
- supportsWebSearch?: boolean;
236
- type: ModelType;
237
- /** Use fal queue submit/status/result even for generate() calls. */
238
- useQueue?: boolean;
239
- }
240
- /** ─── Generation Types ───────────────────────────────────────── */
241
- interface GenerateOptions {
242
- aspect?: AspectRatio;
243
- /** GPT background mode where supported */
244
- background?: BackgroundMode;
245
- /**
246
- * Motif prompt enrichment choices applied before fal request construction.
247
- *
248
- * These options are not sent to fal directly; they append validated creative
249
- * clauses to `prompt` and are omitted from the final request body.
250
- */
251
- creative?: CreativeDirection;
252
- editImageUrls?: string[];
253
- /** Ask fal not to store IO payloads, and expose request ids for deletion. */
254
- ephemeral?: boolean;
255
- /** Google-search alias for fal models that expose enable_google_search */
256
- enableGoogleSearch?: boolean;
257
- /** fal safety checker toggle where supported */
258
- enableSafetyChecker?: boolean;
259
- /** Enable web search for generative context where supported */
260
- enableWebSearch?: boolean;
261
- /** Auto-enhance the prompt before generation (flux only) */
262
- enhancePrompt?: boolean;
263
- /** Enable MagicPrompt expansion (ideogram only) */
264
- expandPrompt?: boolean;
265
- /** CFG guidance scale — flux-fast: 1–20 */
266
- guidanceScale?: number;
267
- /** Direct fal image_size override, including custom {width,height} where supported */
268
- imageSize?: ImageSize;
269
- /** FLUX image prompt/reference strength where supported */
270
- imagePromptStrength?: number;
271
- inputFidelity?: "low" | "high";
272
- /** Nano Banana 2 generation limiting toggle */
273
- limitGenerations?: boolean;
274
- /** Mask image URL for inpainting/editing where supported */
275
- maskImageUrl?: string;
276
- model: string;
277
- /** What NOT to include in the image (ideogram only) */
278
- negativePrompt?: string;
279
- numImages?: number;
280
- /** Number of diffusion inference steps — flux-fast: 1–12 */
281
- numInferenceSteps?: number;
282
- /** Output image format (default: model-dependent) */
283
- outputFormat?: ImageOutputFormat;
284
- prompt: string;
285
- /** GPT/OpenAI quality where supported */
286
- quality?: ImageQuality;
287
- /** Generate less processed, more natural images (flux only) */
288
- raw?: boolean;
289
- /** Speed vs. quality trade-off (ideogram only) */
290
- renderingSpeed?: "TURBO" | "BALANCED" | "QUALITY";
291
- resolution?: Resolution;
292
- /** Safety tolerance level "1"–"6", where "1" is strictest */
293
- safetyTolerance?: string;
294
- /** Reproducible generation seed */
295
- seed?: number;
296
- /** Style preset — recraft: 70+ hierarchical styles; ideogram: "AUTO"|"GENERAL"|"REALISTIC"|"DESIGN" */
297
- style?: string;
298
- /** Return media as data URI where supported */
299
- syncMode?: boolean;
300
- /** Nano Banana 2 thinking mode */
301
- thinkingLevel?: ThinkingLevel;
302
- transparent?: boolean;
303
- }
304
- interface UpscaleOptions {
305
- creativity?: number;
306
- /** CFG guidance scale for upscaling (clarity only, 0–20, default 4) */
307
- guidanceScale?: number;
308
- imageUrl: string;
309
- model?: "clarity" | "crystal";
310
- /** What NOT to include in the upscaled result (clarity only) */
311
- negativePrompt?: string;
312
- /** Number of diffusion steps (clarity only, 4–50, default 18) */
313
- numInferenceSteps?: number;
314
- /** Prompt to guide the upscaling process (clarity only) */
315
- prompt?: string;
316
- /** How closely to preserve the original image (clarity only, 0–1, default 0.6) */
317
- resemblance?: number;
318
- scaleFactor?: number;
319
- }
320
- interface RemoveBackgroundOptions {
321
- imageUrl: string;
322
- model?: "rmbg" | "bria";
323
- /** BiRefNet operating resolution (rmbg model only, default "1024x1024") */
324
- operatingResolution?: "1024x1024" | "2048x2048";
325
- /** Output image format (rmbg model only) */
326
- outputFormat?: "png" | "webp" | "gif";
327
- /** Return the alpha mask alongside the result (rmbg model only) */
328
- outputMask?: boolean;
329
- /** Apply foreground edge refinement (rmbg model only, default true) */
330
- refineForeground?: boolean;
331
- /** BiRefNet model variant (rmbg model only) */
332
- variant?: "General Use (Light)" | "General Use (Heavy)" | "Portrait";
333
- }
334
- interface VideoOptions {
335
- /** CFG guidance scale for video generation (0–1, default 0.5) */
336
- cfgScale?: number;
337
- /** Duration in seconds (3-15) */
338
- duration?: number;
339
- /** Optional end frame image URL */
340
- endImageUrl?: string;
341
- /** Generate audio track (default true, costs more) */
342
- generateAudio?: boolean;
343
- /** Source image URL */
344
- imageUrl: string;
345
- /** What NOT to include in the video */
346
- negativePrompt?: string;
347
- /** Text description of the motion/scene */
348
- prompt: string;
349
- }
350
- interface VideoResponse {
351
- contentType: string;
352
- fileName: string;
353
- fileSize: number;
354
- url: string;
355
- }
356
- interface ToolRunOptions {
357
- input?: string;
358
- inputs?: string[];
359
- options?: Record<string, unknown>;
360
- tool: string;
361
- }
362
- type ToolResponse = Record<string, unknown>;
363
- /** ─── Response Types ─────────────────────────────────────────── */
364
- interface MotifImage {
365
- content_type?: string;
366
- height?: number;
367
- url: string;
368
- width?: number;
369
- }
370
- interface MotifResponse {
371
- images: MotifImage[];
372
- prompt?: string;
373
- requestId?: string;
374
- seed?: number;
375
- }
376
- /** ─── Queue Types ────────────────────────────────────────────── */
377
- interface QueuedJob {
378
- endpoint: string;
379
- estimatedCost: number | null;
380
- requestId: string;
381
- }
382
- interface JobStatus {
383
- error?: string;
384
- logs?: {
385
- message: string;
386
- timestamp: string;
387
- }[];
388
- queuePosition?: number;
389
- status: "queued" | "processing" | "completed" | "failed";
390
- }
391
- /**
392
- * A tool run accepted by the fal queue.
393
- *
394
- * Returned by `FalClient.submitTool`, and the handle passed back to
395
- * `checkToolStatus` / `getToolResult`. The job itself carries no cost: the
396
- * rate lives on the registry entry as `FalToolConfig.price`, and for a queued
397
- * endpoint it is usually per-megapixel or metered, so the final cost is only
398
- * known once the result is in.
399
- */
400
- interface QueuedToolJob {
401
- endpoint: string;
402
- requestId: string;
276
+ /** Limits an endpoint puts on an exact `{ width, height }` image size. */
277
+ interface ImageSizeBounds {
278
+ /** Largest width or height over smallest, e.g. 3 for 3:1. */
279
+ maxRatio?: number;
280
+ maxEdge?: number;
281
+ maxPixels?: number;
282
+ minEdge?: number;
283
+ minPixels?: number;
284
+ /** Both edges must be multiples of this. Motif uses 16 when absent. */
285
+ multipleOf?: number;
403
286
  }
404
287
  /** ─── Configuration ──────────────────────────────────────────── */
405
- interface FalClientConfig {
406
- apiKey: string;
407
- /** Max retry attempts for 429/5xx errors (default 3, set 0 to disable) */
408
- retries?: number;
409
- /** Request timeout in ms (default 120_000) */
410
- timeout?: number;
411
- }
288
+ /** The network seam: a `fetch`-shaped function. */
289
+ type FalFetch = (url: string, init: RequestInit) => Promise<Response>;
412
290
  //#endregion
413
291
  //#region src/aspects.d.ts
414
292
  /** Ordered by popularity: square first, then common ratios */
415
293
  export declare const ASPECT_RATIOS: AspectRatio[];
416
294
  export declare const RESOLUTIONS: Resolution[];
417
- /** Map aspect ratio to GPT image_size (GPT doesn't support arbitrary aspects) */
418
- export declare function aspectToGptSize(aspect: AspectRatio): string;
419
295
  /**
420
- * Map aspect ratio to fal.ai image_size enum.
421
- * Used by FLUX Schnell, Recraft, Ideogram, and other models that accept
422
- * named size presets rather than aspect ratio strings.
296
+ * Thrown by `buildGenerateBody` when a ratio no fal preset holds has no exact
297
+ * size inside the Model's limits.
423
298
  */
424
- export declare function aspectToFalImageSize(aspect: AspectRatio): string;
299
+ export declare class ImageSizeBoundsError extends Error {
300
+ readonly code = "INVALID_OPTION";
301
+ readonly aspect: AspectRatio;
302
+ readonly bounds: ImageSizeBounds;
303
+ constructor(model: string, aspect: AspectRatio, bounds: ImageSizeBounds);
304
+ }
425
305
  /** Format presets that set aspect + resolution in one click */
426
306
  export declare const FORMAT_PRESETS: Record<string, {
427
307
  label: string;
@@ -429,76 +309,6 @@ export declare const FORMAT_PRESETS: Record<string, {
429
309
  resolution?: Resolution;
430
310
  }>;
431
311
  //#endregion
432
- //#region src/cost.d.ts
433
- /** Estimate cost based on model and settings */
434
- export declare function estimateCost(model: string, resolution?: Resolution, numImages?: number): number | null;
435
- /** Estimate cost for video generation */
436
- export declare function estimateVideoCost(durationSeconds?: number, generateAudio?: boolean): number;
437
- //#endregion
438
- //#region src/env.d.ts
439
- export declare const motifEnvSchema: import("@howells/envy").EnvSchema<{
440
- readonly optional: {
441
- FAL_KEY: z.ZodString;
442
- };
443
- }>;
444
- type MotifEnv = ReturnType<typeof motifEnvSchema.parse>;
445
- export declare function parseMotifEnv(input?: Record<string, unknown>): MotifEnv;
446
- export declare function getFalKeyFromEnv(input?: Record<string, unknown>): string | undefined;
447
- //#endregion
448
- //#region src/generate.d.ts
449
- /**
450
- * Build the fal.ai request body for a generation request.
451
- * Shared between sync generate() (CLI) and queue-based submit (web).
452
- *
453
- * Models use different sizing APIs:
454
- * - `gpt_size`: GPT's fixed dimensions (1024x1024, 1536x1024, etc.)
455
- * - `aspect_ratio`: string like "16:9" (Gemini, Grok, FLUX Pro Ultra)
456
- * - `image_size_enum`: named presets like "landscape_4_3" (FLUX.2, Seedream, Recraft, Ideogram, GPT Image 2)
457
- * - `none`: no size control (video models)
458
- */
459
- export declare function buildGenerateBody(options: GenerateOptions): {
460
- endpoint: string;
461
- body: Record<string, unknown>;
462
- };
463
- //#endregion
464
- //#region src/leaderboards.d.ts
465
- interface LeaderboardEntry {
466
- /**
467
- * What the model's own vendor charges to run it through their API, as Artificial Analysis
468
- * quoted it. Not what fal charges us - fal resells several of these for a fraction of the
469
- * price. For our cost, read `falPricing` on the model in `models.ts`.
470
- */
471
- apiPricing?: string;
472
- creator: string;
473
- elo: number;
474
- isCurrent?: boolean;
475
- model: string;
476
- rank: number;
477
- routableModelId?: string;
478
- }
479
- interface LeaderboardSnapshot {
480
- capturedAt: string;
481
- entries: LeaderboardEntry[];
482
- source: string;
483
- }
484
- export declare const IMAGE_TEXT_TO_IMAGE_TOP_20: LeaderboardSnapshot;
485
- export declare const IMAGE_EDITING_TOP_20: LeaderboardSnapshot;
486
- export declare const VIDEO_TEXT_TO_VIDEO_TOP_15: LeaderboardSnapshot;
487
- export declare const VIDEO_IMAGE_TO_VIDEO_TOP_15: LeaderboardSnapshot;
488
- //#endregion
489
- //#region src/models.d.ts
490
- export declare const MODELS: Record<string, ModelConfig>;
491
- export declare const GENERATION_MODELS: readonly ["flare", "sunburst", "gpt2", "gpt", "banana2", "banana", "gemini", "gemini3", "seedream4", "seedream45", "seedream5", "seedream5-lite", "flux2-max", "flux2-pro", "flux2-flex", "flux2-dev", "flux2-turbo", "flux", "flux-fast", "recraft", "recraft4", "ideogram", "ideogram4", "grok-image", "qwen", "qwen3"];
492
- /** Models whose fal endpoints support image editing (vary/edit flows). */
493
- export declare const EDIT_CAPABLE_MODELS: ("banana" | "banana2" | "flare" | "flux" | "flux-fast" | "flux2-dev" | "flux2-flex" | "flux2-max" | "flux2-pro" | "flux2-turbo" | "gemini" | "gemini3" | "gpt" | "gpt2" | "grok-image" | "ideogram" | "ideogram4" | "qwen" | "qwen3" | "recraft" | "recraft4" | "seedream4" | "seedream45" | "seedream5" | "seedream5-lite" | "sunburst")[];
494
- export declare const UTILITY_MODELS: readonly ["clarity", "crystal", "rmbg", "bria"];
495
- export declare const VIDEO_MODELS: readonly ["kling"];
496
- type GenerationModelName = (typeof GENERATION_MODELS)[number];
497
- /** Recraft v3 style presets. Pass as the `style` field in GenerateOptions. */
498
- export declare const RECRAFT_STYLES: readonly ["realistic_image", "realistic_image/b_and_w", "realistic_image/enterprise", "realistic_image/hard_flash", "realistic_image/hdr", "realistic_image/motion_blur", "realistic_image/natural_light", "realistic_image/studio_portrait", "realistic_image/long_exposure", "digital_illustration", "digital_illustration/2d_art_poster", "digital_illustration/2d_art_poster_2", "digital_illustration/engraving_color", "digital_illustration/grain", "digital_illustration/hand_drawn", "digital_illustration/hand_drawn_outline", "digital_illustration/handmade_3d", "digital_illustration/infantile_sketch", "digital_illustration/pixel_art", "digital_illustration/psychedelic", "digital_illustration/seamless", "digital_illustration/voxel", "digital_illustration/watercolor", "vector_illustration", "vector_illustration/cartoon", "vector_illustration/doodle_line_art", "vector_illustration/engraving", "vector_illustration/flat_2", "vector_illustration/kawaii", "vector_illustration/line_art", "vector_illustration/line_circuit", "vector_illustration/linocut", "vector_illustration/zentangle"];
499
- /** Ideogram v3 top-level style categories. Pass as the `style` field in GenerateOptions. */
500
- export declare const IDEOGRAM_STYLES: readonly ["AUTO", "GENERAL", "REALISTIC", "DESIGN"];
501
- //#endregion
502
312
  //#region src/errors.d.ts
503
313
  /**
504
314
  * `MotifError` and its coercion helper.
@@ -514,2743 +324,738 @@ export declare class MotifError extends Error {
514
324
  /** fal's request-correlation id (from the `x-fal-request-id` header or the
515
325
  * error body). Ties a failure back to fal's dashboard/support. */
516
326
  readonly requestId?: string;
517
- constructor(message: string, status: number, code?: string, requestId?: string);
327
+ /** Structured context for the failure, e.g. the refused field. */
328
+ readonly details?: Record<string, unknown>;
329
+ constructor(message: string, status: number, code?: string, requestId?: string, details?: Record<string, unknown>);
518
330
  }
519
- //#endregion
520
- //#region src/server.d.ts
331
+ /** Error code for a fal account that is locked, usually for lack of credit. */
332
+ export declare const ACCOUNT_LOCKED = "ACCOUNT_LOCKED";
521
333
  /**
522
- * FalClient — the fal-native client.
523
- *
524
- * The low-level, fal-specific client for AI image generation and fal utilities
525
- * (queue, upload, upscale, rmbg, video, tools, generate). Pairs with the
526
- * provider-agnostic `createMotifImage` (`@howells/motif-sdk/image`) as the
527
- * fal-native entry point.
334
+ * Whether a fal HTTP failure means the account is locked.
528
335
  *
529
- * All async methods return `Result<T, MotifError>` — no thrown exceptions.
336
+ * fal answers `403 {"detail":"User is locked. Reason: TOP_UP."}` when the
337
+ * account has run out of credit. Retrying cannot help, and the key is valid.
338
+ */
339
+ export declare function isFalAccountLocked(status: number, body: string): boolean;
340
+ //#endregion
341
+ //#region src/tasks.d.ts
342
+ /**
343
+ * The Task registry: every job Motif does, with the Models that can do it
344
+ * ranked best-first and tagged with the Tier each belongs to.
530
345
  *
531
- * @example
532
- * ```typescript
533
- * import { FalClient } from "./fal";
346
+ * Rankings are data so a default change is visible in a pull request. A Task
347
+ * ranked from the bench's human comparisons says `rankedFrom: "bench"`; every
348
+ * other Task is hand-ranked from published quality numbers and fal price, and
349
+ * says so. Today no Task is bench-ranked: the bench holds two human ratings,
350
+ * both on one model, which is not an order.
534
351
  *
535
- * const motif = new FalClient(process.env.FAL_KEY!);
536
- * const result = await motif.generate({ prompt: "a red balloon", model: "banana" });
352
+ * Model ids are the short aliases `-m` and `TaskInput.model` accept. `resolveTask` in `./resolve` is the only place a Model is
353
+ * chosen from these lists.
537
354
  *
538
- * if (result.isOk()) {
539
- * console.log(result.value.images[0].url);
540
- * } else {
541
- * console.error(result.error.message);
542
- * }
543
- * ```
355
+ * A Task can have modes: a variant of the job a caller names explicitly, such
356
+ * as erasing text rather than an object. A ranked entry with a `mode` is only
357
+ * chosen when the request names that mode; an entry without one only when it
358
+ * names none. A Model can appear once per mode.
544
359
  */
545
- export declare class FalClient {
546
- private readonly apiKey;
547
- private readonly timeout;
548
- private readonly retries;
549
- constructor(config: FalClientConfig | string);
550
- /** ─── Synchronous Generation ──────────────────────────────── */
551
- /** Generate images synchronously (blocks until fal.ai returns). */
552
- generate(options: GenerateOptions): Promise<Result$1<MotifResponse, MotifError>>;
553
- private generateQueued;
554
- /** ─── Queue-Based Generation ──────────────────────────────── */
555
- /** Submit a generation to the fal.ai queue (returns immediately). */
556
- submitGeneration(options: GenerateOptions): Promise<Result$1<QueuedJob, MotifError>>;
557
- /** Check the status of a queued generation. */
558
- getJobStatus(endpoint: string, requestId: string): Promise<Result$1<JobStatus, MotifError>>;
559
- /** Fetch the completed result from the queue. */
560
- getJobResult(endpoint: string, requestId: string): Promise<Result$1<MotifResponse, MotifError>>;
561
- /** ─── Processing ──────────────────────────────────────────── */
562
- /** Upscale an image using clarity or crystal upscaler. */
563
- upscale(options: UpscaleOptions): Promise<Result$1<MotifResponse, MotifError>>;
564
- /** Remove the background from an image. */
565
- removeBackground(options: RemoveBackgroundOptions): Promise<Result$1<MotifResponse, MotifError>>;
566
- /** ─── Video Generation ───────────────────────────────────── */
567
- /**
568
- * Generate a video from an image using Kling v3 Pro.
569
- * This uses the queue API since video generation takes 30-120s.
570
- * Returns immediately with a job — poll with getJobStatus/getVideoResult.
571
- */
572
- submitVideo(options: VideoOptions): Promise<Result$1<QueuedJob, MotifError>>;
573
- /** Fetch the completed video result from the queue. */
574
- getVideoResult(endpoint: string, requestId: string): Promise<Result$1<VideoResponse, MotifError>>;
575
- /** ─── File Upload ─────────────────────────────────────────── */
576
- /**
577
- * Upload a file to fal.ai CDN storage and return the public URL.
578
- * Uses the two-step initiate + PUT flow.
579
- */
580
- uploadToFalCdn(file: ArrayBuffer | Uint8Array, options: {
581
- contentType: string;
582
- fileName: string;
583
- }): Promise<Result$1<string, MotifError>>;
584
- /** ─── Utilities ───────────────────────────────────────────── */
585
- /** Run a registered fal utility/tool endpoint. */
586
- runTool(options: ToolRunOptions): Promise<Result$1<ToolResponse, MotifError>>;
587
- /** ─── Queue-Based Tools ───────────────────────────────────── */
588
- /**
589
- * Submit a tool run to the fal queue. Returns as soon as fal accepts it.
590
- *
591
- * The queued counterpart to `runTool`, for endpoints that outrun the
592
- * synchronous request timeout. Callers choose the path — neither one falls
593
- * back to the other.
594
- */
595
- submitTool(options: ToolRunOptions): Promise<Result$1<QueuedToolJob, MotifError>>;
596
- /** Poll one queued tool run. */
597
- checkToolStatus(job: QueuedToolJob): Promise<Result$1<JobStatus, MotifError>>;
598
- /** Fetch the finished payload for a queued tool run. */
599
- getToolResult(job: QueuedToolJob): Promise<Result$1<ToolResponse, MotifError>>;
600
- /**
601
- * Submit, poll to completion, and return the result. The convenience path
602
- * for tools whose registry entry sets `queued`.
603
- */
604
- runToolQueued(options: ToolRunOptions, onProgress?: (status: string, queuePosition?: number) => void): Promise<Result$1<ToolResponse, MotifError>>;
605
- /**
606
- * Delete fal's stored IO payloads for a completed request.
607
- *
608
- * This removes request input/output payload files exposed by fal's payloads
609
- * API. It does not remove billing/account metadata or input files separately
610
- * uploaded to fal storage before a request.
611
- */
612
- deletePayloads(requestId: string): Promise<Result$1<void, MotifError>>;
613
- /** Estimate cost for a generation (no API call). */
614
- estimateCost(model: string, resolution?: Resolution, numImages?: number): number | null;
615
- /** Build the fal.ai request body without sending it. */
616
- buildRequestBody(options: GenerateOptions): {
617
- endpoint: string;
618
- body: Record<string, unknown>;
619
- };
620
- /** Model registry. */
621
- get models(): Record<string, ModelConfig>;
622
- /** Generation model keys. */
623
- get generationModels(): readonly ["flare", "sunburst", "gpt2", "gpt", "banana2", "banana", "gemini", "gemini3", "seedream4", "seedream45", "seedream5", "seedream5-lite", "flux2-max", "flux2-pro", "flux2-flex", "flux2-dev", "flux2-turbo", "flux", "flux-fast", "recraft", "recraft4", "ideogram", "ideogram4", "grok-image", "qwen", "qwen3"];
624
- /** Utility model keys. */
625
- get utilityModels(): readonly ["clarity", "crystal", "rmbg", "bria"];
626
- /** Registered fal utility/tool endpoints. */
627
- get tools(): {
628
- readonly "got-ocr": {
629
- readonly category: "analysis";
630
- readonly description: "Transcribe text from one or more images, optionally as formatted multi-page output.";
631
- readonly endpoint: "fal-ai/got-ocr/v2";
632
- readonly inputField: "input_image_urls";
633
- readonly inputKind: "images";
634
- readonly name: "GOT-OCR 2.0";
635
- readonly outputKeys: ["outputs"];
636
- readonly price: {
637
- readonly kind: "metered";
638
- };
639
- readonly pricing: "$0.05/image";
640
- readonly queued: true;
641
- readonly sourceUrl: "https://fal.ai/models/fal-ai/got-ocr/v2";
642
- readonly task: "optical character recognition";
643
- };
644
- readonly "moondream-caption": {
645
- readonly category: "analysis";
646
- readonly description: "Write a short, normal, or long caption for an image.";
647
- readonly endpoint: "fal-ai/moondream3-preview/caption";
648
- readonly inputField: "image_url";
649
- readonly inputKind: "image";
650
- readonly name: "Moondream 3 Caption";
651
- readonly outputKeys: ["output"];
652
- readonly price: {
653
- readonly kind: "metered";
654
- };
655
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
656
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/caption";
657
- readonly task: "image captioning";
658
- };
659
- readonly "moondream-detect": {
660
- readonly category: "analysis";
661
- readonly description: "Detect prompted objects and return their bounding boxes, with an optional preview.";
662
- readonly endpoint: "fal-ai/moondream3-preview/detect";
663
- readonly inputField: "image_url";
664
- readonly inputKind: "image";
665
- readonly name: "Moondream 3 Detect";
666
- readonly outputKeys: ["objects", "image"];
667
- readonly price: {
668
- readonly kind: "metered";
669
- };
670
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
671
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/detect";
672
- readonly task: "object detection";
673
- };
674
- readonly "moondream-point": {
675
- readonly category: "analysis";
676
- readonly description: "Return point coordinates for every instance of a prompted subject.";
677
- readonly endpoint: "fal-ai/moondream3-preview/point";
678
- readonly inputField: "image_url";
679
- readonly inputKind: "image";
680
- readonly name: "Moondream 3 Point";
681
- readonly outputKeys: ["points", "image"];
682
- readonly price: {
683
- readonly kind: "metered";
684
- };
685
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
686
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/point";
687
- readonly task: "object pointing";
688
- };
689
- readonly "moondream-query": {
690
- readonly category: "analysis";
691
- readonly description: "Answer a free-form question about an image, with reasoning.";
692
- readonly endpoint: "fal-ai/moondream3-preview/query";
693
- readonly inputField: "image_url";
694
- readonly inputKind: "image";
695
- readonly name: "Moondream 3 Query";
696
- readonly outputKeys: ["output", "reasoning"];
697
- readonly price: {
698
- readonly kind: "metered";
699
- };
700
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
701
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/query";
702
- readonly task: "visual question answering";
703
- };
704
- readonly nsfw: {
705
- readonly category: "moderation";
706
- readonly description: "Predict whether one or more images contain NSFW concepts.";
707
- readonly endpoint: "fal-ai/x-ailab/nsfw";
708
- readonly inputField: "image_urls";
709
- readonly inputKind: "images";
710
- readonly name: "NSFW Checker";
711
- readonly outputKeys: ["has_nsfw_concepts"];
712
- readonly price: {
713
- readonly kind: "metered";
714
- };
715
- readonly pricing: "$0.001/image";
716
- readonly sourceUrl: "https://fal.ai/models/fal-ai/x-ailab/nsfw";
717
- readonly task: "vision moderation";
718
- };
719
- readonly "hunyuan3d-v3": {
720
- readonly category: "3d";
721
- readonly description: "Reconstruct a textured 3D mesh from a single image, with optional multi-view inputs.";
722
- readonly endpoint: "fal-ai/hunyuan3d-v3/image-to-3d";
723
- readonly inputField: "input_image_url";
724
- readonly inputKind: "image";
725
- readonly name: "Hunyuan3D v3 Image to 3D";
726
- readonly outputKeys: ["model_glb", "model_urls", "thumbnail"];
727
- readonly price: {
728
- readonly kind: "call";
729
- readonly usd: 0.375;
730
- };
731
- 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";
732
- readonly queued: true;
733
- readonly sourceUrl: "https://fal.ai/models/fal-ai/hunyuan3d-v3/image-to-3d";
734
- readonly task: "single-image 3D reconstruction";
735
- };
736
- readonly "ideogram-layerize-text": {
737
- readonly category: "layers";
738
- readonly description: "Split an image into background image layers plus editable HTML text containers.";
739
- readonly endpoint: "fal-ai/ideogram/v3/layerize-text";
740
- readonly inputField: "image_url";
741
- readonly inputKind: "image";
742
- readonly name: "Ideogram v3 Text Layerize";
743
- readonly outputKeys: ["image_layers", "image", "text_html", "text_containers"];
744
- readonly price: {
745
- readonly kind: "call";
746
- readonly usd: 0.09;
747
- };
748
- readonly pricing: "$0.09/image";
749
- readonly queued: true;
750
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/layerize-text";
751
- readonly task: "text and image layer extraction";
752
- };
753
- readonly "ideogram-tiling": {
754
- readonly category: "material";
755
- readonly description: "Generate a seamlessly tiling texture, optionally conditioned on a source image.";
756
- readonly endpoint: "ideogram/v4/tiling";
757
- readonly inputField: "image_url";
758
- readonly inputKind: "image";
759
- readonly name: "Ideogram v4 Tiling";
760
- readonly outputKeys: ["images"];
761
- readonly price: {
762
- readonly kind: "megapixel";
763
- readonly usd: 0.06;
764
- };
765
- readonly pricing: "$0.06/megapixel at the default BALANCED speed; $0.03 turbo, $0.10 quality";
766
- readonly sourceUrl: "https://fal.ai/models/ideogram/v4/tiling";
767
- readonly task: "seamless texture generation";
768
- };
769
- readonly image2svg: {
770
- readonly category: "vector";
771
- readonly description: "Trace a raster image into layered SVG paths.";
772
- readonly endpoint: "fal-ai/image2svg";
773
- readonly inputField: "image_url";
774
- readonly inputKind: "image";
775
- readonly name: "Image to SVG";
776
- readonly outputKeys: ["images"];
777
- readonly price: {
778
- readonly kind: "call";
779
- readonly usd: 0.005;
780
- };
781
- readonly pricing: "$0.005/image";
782
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image2svg";
783
- readonly task: "raster to vector tracing";
784
- };
785
- readonly patina: {
786
- readonly category: "material";
787
- readonly description: "Decompose a surface photograph into PBR maps: basecolor, normal, roughness, metalness, height.";
788
- readonly endpoint: "fal-ai/patina";
789
- readonly inputField: "image_url";
790
- readonly inputKind: "image";
791
- readonly name: "Patina PBR Maps";
792
- readonly outputKeys: ["images"];
793
- readonly outputLabels: {
794
- readonly images: {
795
- readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
796
- readonly fromOption: "maps";
797
- };
798
- };
799
- readonly price: {
800
- readonly kind: "metered";
801
- };
802
- 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";
803
- readonly queued: true;
804
- readonly sourceUrl: "https://fal.ai/models/fal-ai/patina";
805
- readonly task: "PBR material decomposition";
806
- };
807
- readonly "patina-extract": {
808
- readonly category: "material";
809
- readonly description: "Extract a tiling PBR material from a prompted region of a photograph.";
810
- readonly endpoint: "fal-ai/patina/material/extract";
811
- readonly inputField: "image_url";
812
- readonly inputKind: "image";
813
- readonly name: "Patina Material Extract";
814
- readonly outputKeys: ["images"];
815
- readonly outputLabels: {
816
- readonly images: {
817
- readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
818
- readonly fromOption: "maps";
819
- };
820
- };
821
- readonly price: {
822
- readonly kind: "metered";
823
- };
824
- 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";
825
- readonly queued: true;
826
- readonly sourceUrl: "https://fal.ai/models/fal-ai/patina/material/extract";
827
- readonly task: "tiling material extraction";
828
- };
829
- readonly "qwen-layered": {
830
- readonly category: "layers";
831
- readonly description: "Split an image into a configurable number of stacked RGBA layers.";
832
- readonly endpoint: "fal-ai/qwen-image-layered";
833
- readonly inputField: "image_url";
834
- readonly inputKind: "image";
835
- readonly name: "Qwen Image Layered";
836
- readonly outputKeys: ["images"];
837
- readonly price: {
838
- readonly kind: "metered";
839
- };
840
- 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";
841
- readonly queued: true;
842
- readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-layered";
843
- readonly task: "image layer decomposition";
844
- };
845
- readonly "recraft-vectorize": {
846
- readonly category: "vector";
847
- readonly description: "Convert a raster image into a clean SVG.";
848
- readonly endpoint: "fal-ai/recraft/vectorize";
849
- readonly inputField: "image_url";
850
- readonly inputKind: "image";
851
- readonly name: "Recraft Vectorize";
852
- readonly outputKeys: ["image"];
853
- readonly price: {
854
- readonly kind: "call";
855
- readonly usd: 0.04;
856
- };
857
- readonly pricing: "$0.04/image, $0.08 with a vector style";
858
- readonly sourceUrl: "https://fal.ai/models/fal-ai/recraft/vectorize";
859
- readonly task: "raster to vector conversion";
860
- };
861
- readonly "sam3-3d-align": {
862
- readonly category: "3d";
863
- readonly description: "Align SAM 3D objects and bodies into a shared scene.";
864
- readonly endpoint: "fal-ai/sam-3/3d-align";
865
- readonly inputField: "image_url";
866
- readonly inputKind: "image";
867
- readonly name: "SAM 3D Align";
868
- readonly outputKeys: ["scene_glb", "model_glb", "visualization", "body_mesh_ply", "metadata"];
869
- readonly price: {
870
- readonly kind: "metered";
871
- };
872
- readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
873
- readonly queued: true;
874
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-align";
875
- readonly task: "3D scene alignment";
876
- };
877
- readonly "sam3-3d-body": {
878
- readonly category: "3d";
879
- readonly defaultOptions: {
880
- readonly export_meshes: true;
881
- readonly include_3d_keypoints: true;
882
- readonly include_mhr_params: true;
883
- };
884
- readonly description: "Reconstruct human body meshes and keypoints from a single image.";
885
- readonly endpoint: "fal-ai/sam-3/3d-body";
886
- readonly inputField: "image_url";
887
- readonly inputKind: "image";
888
- readonly name: "SAM 3D Body";
889
- readonly outputKeys: ["model_glb", "visualization", "meshes", "metadata"];
890
- readonly price: {
891
- readonly kind: "metered";
892
- };
893
- readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
894
- readonly queued: true;
895
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-body";
896
- readonly task: "single-image 3D body reconstruction";
897
- };
898
- readonly "sam3-3d-objects": {
899
- readonly category: "3d";
900
- readonly defaultOptions: {
901
- readonly prompt: "car";
902
- };
903
- readonly description: "Reconstruct one or more 3D objects from an image and prompts.";
904
- readonly endpoint: "fal-ai/sam-3/3d-objects";
905
- readonly inputField: "image_url";
906
- readonly inputKind: "image";
907
- readonly name: "SAM 3D Objects";
908
- readonly outputKeys: ["gaussian_splat", "model_glb", "metadata", "individual_splats", "individual_glbs", "artifacts_zip"];
909
- readonly price: {
910
- readonly kind: "metered";
911
- };
912
- 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";
913
- readonly queued: true;
914
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-objects";
915
- readonly task: "single-image 3D object reconstruction";
916
- };
917
- readonly "seedream-layerize": {
918
- readonly category: "layers";
919
- readonly description: "Split an image into editable Seedream layers plus flattened previews.";
920
- readonly endpoint: "bytedance/seedream/v5/pro/layerize";
921
- readonly inputField: "image_url";
922
- readonly inputKind: "image";
923
- readonly name: "Seedream v5 Pro Layerize";
924
- readonly outputKeys: ["layers", "images"];
925
- readonly outputLabels: {
926
- readonly layers: {
927
- readonly fromItem: {
928
- readonly nameField: "name";
929
- readonly orderField: "z_index";
930
- };
931
- };
932
- };
933
- readonly price: {
934
- readonly kind: "metered";
935
- };
936
- 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";
937
- readonly queued: true;
938
- readonly sourceUrl: "https://fal.ai/models/bytedance/seedream/v5/pro/layerize";
939
- readonly task: "image layer decomposition";
940
- };
941
- readonly "seedvr-seamless": {
942
- readonly category: "material";
943
- readonly description: "Upscale a tiling texture while keeping its edges seamless. ";
944
- readonly endpoint: "fal-ai/seedvr/upscale/image/seamless";
945
- readonly inputField: "image_url";
946
- readonly inputKind: "image";
947
- readonly name: "SeedVR Seamless Upscale";
948
- readonly outputKeys: ["image"];
949
- readonly price: {
950
- readonly kind: "megapixel";
951
- readonly usd: 0.0025;
952
- };
953
- readonly pricing: "$0.0025/megapixel";
954
- readonly queued: true;
955
- readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image/seamless";
956
- readonly task: "seamless texture upscaling";
957
- };
958
- readonly "trellis-2": {
959
- readonly category: "3d";
960
- readonly description: "Reconstruct a textured 3D mesh from a single image, with UV unwrapping.";
961
- readonly endpoint: "fal-ai/trellis-2";
962
- readonly inputField: "image_url";
963
- readonly inputKind: "image";
964
- readonly name: "TRELLIS 2";
965
- readonly outputKeys: ["model_glb"];
966
- readonly price: {
967
- readonly kind: "call";
968
- readonly usd: 0.3;
969
- };
970
- readonly pricing: "$0.30 at the default 1024p; $0.25 at 512p, $0.35 at 1536p";
971
- readonly queued: true;
972
- readonly sourceUrl: "https://fal.ai/models/fal-ai/trellis-2";
973
- readonly task: "single-image 3D reconstruction";
974
- };
975
- readonly "ben-v2": {
976
- readonly category: "background";
977
- readonly description: "Fast, high-quality background removal for images.";
978
- readonly endpoint: "fal-ai/ben/v2/image";
979
- readonly inputField: "image_url";
980
- readonly inputKind: "image";
981
- readonly name: "BEN v2 Background Removal";
982
- readonly outputKeys: ["image"];
983
- readonly price: {
984
- readonly kind: "megapixel";
985
- readonly usd: 0.025;
986
- };
987
- readonly pricing: "$0.025/megapixel";
988
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ben/v2/image";
989
- readonly task: "image background removal";
990
- };
991
- readonly birefnet: {
992
- readonly category: "background";
993
- readonly defaultOptions: {
994
- readonly model: "General Use (Light)";
995
- readonly operating_resolution: "1024x1024";
996
- readonly output_format: "png";
997
- readonly refine_foreground: true;
998
- };
999
- readonly description: "High-resolution dichotomous image segmentation and background removal.";
1000
- readonly endpoint: "fal-ai/birefnet/v2";
1001
- readonly inputField: "image_url";
1002
- readonly inputKind: "image";
1003
- readonly name: "BirefNet Background Removal";
1004
- readonly outputKeys: ["image", "mask_image"];
1005
- readonly price: {
1006
- readonly kind: "metered";
1007
- };
1008
- readonly pricing: "$0/compute-second listed by fal";
1009
- readonly sourceUrl: "https://fal.ai/models/fal-ai/birefnet/v2";
1010
- readonly task: "image background removal";
1011
- };
1012
- readonly "bria-rmbg": {
1013
- readonly category: "background";
1014
- readonly description: "Commercial-safe background removal for images.";
1015
- readonly endpoint: "fal-ai/bria/background/remove";
1016
- readonly inputField: "image_url";
1017
- readonly inputKind: "image";
1018
- readonly name: "Bria RMBG 2.0";
1019
- readonly outputKeys: ["image"];
1020
- readonly price: {
1021
- readonly kind: "call";
1022
- readonly usd: 0.018;
1023
- };
1024
- readonly pricing: "$0.018/generation";
1025
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/background/remove";
1026
- readonly task: "image background removal";
1027
- };
1028
- readonly "bria-video-rmbg": {
1029
- readonly category: "background";
1030
- readonly defaultOptions: {
1031
- readonly background_color: "Black";
1032
- readonly output_container_and_codec: "webm_vp9";
1033
- readonly preserve_audio: true;
1034
- };
1035
- readonly description: "Remove video backgrounds with configurable output container.";
1036
- readonly endpoint: "bria/video/background-removal";
1037
- readonly inputField: "video_url";
1038
- readonly inputKind: "video";
1039
- readonly name: "Bria Video Background Removal";
1040
- readonly outputKeys: ["video"];
1041
- readonly price: {
1042
- readonly kind: "second";
1043
- readonly usd: 0.00425;
1044
- };
1045
- readonly pricing: "$0.00425/sec";
1046
- readonly queued: true;
1047
- readonly sourceUrl: "https://fal.ai/models/bria/video/background-removal";
1048
- readonly task: "video background removal";
1049
- };
1050
- readonly ddcolor: {
1051
- readonly category: "restoration";
1052
- readonly description: "Colourise black-and-white photographs.";
1053
- readonly endpoint: "fal-ai/ddcolor";
1054
- readonly inputField: "image_url";
1055
- readonly inputKind: "image";
1056
- readonly name: "DDColor Colourisation";
1057
- readonly outputKeys: ["image"];
1058
- readonly price: {
1059
- readonly kind: "megapixel";
1060
- readonly usd: 0.001;
1061
- };
1062
- readonly pricing: "$0.001/megapixel";
1063
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ddcolor";
1064
- readonly task: "photo colourisation";
1065
- };
1066
- readonly rembg: {
1067
- readonly category: "background";
1068
- readonly defaultOptions: {
1069
- readonly crop_to_bbox: false;
1070
- };
1071
- readonly description: "Generic image background removal utility.";
1072
- readonly endpoint: "fal-ai/imageutils/rembg";
1073
- readonly inputField: "image_url";
1074
- readonly inputKind: "image";
1075
- readonly name: "Remove Background";
1076
- readonly outputKeys: ["image"];
1077
- readonly price: {
1078
- readonly kind: "metered";
1079
- };
1080
- readonly pricing: "$0/compute-second listed by fal";
1081
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/rembg";
1082
- readonly task: "image background removal";
1083
- };
1084
- readonly "seedvr-upscale": {
1085
- readonly category: "restoration";
1086
- readonly defaultOptions: {
1087
- readonly output_format: "png";
1088
- };
1089
- readonly description: "Diffusion image restoration and upscaling with SeedVR.";
1090
- readonly endpoint: "fal-ai/seedvr/upscale/image";
1091
- readonly inputField: "image_url";
1092
- readonly inputKind: "image";
1093
- readonly name: "SeedVR Image Upscale";
1094
- readonly outputKeys: ["image"];
1095
- readonly price: {
1096
- readonly kind: "megapixel";
1097
- readonly usd: 0.001;
1098
- };
1099
- readonly pricing: "$0.001/megapixel";
1100
- readonly queued: true;
1101
- readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image";
1102
- readonly task: "image restoration and upscaling";
1103
- };
1104
- readonly "topaz-adjust": {
1105
- readonly category: "restoration";
1106
- readonly defaultOptions: {
1107
- readonly output_format: "png";
1108
- };
1109
- readonly description: "Topaz exposure, white balance, and colour adjustment.";
1110
- readonly endpoint: "topaz/adjust/image";
1111
- readonly inputField: "image_url";
1112
- readonly inputKind: "image";
1113
- readonly name: "Topaz Adjust";
1114
- readonly outputKeys: ["image"];
1115
- readonly price: {
1116
- readonly kind: "megapixel";
1117
- readonly usd: number;
1118
- };
1119
- readonly pricing: "$0.08 per 24 output megapixels";
1120
- readonly queued: true;
1121
- readonly sourceUrl: "https://fal.ai/models/topaz/adjust/image";
1122
- readonly task: "tonal adjustment";
1123
- };
1124
- readonly "topaz-creative": {
1125
- readonly category: "restoration";
1126
- readonly defaultOptions: {
1127
- readonly output_format: "png";
1128
- };
1129
- readonly description: "Topaz Bloom upscaling, which reimagines detail rather than preserving it.";
1130
- readonly endpoint: "topaz/upscale/image/creative";
1131
- readonly inputField: "image_url";
1132
- readonly inputKind: "image";
1133
- readonly name: "Topaz Creative Upscale";
1134
- readonly outputKeys: ["image"];
1135
- readonly price: {
1136
- readonly kind: "megapixel";
1137
- readonly usd: number;
1138
- };
1139
- readonly pricing: "$0.96 per 24 output megapixels";
1140
- readonly queued: true;
1141
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/creative";
1142
- readonly task: "creative image upscaling";
1143
- };
1144
- readonly "topaz-denoise": {
1145
- readonly category: "restoration";
1146
- readonly defaultOptions: {
1147
- readonly output_format: "png";
1148
- };
1149
- readonly description: "Topaz noise reduction at source resolution.";
1150
- readonly endpoint: "topaz/denoise/image";
1151
- readonly inputField: "image_url";
1152
- readonly inputKind: "image";
1153
- readonly name: "Topaz Denoise";
1154
- readonly outputKeys: ["image"];
1155
- readonly price: {
1156
- readonly kind: "megapixel";
1157
- readonly usd: number;
1158
- };
1159
- readonly pricing: "$0.08 per 24 output megapixels at the default Normal model; $0.16 with Denoise Max";
1160
- readonly queued: true;
1161
- readonly sourceUrl: "https://fal.ai/models/topaz/denoise/image";
1162
- readonly task: "image denoising";
1163
- };
1164
- readonly "topaz-generative": {
1165
- readonly category: "restoration";
1166
- readonly defaultOptions: {
1167
- readonly output_format: "png";
1168
- };
1169
- readonly description: "Topaz Wonder upscaling, which synthesises plausible detail as it enlarges.";
1170
- readonly endpoint: "topaz/upscale/image/generative";
1171
- readonly inputField: "image_url";
1172
- readonly inputKind: "image";
1173
- readonly name: "Topaz Generative Upscale";
1174
- readonly outputKeys: ["image"];
1175
- readonly price: {
1176
- readonly kind: "megapixel";
1177
- readonly usd: number;
1178
- };
1179
- 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";
1180
- readonly queued: true;
1181
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/generative";
1182
- readonly task: "generative image upscaling";
1183
- };
1184
- readonly "topaz-image": {
1185
- readonly category: "upscale";
1186
- readonly defaultOptions: {
1187
- readonly model: "Standard V2";
1188
- readonly output_format: "jpeg";
1189
- readonly upscale_factor: 2;
1190
- };
1191
- readonly description: "Professional Topaz image enhancement and upscaling.";
1192
- readonly endpoint: "fal-ai/topaz/upscale/image";
1193
- readonly inputField: "image_url";
1194
- readonly inputKind: "image";
1195
- readonly name: "Topaz Image Upscale";
1196
- readonly outputKeys: ["image"];
1197
- readonly price: {
1198
- readonly kind: "megapixel";
1199
- readonly usd: number;
1200
- };
1201
- readonly pricing: "$0.08 for output up to 24MP; $0.16 to 48MP, $0.32 to 96MP, up to $1.36 at 512MP";
1202
- readonly queued: true;
1203
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image";
1204
- readonly task: "image enhancement";
1205
- };
1206
- readonly "topaz-precision": {
1207
- readonly category: "restoration";
1208
- readonly defaultOptions: {
1209
- readonly output_format: "png";
1210
- };
1211
- readonly description: "Topaz upscaling that preserves the original detail rather than inventing it.";
1212
- readonly endpoint: "topaz/upscale/image/precision";
1213
- readonly inputField: "image_url";
1214
- readonly inputKind: "image";
1215
- readonly name: "Topaz Precision Upscale";
1216
- readonly outputKeys: ["image"];
1217
- readonly price: {
1218
- readonly kind: "megapixel";
1219
- readonly usd: number;
1220
- };
1221
- readonly pricing: "$0.08 per 24 output megapixels, any precision model";
1222
- readonly queued: true;
1223
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/precision";
1224
- readonly task: "faithful image upscaling";
1225
- };
1226
- readonly "topaz-restore": {
1227
- readonly category: "restoration";
1228
- readonly defaultOptions: {
1229
- readonly output_format: "png";
1230
- };
1231
- readonly description: "Topaz restoration of damaged or degraded photographs at source resolution.";
1232
- readonly endpoint: "topaz/restore/image";
1233
- readonly inputField: "image_url";
1234
- readonly inputKind: "image";
1235
- readonly name: "Topaz Restore";
1236
- readonly outputKeys: ["image"];
1237
- readonly price: {
1238
- readonly kind: "megapixel";
1239
- readonly usd: number;
1240
- };
1241
- readonly pricing: "$0.48 per 24 output megapixels at the default Recover 3; $0.08 with Dust-Scratch V2";
1242
- readonly queued: true;
1243
- readonly sourceUrl: "https://fal.ai/models/topaz/restore/image";
1244
- readonly task: "photo restoration";
1245
- };
1246
- readonly "topaz-sharpen": {
1247
- readonly category: "restoration";
1248
- readonly defaultOptions: {
1249
- readonly output_format: "png";
1250
- };
1251
- readonly description: "Topaz deblurring and sharpening at source resolution.";
1252
- readonly endpoint: "topaz/sharpen/image";
1253
- readonly inputField: "image_url";
1254
- readonly inputKind: "image";
1255
- readonly name: "Topaz Sharpen";
1256
- readonly outputKeys: ["image"];
1257
- readonly price: {
1258
- readonly kind: "megapixel";
1259
- readonly usd: number;
1260
- };
1261
- readonly pricing: "$0.08 per 24 output megapixels at the default Standard model; $0.16 with Super Focus";
1262
- readonly queued: true;
1263
- readonly sourceUrl: "https://fal.ai/models/topaz/sharpen/image";
1264
- readonly task: "image sharpening";
1265
- };
1266
- readonly "topaz-transparent": {
1267
- readonly category: "restoration";
1268
- readonly description: "Topaz upscaling that preserves the alpha channel end to end.";
1269
- readonly endpoint: "topaz/upscale/image/transparent";
1270
- readonly inputField: "image_url";
1271
- readonly inputKind: "image";
1272
- readonly name: "Topaz Transparent Upscale";
1273
- readonly outputKeys: ["image"];
1274
- readonly price: {
1275
- readonly kind: "megapixel";
1276
- readonly usd: number;
1277
- };
1278
- readonly pricing: "$0.08 per 24 output megapixels";
1279
- readonly queued: true;
1280
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/transparent";
1281
- readonly task: "transparent image upscaling";
1282
- };
1283
- readonly "topaz-video": {
1284
- readonly category: "upscale";
1285
- readonly defaultOptions: {
1286
- readonly model: "Proteus";
1287
- readonly upscale_factor: 2;
1288
- };
1289
- readonly description: "Professional Topaz video enhancement and upscaling.";
1290
- readonly endpoint: "fal-ai/topaz/upscale/video";
1291
- readonly inputField: "video_url";
1292
- readonly inputKind: "video";
1293
- readonly name: "Topaz Video Upscale";
1294
- readonly outputKeys: ["video"];
1295
- readonly price: {
1296
- readonly kind: "second";
1297
- readonly usd: 0.01;
1298
- };
1299
- readonly pricing: "$0.01/sec up to 720p; $0.02 to 1080p, $0.08 above, doubled at 60fps, halved with Gaia 2";
1300
- readonly queued: true;
1301
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video";
1302
- readonly task: "video enhancement";
1303
- };
1304
- readonly "bria-eraser": {
1305
- readonly category: "erase";
1306
- readonly description: "Commercial-safe removal of a masked region, inpainted from surrounding context.";
1307
- readonly endpoint: "fal-ai/bria/eraser";
1308
- readonly inputField: "image_url";
1309
- readonly inputKind: "image";
1310
- readonly name: "Bria Eraser";
1311
- readonly outputKeys: ["image"];
1312
- readonly price: {
1313
- readonly kind: "call";
1314
- readonly usd: 0.04;
1315
- };
1316
- readonly pricing: "$0.04/generation";
1317
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/eraser";
1318
- readonly task: "masked object erasure";
1319
- };
1320
- readonly "bria-expand": {
1321
- readonly category: "reframe";
1322
- readonly description: "Expand an image onto a larger canvas, generating the new border area.";
1323
- readonly endpoint: "fal-ai/bria/expand";
1324
- readonly inputField: "image_url";
1325
- readonly inputKind: "image";
1326
- readonly name: "Bria Image Expansion";
1327
- readonly outputKeys: ["image"];
1328
- readonly price: {
1329
- readonly kind: "call";
1330
- readonly usd: 0.04;
1331
- };
1332
- readonly pricing: "$0.04/generation";
1333
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/expand";
1334
- readonly task: "image outpainting";
1335
- };
1336
- readonly "bria-genfill": {
1337
- readonly category: "erase";
1338
- readonly description: "Generative fill of a masked region from a prompt, commercial-safe.";
1339
- readonly endpoint: "fal-ai/bria/genfill";
1340
- readonly inputField: "image_url";
1341
- readonly inputKind: "image";
1342
- readonly name: "Bria GenFill";
1343
- readonly outputKeys: ["images"];
1344
- readonly price: {
1345
- readonly kind: "call";
1346
- readonly usd: 0.04;
1347
- };
1348
- readonly pricing: "$0.04/generation";
1349
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/genfill";
1350
- readonly task: "masked generative fill";
1351
- };
1352
- readonly "finegrain-eraser": {
1353
- readonly category: "erase";
1354
- readonly description: "Remove a prompted object and its shadows and reflections, filling the gap.";
1355
- readonly endpoint: "fal-ai/finegrain-eraser";
1356
- readonly inputField: "image_url";
1357
- readonly inputKind: "image";
1358
- readonly name: "Finegrain Object Eraser";
1359
- readonly outputKeys: ["image"];
1360
- readonly price: {
1361
- readonly kind: "call";
1362
- readonly usd: 0.27;
1363
- };
1364
- readonly pricing: "$0.27/image at the default standard mode; $0.18 express, $0.36 premium";
1365
- readonly sourceUrl: "https://fal.ai/models/fal-ai/finegrain-eraser";
1366
- readonly task: "prompted object erasure";
1367
- };
1368
- readonly "flux-outpaint": {
1369
- readonly category: "reframe";
1370
- readonly description: "Outpaint an image by a per-edge pixel expansion with FLUX.2 pro.";
1371
- readonly endpoint: "fal-ai/flux-2-pro/outpaint";
1372
- readonly inputField: "image_url";
1373
- readonly inputKind: "image";
1374
- readonly name: "FLUX.2 Pro Outpaint";
1375
- readonly outputKeys: ["images"];
1376
- readonly price: {
1377
- readonly kind: "metered";
1378
- };
1379
- readonly pricing: "$0.03 for the first output megapixel, then $0.015 per extra megapixel of input and output, rounded up";
1380
- readonly sourceUrl: "https://fal.ai/models/fal-ai/flux-2-pro/outpaint";
1381
- readonly task: "image outpainting";
1382
- };
1383
- readonly "iclight-v2": {
1384
- readonly category: "relight";
1385
- readonly description: "Relight a subject from a prompt, harmonising it with a new light direction.";
1386
- readonly endpoint: "fal-ai/iclight-v2";
1387
- readonly inputField: "image_url";
1388
- readonly inputKind: "image";
1389
- readonly name: "IC-Light v2";
1390
- readonly outputKeys: ["images"];
1391
- readonly price: {
1392
- readonly kind: "megapixel";
1393
- readonly usd: 0.1;
1394
- };
1395
- readonly pricing: "$0.10/megapixel";
1396
- readonly sourceUrl: "https://fal.ai/models/fal-ai/iclight-v2";
1397
- readonly task: "prompted relighting";
1398
- };
1399
- readonly "ideogram-reframe": {
1400
- readonly category: "reframe";
1401
- readonly description: "Reframe an image to a new aspect ratio, generating the fill.";
1402
- readonly endpoint: "fal-ai/ideogram/v3/reframe";
1403
- readonly inputField: "image_url";
1404
- readonly inputKind: "image";
1405
- readonly name: "Ideogram v3 Reframe";
1406
- readonly outputKeys: ["images"];
1407
- readonly price: {
1408
- readonly kind: "call";
1409
- readonly usd: 0.06;
1410
- };
1411
- readonly pricing: "$0.06/image at the default BALANCED speed; $0.03 turbo, $0.09 quality";
1412
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/reframe";
1413
- readonly task: "aspect ratio reframing";
1414
- };
1415
- readonly "lighting-restoration": {
1416
- readonly category: "relight";
1417
- readonly description: "Restore natural, even lighting across one or more input images.";
1418
- readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
1419
- readonly inputField: "image_urls";
1420
- readonly inputKind: "images";
1421
- readonly name: "Qwen Lighting Restoration";
1422
- readonly outputKeys: ["images"];
1423
- readonly price: {
1424
- readonly kind: "megapixel";
1425
- readonly usd: 0.035;
1426
- };
1427
- readonly pricing: "$0.035/megapixel";
1428
- readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
1429
- readonly task: "lighting restoration";
1430
- };
1431
- readonly "object-removal": {
1432
- readonly category: "erase";
1433
- readonly description: "Remove a prompted object from an image and fill the gap.";
1434
- readonly endpoint: "fal-ai/object-removal";
1435
- readonly inputField: "image_url";
1436
- readonly inputKind: "image";
1437
- readonly name: "Object Removal";
1438
- readonly outputKeys: ["images"];
1439
- readonly price: {
1440
- readonly kind: "call";
1441
- readonly usd: 0.024;
1442
- };
1443
- readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
1444
- readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal";
1445
- readonly task: "prompted object removal";
1446
- };
1447
- readonly "object-removal-bbox": {
1448
- readonly category: "erase";
1449
- readonly description: "Remove whatever falls inside supplied bounding boxes.";
1450
- readonly endpoint: "fal-ai/object-removal/bbox";
1451
- readonly inputField: "image_url";
1452
- readonly inputKind: "image";
1453
- readonly name: "Object Removal by Box";
1454
- readonly outputKeys: ["images"];
1455
- readonly price: {
1456
- readonly kind: "call";
1457
- readonly usd: 0.024;
1458
- };
1459
- readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
1460
- readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/bbox";
1461
- readonly task: "bounding box object removal";
1462
- };
1463
- readonly "object-removal-mask": {
1464
- readonly category: "erase";
1465
- readonly description: "Remove the masked region of an image and fill the gap.";
1466
- readonly endpoint: "fal-ai/object-removal/mask";
1467
- readonly inputField: "image_url";
1468
- readonly inputKind: "image";
1469
- readonly name: "Object Removal by Mask";
1470
- readonly outputKeys: ["images"];
1471
- readonly price: {
1472
- readonly kind: "call";
1473
- readonly usd: 0.024;
1474
- };
1475
- readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
1476
- readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/mask";
1477
- readonly task: "masked object removal";
1478
- };
1479
- readonly "remove-lighting": {
1480
- readonly category: "relight";
1481
- readonly description: "Strip baked-in lighting and shadows to leave a flat, neutral surface.";
1482
- readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
1483
- readonly inputField: "image_urls";
1484
- readonly inputKind: "images";
1485
- readonly name: "Qwen Remove Lighting";
1486
- readonly outputKeys: ["images"];
1487
- readonly price: {
1488
- readonly kind: "megapixel";
1489
- readonly usd: 0.035;
1490
- };
1491
- readonly pricing: "$0.035/megapixel";
1492
- readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
1493
- readonly task: "lighting removal";
1494
- };
1495
- readonly "smart-resize": {
1496
- readonly category: "reframe";
1497
- readonly description: "Resize one image to several target sizes, recomposing rather than cropping.";
1498
- readonly endpoint: "fal-ai/smart-resize";
1499
- readonly inputField: "image_url";
1500
- readonly inputKind: "image";
1501
- readonly name: "Smart Resize";
1502
- readonly outputKeys: ["images", "results"];
1503
- readonly price: {
1504
- readonly kind: "metered";
1505
- };
1506
- readonly pricing: "$0.15 per output image, doubled at 4K, plus a $0.05 vision analysis fee per request";
1507
- readonly queued: true;
1508
- readonly sourceUrl: "https://fal.ai/models/fal-ai/smart-resize";
1509
- readonly task: "multi-size recomposition";
1510
- };
1511
- readonly "text-removal": {
1512
- readonly category: "erase";
1513
- readonly defaultOptions: {
1514
- readonly output_format: "png";
1515
- };
1516
- readonly description: "Remove all rendered text from an image, rebuilding what sat behind it.";
1517
- readonly endpoint: "fal-ai/image-editing/text-removal";
1518
- readonly inputField: "image_url";
1519
- readonly inputKind: "image";
1520
- readonly name: "Text Removal";
1521
- readonly outputKeys: ["images"];
1522
- readonly price: {
1523
- readonly kind: "call";
1524
- readonly usd: 0.04;
1525
- };
1526
- readonly pricing: "$0.04/image";
1527
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-editing/text-removal";
1528
- readonly task: "text removal";
1529
- };
1530
- readonly "depth-anything": {
1531
- readonly category: "preprocess";
1532
- readonly description: "Generate Depth Anything v2 depth maps from input images.";
1533
- readonly endpoint: "fal-ai/image-preprocessors/depth-anything/v2";
1534
- readonly inputField: "image_url";
1535
- readonly inputKind: "image";
1536
- readonly name: "Depth Anything v2 Preprocessor";
1537
- readonly outputKeys: ["image"];
1538
- readonly price: {
1539
- readonly kind: "metered";
1540
- };
1541
- readonly pricing: "$0/compute-second listed by fal";
1542
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/depth-anything/v2";
1543
- readonly task: "depth preprocessing";
1544
- };
1545
- readonly dwpose: {
1546
- readonly category: "preprocess";
1547
- readonly description: "Extract body, hand, and face pose skeletons from an image.";
1548
- readonly endpoint: "fal-ai/dwpose";
1549
- readonly inputField: "image_url";
1550
- readonly inputKind: "image";
1551
- readonly name: "DWPose Estimation";
1552
- readonly outputKeys: ["image"];
1553
- readonly price: {
1554
- readonly kind: "second";
1555
- readonly usd: 0.0006;
1556
- };
1557
- readonly pricing: "$0.0006/compute-second";
1558
- readonly sourceUrl: "https://fal.ai/models/fal-ai/dwpose";
1559
- readonly task: "pose preprocessing";
1560
- };
1561
- readonly hed: {
1562
- readonly category: "preprocess";
1563
- readonly description: "Generate HED soft edge maps for ControlNet-style workflows.";
1564
- readonly endpoint: "fal-ai/image-preprocessors/hed";
1565
- readonly inputField: "image_url";
1566
- readonly inputKind: "image";
1567
- readonly name: "HED Edge Preprocessor";
1568
- readonly outputKeys: ["image"];
1569
- readonly price: {
1570
- readonly kind: "metered";
1571
- };
1572
- readonly pricing: "$0/compute-second listed by fal";
1573
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/hed";
1574
- readonly task: "edge preprocessing";
1575
- };
1576
- readonly lineart: {
1577
- readonly category: "preprocess";
1578
- readonly defaultOptions: {
1579
- readonly coarse: false;
1580
- };
1581
- readonly description: "Generate line art/control-style edges from an input image.";
1582
- readonly endpoint: "fal-ai/image-preprocessors/lineart";
1583
- readonly inputField: "image_url";
1584
- readonly inputKind: "image";
1585
- readonly name: "Line Art Preprocessor";
1586
- readonly outputKeys: ["image"];
1587
- readonly price: {
1588
- readonly kind: "metered";
1589
- };
1590
- readonly pricing: "$0/compute-second listed by fal";
1591
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/lineart";
1592
- readonly task: "image preprocessing";
1593
- };
1594
- readonly "marigold-depth": {
1595
- readonly category: "depth";
1596
- readonly defaultOptions: {
1597
- readonly ensemble_size: 10;
1598
- readonly num_inference_steps: 10;
1599
- };
1600
- readonly description: "Create depth maps using Marigold depth estimation.";
1601
- readonly endpoint: "fal-ai/imageutils/marigold-depth";
1602
- readonly inputField: "image_url";
1603
- readonly inputKind: "image";
1604
- readonly name: "Marigold Depth Estimation";
1605
- readonly outputKeys: ["image"];
1606
- readonly price: {
1607
- readonly kind: "metered";
1608
- };
1609
- readonly pricing: "$0/compute-second listed by fal";
1610
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/marigold-depth";
1611
- readonly task: "depth map";
1612
- };
1613
- readonly "midas-depth": {
1614
- readonly category: "depth";
1615
- readonly defaultOptions: {
1616
- readonly a: number;
1617
- readonly bg_th: 0.1;
1618
- };
1619
- readonly description: "Create MiDaS depth maps from input images.";
1620
- readonly endpoint: "fal-ai/imageutils/depth";
1621
- readonly inputField: "image_url";
1622
- readonly inputKind: "image";
1623
- readonly name: "MiDaS Depth Estimation";
1624
- readonly outputKeys: ["image"];
1625
- readonly price: {
1626
- readonly kind: "metered";
1627
- };
1628
- readonly pricing: "$0/compute-second listed by fal";
1629
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/depth";
1630
- readonly task: "depth map";
1631
- };
1632
- readonly "midas-preprocessor": {
1633
- readonly category: "preprocess";
1634
- readonly description: "Generate MiDaS depth and normal maps for image workflows.";
1635
- readonly endpoint: "fal-ai/image-preprocessors/midas";
1636
- readonly inputField: "image_url";
1637
- readonly inputKind: "image";
1638
- readonly name: "MiDaS Preprocessor";
1639
- readonly outputKeys: ["depth_map", "normal_map"];
1640
- readonly price: {
1641
- readonly kind: "metered";
1642
- };
1643
- readonly pricing: "$0/compute-second listed by fal";
1644
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/midas";
1645
- readonly task: "depth and normal preprocessing";
1646
- };
1647
- readonly mlsd: {
1648
- readonly category: "preprocess";
1649
- readonly description: "Detect straight line segments for architectural and interior control maps.";
1650
- readonly endpoint: "fal-ai/image-preprocessors/mlsd";
1651
- readonly inputField: "image_url";
1652
- readonly inputKind: "image";
1653
- readonly name: "M-LSD Line Preprocessor";
1654
- readonly outputKeys: ["image"];
1655
- readonly price: {
1656
- readonly kind: "metered";
1657
- };
1658
- readonly pricing: "$0/compute-second listed by fal";
1659
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/mlsd";
1660
- readonly task: "line segment preprocessing";
1661
- };
1662
- readonly pidi: {
1663
- readonly category: "preprocess";
1664
- readonly description: "Generate PiDiNet soft edge maps from an input image.";
1665
- readonly endpoint: "fal-ai/image-preprocessors/pidi";
1666
- readonly inputField: "image_url";
1667
- readonly inputKind: "image";
1668
- readonly name: "PiDiNet Edge Preprocessor";
1669
- readonly outputKeys: ["image"];
1670
- readonly price: {
1671
- readonly kind: "metered";
1672
- };
1673
- readonly pricing: "$0/compute-second listed by fal";
1674
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/pidi";
1675
- readonly task: "edge preprocessing";
1676
- };
1677
- readonly "sam-preprocessor": {
1678
- readonly category: "preprocess";
1679
- readonly description: "Generate a SAM segmentation map for ControlNet-style workflows.";
1680
- readonly endpoint: "fal-ai/image-preprocessors/sam";
1681
- readonly inputField: "image_url";
1682
- readonly inputKind: "image";
1683
- readonly name: "SAM Preprocessor";
1684
- readonly outputKeys: ["image"];
1685
- readonly price: {
1686
- readonly kind: "metered";
1687
- };
1688
- readonly pricing: "$0/compute-second listed by fal";
1689
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/sam";
1690
- readonly task: "segmentation preprocessing";
1691
- };
1692
- readonly "sam2-auto": {
1693
- readonly category: "segmentation";
1694
- readonly defaultOptions: {
1695
- readonly min_mask_region_area: 100;
1696
- readonly output_format: "png";
1697
- readonly points_per_side: 32;
1698
- readonly pred_iou_thresh: 0.88;
1699
- readonly stability_score_thresh: 0.95;
1700
- };
1701
- readonly description: "Automatically segment an image into combined and individual masks.";
1702
- readonly endpoint: "fal-ai/sam2/auto-segment";
1703
- readonly inputField: "image_url";
1704
- readonly inputKind: "image";
1705
- readonly name: "SAM 2 Auto Segment";
1706
- readonly outputKeys: ["combined_mask", "individual_masks"];
1707
- readonly price: {
1708
- readonly kind: "metered";
1709
- };
1710
- readonly pricing: "$0/compute-second listed by fal";
1711
- readonly queued: true;
1712
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam2/auto-segment";
1713
- readonly task: "automatic image segmentation";
1714
- };
1715
- readonly "sam3-1-image": {
1716
- readonly category: "segmentation";
1717
- readonly defaultOptions: {
1718
- readonly apply_mask: true;
1719
- readonly max_masks: 3;
1720
- readonly output_format: "png";
1721
- };
1722
- readonly description: "Segment image objects with text, point, or box prompts. SAM 3.1 adds Object Multiplex for faster multi-object tracking.";
1723
- readonly endpoint: "fal-ai/sam-3-1/image";
1724
- readonly inputField: "image_url";
1725
- readonly inputKind: "image";
1726
- readonly name: "SAM 3.1 Image";
1727
- readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
1728
- readonly price: {
1729
- readonly kind: "call";
1730
- readonly usd: 0.01;
1731
- };
1732
- readonly pricing: "$0.01/request";
1733
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/image";
1734
- readonly task: "promptable image segmentation";
1735
- };
1736
- readonly "sam3-1-video": {
1737
- readonly category: "segmentation";
1738
- readonly defaultOptions: {
1739
- readonly apply_mask: true;
1740
- readonly prompt: "person";
1741
- };
1742
- readonly description: "SAM 3.1 video segmentation with Object Multiplex tracking for multiple objects.";
1743
- readonly endpoint: "fal-ai/sam-3-1/video";
1744
- readonly inputField: "video_url";
1745
- readonly inputKind: "video";
1746
- readonly name: "SAM 3.1 Video";
1747
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
1748
- readonly price: {
1749
- readonly kind: "metered";
1750
- };
1751
- readonly pricing: "$0.01/16 frames of video input";
1752
- readonly queued: true;
1753
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/video";
1754
- readonly task: "multi-object video segmentation";
1755
- };
1756
- readonly "sam3-image": {
1757
- readonly category: "segmentation";
1758
- readonly defaultOptions: {
1759
- readonly apply_mask: true;
1760
- readonly max_masks: 3;
1761
- readonly output_format: "png";
1762
- };
1763
- readonly description: "Segment image objects with text, point, or box prompts.";
1764
- readonly endpoint: "fal-ai/sam-3/image";
1765
- readonly inputField: "image_url";
1766
- readonly inputKind: "image";
1767
- readonly name: "SAM 3 Image";
1768
- readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
1769
- readonly price: {
1770
- readonly kind: "call";
1771
- readonly usd: 0.005;
1772
- };
1773
- readonly pricing: "$0.005/request";
1774
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image";
1775
- readonly task: "promptable image segmentation";
1776
- };
1777
- readonly "sam3-image-rle": {
1778
- readonly category: "segmentation";
1779
- readonly defaultOptions: {
1780
- readonly apply_mask: true;
1781
- readonly max_masks: 3;
1782
- };
1783
- readonly description: "Segment image objects and return run-length encoded masks.";
1784
- readonly endpoint: "fal-ai/sam-3/image-rle";
1785
- readonly inputField: "image_url";
1786
- readonly inputKind: "image";
1787
- readonly name: "SAM 3 Image RLE";
1788
- readonly outputKeys: ["rle", "scores", "boxes", "metadata"];
1789
- readonly price: {
1790
- readonly kind: "call";
1791
- readonly usd: 0.005;
1792
- };
1793
- readonly pricing: "$0.005/request";
1794
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image-rle";
1795
- readonly task: "promptable image segmentation to RLE";
1796
- };
1797
- readonly "sam3-video": {
1798
- readonly category: "segmentation";
1799
- readonly defaultOptions: {
1800
- readonly apply_mask: true;
1801
- readonly detection_threshold: 0.5;
1802
- readonly prompt: "person";
1803
- readonly video_output_type: "X264 (.mp4)";
1804
- };
1805
- readonly description: "Segment and track prompted objects across video frames.";
1806
- readonly endpoint: "fal-ai/sam-3/video";
1807
- readonly inputField: "video_url";
1808
- readonly inputKind: "video";
1809
- readonly name: "SAM 3 Video";
1810
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
1811
- readonly price: {
1812
- readonly kind: "metered";
1813
- };
1814
- readonly pricing: "$0.005/16 frames of video input";
1815
- readonly queued: true;
1816
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video";
1817
- readonly task: "promptable video segmentation";
1818
- };
1819
- readonly "sam3-video-rle": {
1820
- readonly category: "segmentation";
1821
- readonly defaultOptions: {
1822
- readonly apply_mask: true;
1823
- readonly detection_threshold: 0.5;
1824
- readonly prompt: "person";
1825
- };
1826
- readonly description: "Track prompted video objects and return RLE mask data.";
1827
- readonly endpoint: "fal-ai/sam-3/video-rle";
1828
- readonly inputField: "video_url";
1829
- readonly inputKind: "video";
1830
- readonly name: "SAM 3 Video RLE";
1831
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
1832
- readonly price: {
1833
- readonly kind: "metered";
1834
- };
1835
- readonly pricing: "$0.005/16 frames of video";
1836
- readonly queued: true;
1837
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video-rle";
1838
- readonly task: "promptable video segmentation to RLE";
1839
- };
1840
- readonly scribble: {
1841
- readonly category: "preprocess";
1842
- readonly description: "Turn an image into a scribble-style control map.";
1843
- readonly endpoint: "fal-ai/image-preprocessors/scribble";
1844
- readonly inputField: "image_url";
1845
- readonly inputKind: "image";
1846
- readonly name: "Scribble Preprocessor";
1847
- readonly outputKeys: ["image"];
1848
- readonly price: {
1849
- readonly kind: "metered";
1850
- };
1851
- readonly pricing: "$0/compute-second listed by fal";
1852
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/scribble";
1853
- readonly task: "scribble preprocessing";
1854
- };
1855
- readonly teed: {
1856
- readonly category: "preprocess";
1857
- readonly description: "Generate TEED edge maps from an input image.";
1858
- readonly endpoint: "fal-ai/image-preprocessors/teed";
1859
- readonly inputField: "image_url";
1860
- readonly inputKind: "image";
1861
- readonly name: "TEED Edge Preprocessor";
1862
- readonly outputKeys: ["image"];
1863
- readonly price: {
1864
- readonly kind: "metered";
1865
- };
1866
- readonly pricing: "$0/compute-second listed by fal";
1867
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/teed";
1868
- readonly task: "edge preprocessing";
1869
- };
1870
- readonly "zoe-depth": {
1871
- readonly category: "preprocess";
1872
- readonly description: "Generate ZoeDepth metric depth maps from an input image.";
1873
- readonly endpoint: "fal-ai/image-preprocessors/zoe";
1874
- readonly inputField: "image_url";
1875
- readonly inputKind: "image";
1876
- readonly name: "ZoeDepth Preprocessor";
1877
- readonly outputKeys: ["image"];
1878
- readonly price: {
1879
- readonly kind: "metered";
1880
- };
1881
- readonly pricing: "$0/compute-second listed by fal";
1882
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/zoe";
1883
- readonly task: "depth preprocessing";
1884
- };
1885
- };
1886
- /**
1887
- * The seam `server-tools.ts` runs against — the client's authenticated fetch
1888
- * and its queue status parser, exposed without widening the public surface.
1889
- */
1890
- private get toolExecutor();
1891
- /** ─── Private ─────────────────────────────────────────────── */
1892
- /** Authenticated fetch to fal.ai APIs with retry logic. */
1893
- private request;
1894
- private ephemeralHeaders;
1895
- /**
1896
- * Normalize fal.ai responses.
1897
- * Some APIs return `{ image: {...} }` instead of `{ images: [...] }`.
1898
- */
1899
- private normalizeResponse;
360
+ export declare const TIERS: readonly ["fast", "balanced", "quality"];
361
+ /** How far a Task trades cost and speed for quality. */
362
+ type Tier = (typeof TIERS)[number];
363
+ export declare const DEFAULT_TIER: Tier;
364
+ /** Where a Task's order came from. */
365
+ type RankedFrom = "bench" | "hand";
366
+ /** Something a request needs that not every Model can honour. */
367
+ type Capability = "aspect" | "count" | "image" | "mask" | "negativePrompt" | "outputFormat" | "references" | "resolution" | "rig" | "seed" | "transparency" | "video";
368
+ interface RankedModel {
369
+ /** A Model id, as accepted by `-m` or `TaskInput.model`. */
370
+ readonly model: string;
371
+ /** The Tier this Model is offered at. */
372
+ readonly tier: Tier;
373
+ /** The mode this entry serves. Absent for the Task's plain job. */
374
+ readonly mode?: string;
375
+ /** Capabilities this Model has for this Task beyond its registry profile. */
376
+ readonly supports?: readonly Capability[];
377
+ /** The Model works without a Source, such as a tile made from a prompt. */
378
+ readonly sourceOptional?: true;
379
+ /** Inputs the request must supply for this Model to be chosen, e.g. a mask. */
380
+ readonly requires?: readonly Capability[];
381
+ }
382
+ interface TaskMode {
383
+ readonly id: string;
384
+ /** One sentence: what this mode does differently. */
385
+ readonly summary: string;
386
+ }
387
+ interface TaskDefinition {
388
+ /** One sentence: the job, in the words a caller would use. */
389
+ readonly summary: string;
390
+ /** What to use instead, naming the sibling Task. */
391
+ readonly notFor: string;
392
+ readonly rankedFrom: RankedFrom;
393
+ /** ISO date the order was last set. */
394
+ readonly rankedAt: string;
395
+ /** How the order was decided, for the reviewer of the next change. */
396
+ readonly basis: string;
397
+ /** Named variants of the job. Every `mode` on a ranked entry is listed here. */
398
+ readonly modes?: readonly TaskMode[];
399
+ /** Best first. Order within a Tier is the order tried at that Tier. */
400
+ readonly models: readonly RankedModel[];
1900
401
  }
402
+ /** Every Task with a Model. A Task is absent here until it has at least one Model. */
403
+ export declare const TASKS: {
404
+ readonly animate: {
405
+ readonly basis: "Hand-ranked. Kling v3 Pro leads with audio, an end frame and a negative prompt at $0.112-$0.168/sec; Kling v3 Turbo Pro is the fast pick at $0.14/sec without them.";
406
+ readonly models: readonly [{
407
+ readonly model: "kling";
408
+ readonly tier: "balanced";
409
+ }, {
410
+ readonly model: "kling-turbo";
411
+ readonly tier: "fast";
412
+ }];
413
+ readonly notFor: "A still image (generate), or variations of one (vary).";
414
+ readonly rankedAt: "2026-09-16";
415
+ readonly rankedFrom: "hand";
416
+ readonly summary: "Turn a still image into a short video clip.";
417
+ };
418
+ readonly ask: {
419
+ readonly basis: "Hand-ranked. Moondream answers questions, captions, detects and points; GOT-OCR transcribes text; the NSFW classifier answers the safety question.";
420
+ readonly modes: readonly [{
421
+ readonly id: "caption";
422
+ readonly summary: "Write a caption for the image.";
423
+ }, {
424
+ readonly id: "detect";
425
+ readonly summary: "Return bounding boxes for a named thing.";
426
+ }, {
427
+ readonly id: "point";
428
+ readonly summary: "Return a point on every instance of a named thing.";
429
+ }, {
430
+ readonly id: "read";
431
+ readonly summary: "Transcribe the text in the image.";
432
+ }, {
433
+ readonly id: "safe";
434
+ readonly summary: "Say whether the image is safe for work.";
435
+ }];
436
+ readonly models: readonly [{
437
+ readonly model: "moondream-query";
438
+ readonly tier: "balanced";
439
+ }, {
440
+ readonly mode: "caption";
441
+ readonly model: "moondream-caption";
442
+ readonly tier: "balanced";
443
+ }, {
444
+ readonly mode: "detect";
445
+ readonly model: "moondream-detect";
446
+ readonly tier: "balanced";
447
+ }, {
448
+ readonly mode: "point";
449
+ readonly model: "moondream-point";
450
+ readonly tier: "balanced";
451
+ }, {
452
+ readonly mode: "read";
453
+ readonly model: "got-ocr";
454
+ readonly tier: "balanced";
455
+ }, {
456
+ readonly mode: "safe";
457
+ readonly model: "nsfw";
458
+ readonly tier: "balanced";
459
+ }];
460
+ readonly notFor: "Pixel masks of a named thing (segment).";
461
+ readonly rankedAt: "2026-09-16";
462
+ readonly rankedFrom: "hand";
463
+ readonly summary: "Answer a question about an image, caption it, count or find things in it.";
464
+ };
465
+ readonly cutout: {
466
+ readonly basis: "Hand-ranked from fal price and edge quality: Bria for commercial-safe edges, BEN v2 and BiRefNet as the balanced picks, rembg as the cheap one. For video, Bria's VRMBG 3.0 ($0.05/sec) leads the older Bria remover ($0.14/sec).";
467
+ readonly models: readonly [{
468
+ readonly model: "bria-rmbg";
469
+ readonly tier: "quality";
470
+ }, {
471
+ readonly model: "birefnet";
472
+ readonly tier: "balanced";
473
+ }, {
474
+ readonly model: "ben-v2";
475
+ readonly tier: "balanced";
476
+ }, {
477
+ readonly model: "rembg";
478
+ readonly tier: "fast";
479
+ }, {
480
+ readonly model: "bria-video-rmbg-v3";
481
+ readonly tier: "balanced";
482
+ }, {
483
+ readonly model: "bria-video-rmbg";
484
+ readonly tier: "balanced";
485
+ }];
486
+ readonly notFor: "Cutting one named thing out of a scene, such as the chair in a room (segment), or taking an object out and filling the gap (erase).";
487
+ readonly rankedAt: "2026-09-16";
488
+ readonly rankedFrom: "hand";
489
+ readonly summary: "Remove the background behind the main subject of an image or video.";
490
+ };
491
+ readonly erase: {
492
+ readonly basis: "Hand-ranked. Finegrain also removes shadows and reflections and costs ten times more, so it leads the quality tier only. With a mask, Bria's eraser leads and fal's mask remover is the balanced pick.";
493
+ readonly modes: readonly [{
494
+ readonly id: "boxes";
495
+ readonly summary: "Remove whatever falls inside the given boxes.";
496
+ }, {
497
+ readonly id: "text";
498
+ readonly summary: "Remove all rendered text.";
499
+ }, {
500
+ readonly id: "with";
501
+ readonly summary: "Fill the masked region with something described in words.";
502
+ }];
503
+ readonly models: readonly [{
504
+ readonly model: "finegrain-eraser";
505
+ readonly tier: "quality";
506
+ }, {
507
+ readonly model: "object-removal";
508
+ readonly tier: "balanced";
509
+ }, {
510
+ readonly model: "bria-eraser";
511
+ readonly requires: readonly ["mask"];
512
+ readonly supports: readonly ["mask"];
513
+ readonly tier: "quality";
514
+ }, {
515
+ readonly model: "object-removal-mask";
516
+ readonly requires: readonly ["mask"];
517
+ readonly supports: readonly ["mask"];
518
+ readonly tier: "balanced";
519
+ }, {
520
+ readonly mode: "boxes";
521
+ readonly model: "object-removal-bbox";
522
+ readonly tier: "balanced";
523
+ }, {
524
+ readonly mode: "text";
525
+ readonly model: "text-removal";
526
+ readonly tier: "balanced";
527
+ }, {
528
+ readonly mode: "with";
529
+ readonly model: "bria-genfill";
530
+ readonly requires: readonly ["mask"];
531
+ readonly supports: readonly ["mask"];
532
+ readonly tier: "balanced";
533
+ }];
534
+ readonly notFor: "The whole background (cutout), or extending the canvas (reframe).";
535
+ readonly rankedAt: "2026-09-16";
536
+ readonly rankedFrom: "hand";
537
+ readonly summary: "Remove an object, person, text or clutter from an image and fill the gap.";
538
+ };
539
+ readonly generate: {
540
+ readonly basis: "Hand-ranked. Tiers set by fal price per image (quality ≥ $0.07, balanced $0.02-$0.15 with edit quality, fast ≤ $0.04); order within a tier by Artificial Analysis text-to-image Elo, snapshot 2026-08-23, unranked models last. banana leads balanced because it is the house default the looks are tuned on. Ideogram V3 Transparent follows it but is chosen only for a transparent request, so transparency needs no OpenAI key at balanced; token-metered Nano Banana 2 Lite sits in balanced by its Elo.";
541
+ readonly models: readonly RankedModel[];
542
+ readonly notFor: "Variations of an image you already have (vary), or a consistent set of images (series run).";
543
+ readonly rankedAt: "2026-09-16";
544
+ readonly rankedFrom: "hand";
545
+ readonly summary: "Make an image from a prompt, or change an image you pass as a reference.";
546
+ };
547
+ readonly layers: {
548
+ readonly basis: "Hand-ranked. Qwen gives a set number of stacked RGBA layers; Seedream names and orders object layers; Ideogram separates text from artwork.";
549
+ readonly modes: readonly [{
550
+ readonly id: "text";
551
+ readonly summary: "Separate the text from the artwork as editable text.";
552
+ }];
553
+ readonly models: readonly [{
554
+ readonly model: "seedream-layerize";
555
+ readonly tier: "quality";
556
+ }, {
557
+ readonly model: "qwen-layered";
558
+ readonly tier: "balanced";
559
+ }, {
560
+ readonly mode: "text";
561
+ readonly model: "ideogram-layerize-text";
562
+ readonly tier: "balanced";
563
+ }];
564
+ readonly notFor: "Masking one named thing (segment), or removing the background (cutout).";
565
+ readonly rankedAt: "2026-09-16";
566
+ readonly rankedFrom: "hand";
567
+ readonly summary: "Split an image into transparent layers.";
568
+ };
569
+ readonly map: {
570
+ readonly basis: "Hand-ranked. Depth is the plain job: Marigold for quality, Depth Anything v2 balanced, MiDaS fast. The other maps are modes, each with its own Models.";
571
+ readonly modes: readonly [{
572
+ readonly id: "edges";
573
+ readonly summary: "A soft edge map.";
574
+ }, {
575
+ readonly id: "lineart";
576
+ readonly summary: "A line-art map.";
577
+ }, {
578
+ readonly id: "lines";
579
+ readonly summary: "Straight line segments, for architecture and interiors.";
580
+ }, {
581
+ readonly id: "metric";
582
+ readonly summary: "Metric depth, in real distances.";
583
+ }, {
584
+ readonly id: "normals";
585
+ readonly summary: "A surface normal map.";
586
+ }, {
587
+ readonly id: "pose";
588
+ readonly summary: "Body, hand and face pose skeletons.";
589
+ }, {
590
+ readonly id: "scribble";
591
+ readonly summary: "A scribble-style map.";
592
+ }, {
593
+ readonly id: "segments";
594
+ readonly summary: "A segmentation map.";
595
+ }];
596
+ readonly models: readonly [{
597
+ readonly model: "marigold-depth";
598
+ readonly tier: "quality";
599
+ }, {
600
+ readonly model: "depth-anything";
601
+ readonly tier: "balanced";
602
+ }, {
603
+ readonly model: "midas-depth";
604
+ readonly tier: "fast";
605
+ }, {
606
+ readonly mode: "edges";
607
+ readonly model: "teed";
608
+ readonly tier: "quality";
609
+ }, {
610
+ readonly mode: "edges";
611
+ readonly model: "hed";
612
+ readonly tier: "balanced";
613
+ }, {
614
+ readonly mode: "edges";
615
+ readonly model: "pidi";
616
+ readonly tier: "fast";
617
+ }, {
618
+ readonly mode: "lineart";
619
+ readonly model: "lineart";
620
+ readonly tier: "balanced";
621
+ }, {
622
+ readonly mode: "lines";
623
+ readonly model: "mlsd";
624
+ readonly tier: "balanced";
625
+ }, {
626
+ readonly mode: "metric";
627
+ readonly model: "zoe-depth";
628
+ readonly tier: "balanced";
629
+ }, {
630
+ readonly mode: "normals";
631
+ readonly model: "midas-preprocessor";
632
+ readonly tier: "balanced";
633
+ }, {
634
+ readonly mode: "pose";
635
+ readonly model: "dwpose";
636
+ readonly tier: "balanced";
637
+ }, {
638
+ readonly mode: "scribble";
639
+ readonly model: "scribble";
640
+ readonly tier: "balanced";
641
+ }, {
642
+ readonly mode: "segments";
643
+ readonly model: "sam-preprocessor";
644
+ readonly tier: "balanced";
645
+ }];
646
+ readonly notFor: "Masks of a named thing (segment), or PBR material maps (material).";
647
+ readonly rankedAt: "2026-09-16";
648
+ readonly rankedFrom: "hand";
649
+ readonly summary: "Make a control map of an image: depth, edges, lines, normals or pose.";
650
+ };
651
+ readonly material: {
652
+ readonly basis: "Hand-ranked. Patina is the only PBR decomposition Model; extract works on a region.";
653
+ readonly modes: readonly [{
654
+ readonly id: "extract";
655
+ readonly summary: "Extract a tiling material from a named region.";
656
+ }];
657
+ readonly models: readonly [{
658
+ readonly model: "patina";
659
+ readonly tier: "balanced";
660
+ }, {
661
+ readonly mode: "extract";
662
+ readonly model: "patina-extract";
663
+ readonly tier: "balanced";
664
+ }];
665
+ readonly notFor: "A seamless texture without PBR maps (tile), or depth and normals of a scene (map).";
666
+ readonly rankedAt: "2026-09-16";
667
+ readonly rankedFrom: "hand";
668
+ readonly summary: "Turn a surface photograph into PBR maps: colour, normal, roughness, metalness, height.";
669
+ };
670
+ readonly mesh: {
671
+ readonly basis: "Hand-ranked from fal price and published quality: Meshy v7 leads quality and is the only Model that rigs a mesh; Hunyuan3D v3 is the quality second at under a third of the price; TRELLIS 2 balanced. SAM 3D reconstructs several prompted objects, or a human body.";
672
+ readonly modes: readonly [{
673
+ readonly id: "body";
674
+ readonly summary: "Reconstruct a human body mesh with keypoints.";
675
+ }, {
676
+ readonly id: "objects";
677
+ readonly summary: "Reconstruct a named object from one image.";
678
+ }];
679
+ readonly models: readonly [{
680
+ readonly model: "meshy-v7";
681
+ readonly tier: "quality";
682
+ }, {
683
+ readonly model: "hunyuan3d-v3";
684
+ readonly tier: "quality";
685
+ }, {
686
+ readonly model: "trellis-2";
687
+ readonly tier: "balanced";
688
+ }, {
689
+ readonly mode: "body";
690
+ readonly model: "sam3-3d-body";
691
+ readonly tier: "balanced";
692
+ }, {
693
+ readonly mode: "objects";
694
+ readonly model: "sam3-3d-objects";
695
+ readonly tier: "balanced";
696
+ }];
697
+ readonly notFor: "A flat image of an object (generate), or depth of a scene (map).";
698
+ readonly rankedAt: "2026-09-16";
699
+ readonly rankedFrom: "hand";
700
+ readonly summary: "Make a textured 3D mesh from one image.";
701
+ };
702
+ readonly reframe: {
703
+ readonly basis: "Hand-ranked. Ideogram reframes to a ratio and leads; Bria expands to a ratio for less. FLUX outpaints by a per-edge pixel margin. Smart resize makes several sizes at once.";
704
+ readonly modes: readonly [{
705
+ readonly id: "margin";
706
+ readonly summary: "Extend each edge by a set number of pixels.";
707
+ }, {
708
+ readonly id: "sizes";
709
+ readonly summary: "Make several target sizes at once, recomposing each.";
710
+ }];
711
+ readonly models: readonly [{
712
+ readonly model: "ideogram-reframe";
713
+ readonly tier: "balanced";
714
+ }, {
715
+ readonly model: "bria-expand";
716
+ readonly tier: "fast";
717
+ }, {
718
+ readonly mode: "margin";
719
+ readonly model: "flux-outpaint";
720
+ readonly tier: "balanced";
721
+ }, {
722
+ readonly mode: "sizes";
723
+ readonly model: "smart-resize";
724
+ readonly tier: "balanced";
725
+ }];
726
+ readonly notFor: "A new image at a given ratio (generate with a ratio).";
727
+ readonly rankedAt: "2026-09-16";
728
+ readonly rankedFrom: "hand";
729
+ readonly summary: "Extend or recut an image to a new aspect ratio, generating the new edges.";
730
+ };
731
+ readonly relight: {
732
+ readonly basis: "Hand-ranked. IC-Light relights to a described light or a mood, with or without a mask; the two lighting Models even out or strip baked-in light.";
733
+ readonly modes: readonly [{
734
+ readonly id: "even";
735
+ readonly summary: "Restore natural, even lighting.";
736
+ }, {
737
+ readonly id: "flat";
738
+ readonly summary: "Strip baked-in light and shadow to a neutral surface.";
739
+ }];
740
+ readonly models: readonly [{
741
+ readonly model: "iclight-v2";
742
+ readonly supports: readonly ["mask"];
743
+ readonly tier: "balanced";
744
+ }, {
745
+ readonly mode: "even";
746
+ readonly model: "lighting-restoration";
747
+ readonly tier: "balanced";
748
+ }, {
749
+ readonly mode: "flat";
750
+ readonly model: "remove-lighting";
751
+ readonly tier: "balanced";
752
+ }];
753
+ readonly notFor: "Regenerating the scene in a new light (generate with a mood).";
754
+ readonly rankedAt: "2026-09-16";
755
+ readonly rankedFrom: "hand";
756
+ readonly summary: "Change the light in a photo without regenerating it.";
757
+ };
758
+ readonly restore: {
759
+ readonly basis: "Hand-ranked. Each mode names what is wrong and has the Model that fixes it; the plain job is Topaz's general restoration. Control Light, a FLUX.2 klein fine-tune at $0.03/MP, brightens dark photos.";
760
+ readonly modes: readonly [{
761
+ readonly id: "colour";
762
+ readonly summary: "Colourise a black-and-white photograph.";
763
+ }, {
764
+ readonly id: "dark";
765
+ readonly summary: "Brighten a dark or underexposed photo.";
766
+ }, {
767
+ readonly id: "noise";
768
+ readonly summary: "Remove noise.";
769
+ }, {
770
+ readonly id: "scratches";
771
+ readonly summary: "Repair scratches, tears and damage.";
772
+ }, {
773
+ readonly id: "softness";
774
+ readonly summary: "Sharpen a soft or blurred image.";
775
+ }, {
776
+ readonly id: "tone";
777
+ readonly summary: "Fix exposure, white balance and colour.";
778
+ }];
779
+ readonly models: readonly [{
780
+ readonly model: "topaz-restore";
781
+ readonly tier: "balanced";
782
+ }, {
783
+ readonly mode: "colour";
784
+ readonly model: "ddcolor";
785
+ readonly tier: "balanced";
786
+ }, {
787
+ readonly mode: "dark";
788
+ readonly model: "control-light";
789
+ readonly tier: "balanced";
790
+ }, {
791
+ readonly mode: "noise";
792
+ readonly model: "topaz-denoise";
793
+ readonly tier: "balanced";
794
+ }, {
795
+ readonly mode: "scratches";
796
+ readonly model: "topaz-restore";
797
+ readonly tier: "balanced";
798
+ }, {
799
+ readonly mode: "softness";
800
+ readonly model: "topaz-sharpen";
801
+ readonly tier: "balanced";
802
+ }, {
803
+ readonly mode: "tone";
804
+ readonly model: "topaz-adjust";
805
+ readonly tier: "balanced";
806
+ }];
807
+ readonly notFor: "Making an image larger (upscale).";
808
+ readonly rankedAt: "2026-09-16";
809
+ readonly rankedFrom: "hand";
810
+ readonly summary: "Fix noise, softness, damage, colour or tone without changing the size.";
811
+ };
812
+ readonly restyle: {
813
+ readonly basis: "Hand-ranked. One Model: TeleStyle v2.";
814
+ readonly models: readonly [{
815
+ readonly model: "telestyle-v2";
816
+ readonly tier: "balanced";
817
+ }];
818
+ readonly notFor: "A house style kept across images (generate with a look).";
819
+ readonly rankedAt: "2026-09-16";
820
+ readonly rankedFrom: "hand";
821
+ readonly summary: "Redraw an image in the style of a reference image.";
822
+ };
823
+ readonly segment: {
824
+ readonly basis: "Hand-ranked. SAM 3.1 for quality, SAM 3 balanced; SAM 2 segments everything without a prompt. RLE modes return run-length masks.";
825
+ readonly modes: readonly [{
826
+ readonly id: "auto";
827
+ readonly summary: "Segment every region without a prompt.";
828
+ }, {
829
+ readonly id: "rle";
830
+ readonly summary: "Return run-length encoded masks instead of images.";
831
+ }];
832
+ readonly models: readonly [{
833
+ readonly model: "sam3-1-image";
834
+ readonly tier: "quality";
835
+ }, {
836
+ readonly model: "sam3-image";
837
+ readonly tier: "balanced";
838
+ }, {
839
+ readonly model: "sam3-1-video";
840
+ readonly tier: "quality";
841
+ }, {
842
+ readonly model: "sam3-video";
843
+ readonly tier: "balanced";
844
+ }, {
845
+ readonly mode: "auto";
846
+ readonly model: "sam2-auto";
847
+ readonly tier: "balanced";
848
+ }, {
849
+ readonly mode: "rle";
850
+ readonly model: "sam3-image-rle";
851
+ readonly tier: "balanced";
852
+ }, {
853
+ readonly mode: "rle";
854
+ readonly model: "sam3-video-rle";
855
+ readonly tier: "balanced";
856
+ }];
857
+ readonly notFor: "The background behind the subject (cutout), or boxes without masks (ask detect).";
858
+ readonly rankedAt: "2026-09-16";
859
+ readonly rankedFrom: "hand";
860
+ readonly summary: "Mask or cut out a named thing in an image or video.";
861
+ };
862
+ readonly tile: {
863
+ readonly basis: "Hand-ranked. Ideogram makes the tile; SeedVR upscales one while keeping its edges seamless.";
864
+ readonly modes: readonly [{
865
+ readonly id: "upscale";
866
+ readonly summary: "Upscale a tiling texture and keep it seamless.";
867
+ }];
868
+ readonly models: readonly [{
869
+ readonly model: "ideogram-tiling";
870
+ readonly sourceOptional: true;
871
+ readonly tier: "balanced";
872
+ }, {
873
+ readonly mode: "upscale";
874
+ readonly model: "seedvr-seamless";
875
+ readonly tier: "balanced";
876
+ }];
877
+ readonly notFor: "PBR maps of a surface (material).";
878
+ readonly rankedAt: "2026-09-16";
879
+ readonly rankedFrom: "hand";
880
+ readonly summary: "Make a seamlessly tiling texture.";
881
+ };
882
+ readonly "try-on": {
883
+ readonly basis: "Hand-ranked. One Model: Google's virtual try-on.";
884
+ readonly models: readonly [{
885
+ readonly model: "virtual-try-on";
886
+ readonly tier: "balanced";
887
+ }];
888
+ readonly notFor: "Changing clothes by description (generate with a reference).";
889
+ readonly rankedAt: "2026-09-16";
890
+ readonly rankedFrom: "hand";
891
+ readonly summary: "Dress a person in a garment from another image.";
892
+ };
893
+ readonly upscale: {
894
+ readonly basis: "Hand-ranked. Topaz Precision and Topaz Image lead quality for fidelity at $0.003/MP; Clarity stays the balanced default it was as --up; Crystal is fast. SeedVR is the balanced second. Topaz Transparent is the only Model that keeps alpha. Generative and creative modes invent detail. Topaz Video upscales video.";
895
+ readonly modes: readonly [{
896
+ readonly id: "creative";
897
+ readonly summary: "Reimagine detail as it enlarges.";
898
+ }, {
899
+ readonly id: "generative";
900
+ readonly summary: "Synthesise plausible detail as it enlarges.";
901
+ }];
902
+ readonly models: readonly [{
903
+ readonly model: "topaz-precision";
904
+ readonly tier: "quality";
905
+ }, {
906
+ readonly model: "topaz-image";
907
+ readonly tier: "quality";
908
+ }, {
909
+ readonly model: "clarity";
910
+ readonly tier: "balanced";
911
+ }, {
912
+ readonly model: "seedvr-upscale";
913
+ readonly tier: "balanced";
914
+ }, {
915
+ readonly model: "crystal";
916
+ readonly tier: "fast";
917
+ }, {
918
+ readonly model: "topaz-transparent";
919
+ readonly supports: readonly ["transparency"];
920
+ readonly tier: "balanced";
921
+ }, {
922
+ readonly model: "topaz-video";
923
+ readonly tier: "balanced";
924
+ }, {
925
+ readonly mode: "creative";
926
+ readonly model: "topaz-creative";
927
+ readonly tier: "balanced";
928
+ }, {
929
+ readonly mode: "generative";
930
+ readonly model: "topaz-generative";
931
+ readonly tier: "balanced";
932
+ }];
933
+ readonly notFor: "Fixing noise, softness or colour without changing the size (restore).";
934
+ readonly rankedAt: "2026-09-16";
935
+ readonly rankedFrom: "hand";
936
+ readonly summary: "Make an image or video larger without losing detail.";
937
+ };
938
+ readonly vectorize: {
939
+ readonly basis: "Hand-ranked. Recraft gives a clean SVG with few paths; image2svg traces faithfully with many paths and costs an eighth as much.";
940
+ readonly models: readonly [{
941
+ readonly model: "recraft-vectorize";
942
+ readonly tier: "balanced";
943
+ }, {
944
+ readonly model: "image2svg";
945
+ readonly tier: "fast";
946
+ }];
947
+ readonly notFor: "Drawing a new image from a prompt (generate).";
948
+ readonly rankedAt: "2026-09-16";
949
+ readonly rankedFrom: "hand";
950
+ readonly summary: "Trace a raster image to a clean SVG.";
951
+ };
952
+ readonly vary: {
953
+ readonly basis: "The generate ranking, filtered to Models that can edit. vary reuses the Model of the image it varies while Motif still offers it.";
954
+ readonly models: RankedModel[];
955
+ readonly notFor: "A specific change to an image described in words (generate with a reference), or a set of different scenes in one style (series run).";
956
+ readonly rankedAt: "2026-09-16";
957
+ readonly rankedFrom: "hand";
958
+ readonly summary: "Make variations of an image you already have.";
959
+ };
960
+ };
961
+ /** A Task that has at least one Model. */
962
+ type TaskId = keyof typeof TASKS;
963
+ export declare const TASK_IDS: readonly TaskId[];
964
+ export declare function isTaskId(value: string): value is TaskId;
1901
965
  //#endregion
1902
- //#region src/tool-types.d.ts
1903
- type FalToolInputKind = "image" | "images" | "video";
966
+ //#region src/resolve.d.ts
967
+ /** What the request needs. Only the fields that narrow the choice. */
968
+ interface TaskRequest {
969
+ /** Explicit Model id, e.g. from `--model`. Overrides everything. */
970
+ readonly model?: string;
971
+ /** Look id. A Look fixes the Model, so `tier` has no effect with one. */
972
+ readonly look?: string;
973
+ readonly tier?: Tier;
974
+ /** Transparent output wanted. */
975
+ readonly transparent?: boolean;
976
+ /** Number of reference images passed in. */
977
+ readonly references?: number;
978
+ /** A mask image is passed in. */
979
+ readonly mask?: boolean;
980
+ /** An aspect ratio is asked for, e.g. `"3:2"`. */
981
+ readonly aspect?: string;
982
+ /** A resolution tier is asked for, e.g. `"1K"`. */
983
+ readonly resolution?: string;
984
+ /** Number of outputs wanted. */
985
+ readonly count?: number;
986
+ readonly seed?: boolean;
987
+ readonly negativePrompt?: boolean;
988
+ readonly outputFormat?: boolean;
989
+ /** A rigged mesh wanted. */
990
+ readonly rig?: boolean;
991
+ /** The kind of Source passed in. Absent for a text-only request. */
992
+ readonly source?: "image" | "video";
993
+ /** A named variant of the Task, e.g. `"text"` for erase. */
994
+ readonly mode?: string;
995
+ }
996
+ interface TaskEnvironment {
997
+ /** Names of the provider key variables that are set, e.g. `["FAL_KEY"]`. */
998
+ readonly keys: readonly string[];
999
+ /** Models pinned per Task in config (`tasks.<task>.model`). */
1000
+ readonly pins?: Readonly<Partial<Record<TaskId, string>>>;
1001
+ }
1002
+ /** Which rule fixed the Model. */
1003
+ type ChosenBy = "look" | "model" | "pin" | "ranking";
1004
+ type Blocker = Capability | "key" | "mode" | "unknown-model";
1904
1005
  /**
1905
- * Machine-readable cost, so `--dry-run` can emit a number rather than the
1906
- * prose in `pricing`. Required on every entry: a missing price is what makes
1907
- * an agent unable to budget across a registry spanning $0.001 to $0.48.
1006
+ * What unblocks a refused request: name another Model, set a key, drop an
1007
+ * option the request asked for, or supply an input a Model needs (a mask).
1908
1008
  */
1909
- type FalToolPrice = {
1910
- kind: "call";
1911
- usd: number;
1912
- } | {
1913
- kind: "megapixel";
1914
- usd: number;
1915
- } | {
1916
- kind: "second";
1917
- usd: number;
1918
- } | {
1919
- kind: "metered";
1920
- };
1921
- interface FalToolConfig {
1922
- category: "3d" | "analysis" | "background" | "depth" | "erase" | "layers" | "material" | "moderation" | "preprocess" | "reframe" | "relight" | "restoration" | "segmentation" | "upscale" | "vector";
1923
- defaultOptions?: Record<string, unknown>;
1924
- description: string;
1925
- endpoint: string;
1926
- inputField: "image_url" | "image_urls" | "input_image_url" | "input_image_urls" | "video_url";
1927
- inputKind: FalToolInputKind;
1928
- name: string;
1929
- outputKeys: string[];
1930
- /**
1931
- * Names for the positions of an array-valued output. Used to name downloaded
1932
- * files: without it a PBR set lands as images-2.png, images-3.png and the
1933
- * caller cannot tell a roughness map from a normal map.
1934
- *
1935
- * Two rule shapes, because the names come from two different places.
1936
- *
1937
- * Request-driven: `fromOption` names the request option that actually
1938
- * determines the order — read the resolved request body first and use its
1939
- * value when present, since a caller may reorder or subset it. `fallback` is
1940
- * the endpoint's schema default, used when the option is absent.
1941
- *
1942
- * Response-driven: `fromItem` reads the name off each element of the output
1943
- * array itself, for endpoints that label what they produced (seedream's
1944
- * layer stack names every layer). `nameField` holds the name and
1945
- * `orderField`, when set, holds a non-negative integer that prefixes it so
1946
- * the files sort in stack order. These strings come from a model, so the
1947
- * consumer slugifies them into a filename and keeps positional naming when
1948
- * nothing usable survives.
1949
- *
1950
- * Whichever is used, check the label count against the URL count before
1951
- * applying it: a mislabelled map is worse than a positional one, because it
1952
- * reads as authoritative.
1953
- *
1954
- * Only set this where the order or the naming is actually determined — by a
1955
- * request option, by the schema, or by the response. Leave genuinely
1956
- * unordered, unnamed arrays unlabelled.
1957
- */
1958
- outputLabels?: Record<string, {
1959
- fallback: readonly string[];
1960
- fromOption?: string;
1961
- } | {
1962
- fromItem: {
1963
- nameField: string;
1964
- orderField?: string;
1965
- };
1966
- }>;
1967
- price: FalToolPrice;
1968
- pricing: string;
1969
- /**
1970
- * Endpoint routinely exceeds the 120s sync timeout; callers should use the
1971
- * queue path.
1972
- */
1973
- queued?: true;
1974
- sourceUrl: string;
1975
- task: string;
1009
+ type Unblocker = "input" | "key" | "model" | "option";
1010
+ export declare const NO_MODEL_AVAILABLE = "NO_MODEL_AVAILABLE";
1011
+ interface TaskResolved {
1012
+ readonly ok: true;
1013
+ readonly task: TaskId;
1014
+ readonly model: string;
1015
+ readonly tier: Tier;
1016
+ readonly rankedFrom: RankedFrom;
1017
+ readonly chosenBy: ChosenBy;
1976
1018
  }
1977
- interface FalToolRunOptions {
1978
- input?: string;
1979
- inputs?: string[];
1980
- options?: Record<string, unknown>;
1981
- tool: string;
1019
+ interface TaskUnresolved {
1020
+ readonly ok: false;
1021
+ readonly error: typeof NO_MODEL_AVAILABLE;
1022
+ readonly task: TaskId;
1023
+ /** The capability, or missing key, that stopped the best candidate. */
1024
+ readonly blockedBy: Blocker;
1025
+ /** What would unblock it: name a Model, set a key, drop the option. */
1026
+ readonly unblockedBy: readonly Unblocker[];
1027
+ /** The key variable that would unblock a Model, when one would. */
1028
+ readonly missingKey?: string;
1029
+ readonly message: string;
1982
1030
  }
1983
- interface FalToolRequest {
1984
- body: Record<string, unknown>;
1985
- endpoint: string;
1986
- tool: FalToolConfig;
1031
+ type TaskResolution = TaskResolved | TaskUnresolved;
1032
+ interface ModelProfile {
1033
+ readonly capabilities: ReadonlySet<Capability>;
1034
+ /** Capabilities reachable only when this key variable is set. */
1035
+ readonly keyedCapabilities: ReadonlyMap<Capability, string>;
1036
+ /** Key variables the Model needs for any request. */
1037
+ readonly keys: readonly string[];
1038
+ readonly maxReferences: number;
1039
+ /** Aspect ratios the Model accepts. Absent means any. */
1040
+ readonly aspects?: readonly string[];
1041
+ /** Resolutions the Model accepts. Absent means any. */
1042
+ readonly resolutions?: readonly string[];
1987
1043
  }
1988
- //#endregion
1989
- //#region src/tools.d.ts
1990
- export declare const FAL_TOOLS: {
1991
- readonly "got-ocr": {
1992
- readonly category: "analysis";
1993
- readonly description: "Transcribe text from one or more images, optionally as formatted multi-page output.";
1994
- readonly endpoint: "fal-ai/got-ocr/v2";
1995
- readonly inputField: "input_image_urls";
1996
- readonly inputKind: "images";
1997
- readonly name: "GOT-OCR 2.0";
1998
- readonly outputKeys: ["outputs"];
1999
- readonly price: {
2000
- readonly kind: "metered";
2001
- };
2002
- readonly pricing: "$0.05/image";
2003
- readonly queued: true;
2004
- readonly sourceUrl: "https://fal.ai/models/fal-ai/got-ocr/v2";
2005
- readonly task: "optical character recognition";
2006
- };
2007
- readonly "moondream-caption": {
2008
- readonly category: "analysis";
2009
- readonly description: "Write a short, normal, or long caption for an image.";
2010
- readonly endpoint: "fal-ai/moondream3-preview/caption";
2011
- readonly inputField: "image_url";
2012
- readonly inputKind: "image";
2013
- readonly name: "Moondream 3 Caption";
2014
- readonly outputKeys: ["output"];
2015
- readonly price: {
2016
- readonly kind: "metered";
2017
- };
2018
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
2019
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/caption";
2020
- readonly task: "image captioning";
2021
- };
2022
- readonly "moondream-detect": {
2023
- readonly category: "analysis";
2024
- readonly description: "Detect prompted objects and return their bounding boxes, with an optional preview.";
2025
- readonly endpoint: "fal-ai/moondream3-preview/detect";
2026
- readonly inputField: "image_url";
2027
- readonly inputKind: "image";
2028
- readonly name: "Moondream 3 Detect";
2029
- readonly outputKeys: ["objects", "image"];
2030
- readonly price: {
2031
- readonly kind: "metered";
2032
- };
2033
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
2034
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/detect";
2035
- readonly task: "object detection";
2036
- };
2037
- readonly "moondream-point": {
2038
- readonly category: "analysis";
2039
- readonly description: "Return point coordinates for every instance of a prompted subject.";
2040
- readonly endpoint: "fal-ai/moondream3-preview/point";
2041
- readonly inputField: "image_url";
2042
- readonly inputKind: "image";
2043
- readonly name: "Moondream 3 Point";
2044
- readonly outputKeys: ["points", "image"];
2045
- readonly price: {
2046
- readonly kind: "metered";
2047
- };
2048
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
2049
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/point";
2050
- readonly task: "object pointing";
2051
- };
2052
- readonly "moondream-query": {
2053
- readonly category: "analysis";
2054
- readonly description: "Answer a free-form question about an image, with reasoning.";
2055
- readonly endpoint: "fal-ai/moondream3-preview/query";
2056
- readonly inputField: "image_url";
2057
- readonly inputKind: "image";
2058
- readonly name: "Moondream 3 Query";
2059
- readonly outputKeys: ["output", "reasoning"];
2060
- readonly price: {
2061
- readonly kind: "metered";
2062
- };
2063
- readonly pricing: "$0.40/M input tokens, $3.50/M output tokens";
2064
- readonly sourceUrl: "https://fal.ai/models/fal-ai/moondream3-preview/query";
2065
- readonly task: "visual question answering";
2066
- };
2067
- readonly nsfw: {
2068
- readonly category: "moderation";
2069
- readonly description: "Predict whether one or more images contain NSFW concepts.";
2070
- readonly endpoint: "fal-ai/x-ailab/nsfw";
2071
- readonly inputField: "image_urls";
2072
- readonly inputKind: "images";
2073
- readonly name: "NSFW Checker";
2074
- readonly outputKeys: ["has_nsfw_concepts"];
2075
- readonly price: {
2076
- readonly kind: "metered";
2077
- };
2078
- readonly pricing: "$0.001/image";
2079
- readonly sourceUrl: "https://fal.ai/models/fal-ai/x-ailab/nsfw";
2080
- readonly task: "vision moderation";
2081
- };
2082
- readonly "hunyuan3d-v3": {
2083
- readonly category: "3d";
2084
- readonly description: "Reconstruct a textured 3D mesh from a single image, with optional multi-view inputs.";
2085
- readonly endpoint: "fal-ai/hunyuan3d-v3/image-to-3d";
2086
- readonly inputField: "input_image_url";
2087
- readonly inputKind: "image";
2088
- readonly name: "Hunyuan3D v3 Image to 3D";
2089
- readonly outputKeys: ["model_glb", "model_urls", "thumbnail"];
2090
- readonly price: {
2091
- readonly kind: "call";
2092
- readonly usd: 0.375;
2093
- };
2094
- 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";
2095
- readonly queued: true;
2096
- readonly sourceUrl: "https://fal.ai/models/fal-ai/hunyuan3d-v3/image-to-3d";
2097
- readonly task: "single-image 3D reconstruction";
2098
- };
2099
- readonly "ideogram-layerize-text": {
2100
- readonly category: "layers";
2101
- readonly description: "Split an image into background image layers plus editable HTML text containers.";
2102
- readonly endpoint: "fal-ai/ideogram/v3/layerize-text";
2103
- readonly inputField: "image_url";
2104
- readonly inputKind: "image";
2105
- readonly name: "Ideogram v3 Text Layerize";
2106
- readonly outputKeys: ["image_layers", "image", "text_html", "text_containers"];
2107
- readonly price: {
2108
- readonly kind: "call";
2109
- readonly usd: 0.09;
2110
- };
2111
- readonly pricing: "$0.09/image";
2112
- readonly queued: true;
2113
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/layerize-text";
2114
- readonly task: "text and image layer extraction";
2115
- };
2116
- readonly "ideogram-tiling": {
2117
- readonly category: "material";
2118
- readonly description: "Generate a seamlessly tiling texture, optionally conditioned on a source image.";
2119
- readonly endpoint: "ideogram/v4/tiling";
2120
- readonly inputField: "image_url";
2121
- readonly inputKind: "image";
2122
- readonly name: "Ideogram v4 Tiling";
2123
- readonly outputKeys: ["images"];
2124
- readonly price: {
2125
- readonly kind: "megapixel";
2126
- readonly usd: 0.06;
2127
- };
2128
- readonly pricing: "$0.06/megapixel at the default BALANCED speed; $0.03 turbo, $0.10 quality";
2129
- readonly sourceUrl: "https://fal.ai/models/ideogram/v4/tiling";
2130
- readonly task: "seamless texture generation";
2131
- };
2132
- readonly image2svg: {
2133
- readonly category: "vector";
2134
- readonly description: "Trace a raster image into layered SVG paths.";
2135
- readonly endpoint: "fal-ai/image2svg";
2136
- readonly inputField: "image_url";
2137
- readonly inputKind: "image";
2138
- readonly name: "Image to SVG";
2139
- readonly outputKeys: ["images"];
2140
- readonly price: {
2141
- readonly kind: "call";
2142
- readonly usd: 0.005;
2143
- };
2144
- readonly pricing: "$0.005/image";
2145
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image2svg";
2146
- readonly task: "raster to vector tracing";
2147
- };
2148
- readonly patina: {
2149
- readonly category: "material";
2150
- readonly description: "Decompose a surface photograph into PBR maps: basecolor, normal, roughness, metalness, height.";
2151
- readonly endpoint: "fal-ai/patina";
2152
- readonly inputField: "image_url";
2153
- readonly inputKind: "image";
2154
- readonly name: "Patina PBR Maps";
2155
- readonly outputKeys: ["images"];
2156
- readonly outputLabels: {
2157
- readonly images: {
2158
- readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
2159
- readonly fromOption: "maps";
2160
- };
2161
- };
2162
- readonly price: {
2163
- readonly kind: "metered";
2164
- };
2165
- 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";
2166
- readonly queued: true;
2167
- readonly sourceUrl: "https://fal.ai/models/fal-ai/patina";
2168
- readonly task: "PBR material decomposition";
2169
- };
2170
- readonly "patina-extract": {
2171
- readonly category: "material";
2172
- readonly description: "Extract a tiling PBR material from a prompted region of a photograph.";
2173
- readonly endpoint: "fal-ai/patina/material/extract";
2174
- readonly inputField: "image_url";
2175
- readonly inputKind: "image";
2176
- readonly name: "Patina Material Extract";
2177
- readonly outputKeys: ["images"];
2178
- readonly outputLabels: {
2179
- readonly images: {
2180
- readonly fallback: readonly ["basecolor", "normal", "roughness", "metalness", "height"];
2181
- readonly fromOption: "maps";
2182
- };
2183
- };
2184
- readonly price: {
2185
- readonly kind: "metered";
2186
- };
2187
- 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";
2188
- readonly queued: true;
2189
- readonly sourceUrl: "https://fal.ai/models/fal-ai/patina/material/extract";
2190
- readonly task: "tiling material extraction";
2191
- };
2192
- readonly "qwen-layered": {
2193
- readonly category: "layers";
2194
- readonly description: "Split an image into a configurable number of stacked RGBA layers.";
2195
- readonly endpoint: "fal-ai/qwen-image-layered";
2196
- readonly inputField: "image_url";
2197
- readonly inputKind: "image";
2198
- readonly name: "Qwen Image Layered";
2199
- readonly outputKeys: ["images"];
2200
- readonly price: {
2201
- readonly kind: "metered";
2202
- };
2203
- 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";
2204
- readonly queued: true;
2205
- readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-layered";
2206
- readonly task: "image layer decomposition";
2207
- };
2208
- readonly "recraft-vectorize": {
2209
- readonly category: "vector";
2210
- readonly description: "Convert a raster image into a clean SVG.";
2211
- readonly endpoint: "fal-ai/recraft/vectorize";
2212
- readonly inputField: "image_url";
2213
- readonly inputKind: "image";
2214
- readonly name: "Recraft Vectorize";
2215
- readonly outputKeys: ["image"];
2216
- readonly price: {
2217
- readonly kind: "call";
2218
- readonly usd: 0.04;
2219
- };
2220
- readonly pricing: "$0.04/image, $0.08 with a vector style";
2221
- readonly sourceUrl: "https://fal.ai/models/fal-ai/recraft/vectorize";
2222
- readonly task: "raster to vector conversion";
2223
- };
2224
- readonly "sam3-3d-align": {
2225
- readonly category: "3d";
2226
- readonly description: "Align SAM 3D objects and bodies into a shared scene.";
2227
- readonly endpoint: "fal-ai/sam-3/3d-align";
2228
- readonly inputField: "image_url";
2229
- readonly inputKind: "image";
2230
- readonly name: "SAM 3D Align";
2231
- readonly outputKeys: ["scene_glb", "model_glb", "visualization", "body_mesh_ply", "metadata"];
2232
- readonly price: {
2233
- readonly kind: "metered";
2234
- };
2235
- readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
2236
- readonly queued: true;
2237
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-align";
2238
- readonly task: "3D scene alignment";
2239
- };
2240
- readonly "sam3-3d-body": {
2241
- readonly category: "3d";
2242
- readonly defaultOptions: {
2243
- readonly export_meshes: true;
2244
- readonly include_3d_keypoints: true;
2245
- readonly include_mhr_params: true;
2246
- };
2247
- readonly description: "Reconstruct human body meshes and keypoints from a single image.";
2248
- readonly endpoint: "fal-ai/sam-3/3d-body";
2249
- readonly inputField: "image_url";
2250
- readonly inputKind: "image";
2251
- readonly name: "SAM 3D Body";
2252
- readonly outputKeys: ["model_glb", "visualization", "meshes", "metadata"];
2253
- readonly price: {
2254
- readonly kind: "metered";
2255
- };
2256
- readonly pricing: "$0.02 per unit; fal does not define a unit, so no estimate is reported";
2257
- readonly queued: true;
2258
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-body";
2259
- readonly task: "single-image 3D body reconstruction";
2260
- };
2261
- readonly "sam3-3d-objects": {
2262
- readonly category: "3d";
2263
- readonly defaultOptions: {
2264
- readonly prompt: "car";
2265
- };
2266
- readonly description: "Reconstruct one or more 3D objects from an image and prompts.";
2267
- readonly endpoint: "fal-ai/sam-3/3d-objects";
2268
- readonly inputField: "image_url";
2269
- readonly inputKind: "image";
2270
- readonly name: "SAM 3D Objects";
2271
- readonly outputKeys: ["gaussian_splat", "model_glb", "metadata", "individual_splats", "individual_glbs", "artifacts_zip"];
2272
- readonly price: {
2273
- readonly kind: "metered";
2274
- };
2275
- 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";
2276
- readonly queued: true;
2277
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-objects";
2278
- readonly task: "single-image 3D object reconstruction";
2279
- };
2280
- readonly "seedream-layerize": {
2281
- readonly category: "layers";
2282
- readonly description: "Split an image into editable Seedream layers plus flattened previews.";
2283
- readonly endpoint: "bytedance/seedream/v5/pro/layerize";
2284
- readonly inputField: "image_url";
2285
- readonly inputKind: "image";
2286
- readonly name: "Seedream v5 Pro Layerize";
2287
- readonly outputKeys: ["layers", "images"];
2288
- readonly outputLabels: {
2289
- readonly layers: {
2290
- readonly fromItem: {
2291
- readonly nameField: "name";
2292
- readonly orderField: "z_index";
2293
- };
2294
- };
2295
- };
2296
- readonly price: {
2297
- readonly kind: "metered";
2298
- };
2299
- 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";
2300
- readonly queued: true;
2301
- readonly sourceUrl: "https://fal.ai/models/bytedance/seedream/v5/pro/layerize";
2302
- readonly task: "image layer decomposition";
2303
- };
2304
- readonly "seedvr-seamless": {
2305
- readonly category: "material";
2306
- readonly description: "Upscale a tiling texture while keeping its edges seamless. ";
2307
- readonly endpoint: "fal-ai/seedvr/upscale/image/seamless";
2308
- readonly inputField: "image_url";
2309
- readonly inputKind: "image";
2310
- readonly name: "SeedVR Seamless Upscale";
2311
- readonly outputKeys: ["image"];
2312
- readonly price: {
2313
- readonly kind: "megapixel";
2314
- readonly usd: 0.0025;
2315
- };
2316
- readonly pricing: "$0.0025/megapixel";
2317
- readonly queued: true;
2318
- readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image/seamless";
2319
- readonly task: "seamless texture upscaling";
2320
- };
2321
- readonly "trellis-2": {
2322
- readonly category: "3d";
2323
- readonly description: "Reconstruct a textured 3D mesh from a single image, with UV unwrapping.";
2324
- readonly endpoint: "fal-ai/trellis-2";
2325
- readonly inputField: "image_url";
2326
- readonly inputKind: "image";
2327
- readonly name: "TRELLIS 2";
2328
- readonly outputKeys: ["model_glb"];
2329
- readonly price: {
2330
- readonly kind: "call";
2331
- readonly usd: 0.3;
2332
- };
2333
- readonly pricing: "$0.30 at the default 1024p; $0.25 at 512p, $0.35 at 1536p";
2334
- readonly queued: true;
2335
- readonly sourceUrl: "https://fal.ai/models/fal-ai/trellis-2";
2336
- readonly task: "single-image 3D reconstruction";
2337
- };
2338
- readonly "ben-v2": {
2339
- readonly category: "background";
2340
- readonly description: "Fast, high-quality background removal for images.";
2341
- readonly endpoint: "fal-ai/ben/v2/image";
2342
- readonly inputField: "image_url";
2343
- readonly inputKind: "image";
2344
- readonly name: "BEN v2 Background Removal";
2345
- readonly outputKeys: ["image"];
2346
- readonly price: {
2347
- readonly kind: "megapixel";
2348
- readonly usd: 0.025;
2349
- };
2350
- readonly pricing: "$0.025/megapixel";
2351
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ben/v2/image";
2352
- readonly task: "image background removal";
2353
- };
2354
- readonly birefnet: {
2355
- readonly category: "background";
2356
- readonly defaultOptions: {
2357
- readonly model: "General Use (Light)";
2358
- readonly operating_resolution: "1024x1024";
2359
- readonly output_format: "png";
2360
- readonly refine_foreground: true;
2361
- };
2362
- readonly description: "High-resolution dichotomous image segmentation and background removal.";
2363
- readonly endpoint: "fal-ai/birefnet/v2";
2364
- readonly inputField: "image_url";
2365
- readonly inputKind: "image";
2366
- readonly name: "BirefNet Background Removal";
2367
- readonly outputKeys: ["image", "mask_image"];
2368
- readonly price: {
2369
- readonly kind: "metered";
2370
- };
2371
- readonly pricing: "$0/compute-second listed by fal";
2372
- readonly sourceUrl: "https://fal.ai/models/fal-ai/birefnet/v2";
2373
- readonly task: "image background removal";
2374
- };
2375
- readonly "bria-rmbg": {
2376
- readonly category: "background";
2377
- readonly description: "Commercial-safe background removal for images.";
2378
- readonly endpoint: "fal-ai/bria/background/remove";
2379
- readonly inputField: "image_url";
2380
- readonly inputKind: "image";
2381
- readonly name: "Bria RMBG 2.0";
2382
- readonly outputKeys: ["image"];
2383
- readonly price: {
2384
- readonly kind: "call";
2385
- readonly usd: 0.018;
2386
- };
2387
- readonly pricing: "$0.018/generation";
2388
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/background/remove";
2389
- readonly task: "image background removal";
2390
- };
2391
- readonly "bria-video-rmbg": {
2392
- readonly category: "background";
2393
- readonly defaultOptions: {
2394
- readonly background_color: "Black";
2395
- readonly output_container_and_codec: "webm_vp9";
2396
- readonly preserve_audio: true;
2397
- };
2398
- readonly description: "Remove video backgrounds with configurable output container.";
2399
- readonly endpoint: "bria/video/background-removal";
2400
- readonly inputField: "video_url";
2401
- readonly inputKind: "video";
2402
- readonly name: "Bria Video Background Removal";
2403
- readonly outputKeys: ["video"];
2404
- readonly price: {
2405
- readonly kind: "second";
2406
- readonly usd: 0.00425;
2407
- };
2408
- readonly pricing: "$0.00425/sec";
2409
- readonly queued: true;
2410
- readonly sourceUrl: "https://fal.ai/models/bria/video/background-removal";
2411
- readonly task: "video background removal";
2412
- };
2413
- readonly ddcolor: {
2414
- readonly category: "restoration";
2415
- readonly description: "Colourise black-and-white photographs.";
2416
- readonly endpoint: "fal-ai/ddcolor";
2417
- readonly inputField: "image_url";
2418
- readonly inputKind: "image";
2419
- readonly name: "DDColor Colourisation";
2420
- readonly outputKeys: ["image"];
2421
- readonly price: {
2422
- readonly kind: "megapixel";
2423
- readonly usd: 0.001;
2424
- };
2425
- readonly pricing: "$0.001/megapixel";
2426
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ddcolor";
2427
- readonly task: "photo colourisation";
2428
- };
2429
- readonly rembg: {
2430
- readonly category: "background";
2431
- readonly defaultOptions: {
2432
- readonly crop_to_bbox: false;
2433
- };
2434
- readonly description: "Generic image background removal utility.";
2435
- readonly endpoint: "fal-ai/imageutils/rembg";
2436
- readonly inputField: "image_url";
2437
- readonly inputKind: "image";
2438
- readonly name: "Remove Background";
2439
- readonly outputKeys: ["image"];
2440
- readonly price: {
2441
- readonly kind: "metered";
2442
- };
2443
- readonly pricing: "$0/compute-second listed by fal";
2444
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/rembg";
2445
- readonly task: "image background removal";
2446
- };
2447
- readonly "seedvr-upscale": {
2448
- readonly category: "restoration";
2449
- readonly defaultOptions: {
2450
- readonly output_format: "png";
2451
- };
2452
- readonly description: "Diffusion image restoration and upscaling with SeedVR.";
2453
- readonly endpoint: "fal-ai/seedvr/upscale/image";
2454
- readonly inputField: "image_url";
2455
- readonly inputKind: "image";
2456
- readonly name: "SeedVR Image Upscale";
2457
- readonly outputKeys: ["image"];
2458
- readonly price: {
2459
- readonly kind: "megapixel";
2460
- readonly usd: 0.001;
2461
- };
2462
- readonly pricing: "$0.001/megapixel";
2463
- readonly queued: true;
2464
- readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image";
2465
- readonly task: "image restoration and upscaling";
2466
- };
2467
- readonly "topaz-adjust": {
2468
- readonly category: "restoration";
2469
- readonly defaultOptions: {
2470
- readonly output_format: "png";
2471
- };
2472
- readonly description: "Topaz exposure, white balance, and colour adjustment.";
2473
- readonly endpoint: "topaz/adjust/image";
2474
- readonly inputField: "image_url";
2475
- readonly inputKind: "image";
2476
- readonly name: "Topaz Adjust";
2477
- readonly outputKeys: ["image"];
2478
- readonly price: {
2479
- readonly kind: "megapixel";
2480
- readonly usd: number;
2481
- };
2482
- readonly pricing: "$0.08 per 24 output megapixels";
2483
- readonly queued: true;
2484
- readonly sourceUrl: "https://fal.ai/models/topaz/adjust/image";
2485
- readonly task: "tonal adjustment";
2486
- };
2487
- readonly "topaz-creative": {
2488
- readonly category: "restoration";
2489
- readonly defaultOptions: {
2490
- readonly output_format: "png";
2491
- };
2492
- readonly description: "Topaz Bloom upscaling, which reimagines detail rather than preserving it.";
2493
- readonly endpoint: "topaz/upscale/image/creative";
2494
- readonly inputField: "image_url";
2495
- readonly inputKind: "image";
2496
- readonly name: "Topaz Creative Upscale";
2497
- readonly outputKeys: ["image"];
2498
- readonly price: {
2499
- readonly kind: "megapixel";
2500
- readonly usd: number;
2501
- };
2502
- readonly pricing: "$0.96 per 24 output megapixels";
2503
- readonly queued: true;
2504
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/creative";
2505
- readonly task: "creative image upscaling";
2506
- };
2507
- readonly "topaz-denoise": {
2508
- readonly category: "restoration";
2509
- readonly defaultOptions: {
2510
- readonly output_format: "png";
2511
- };
2512
- readonly description: "Topaz noise reduction at source resolution.";
2513
- readonly endpoint: "topaz/denoise/image";
2514
- readonly inputField: "image_url";
2515
- readonly inputKind: "image";
2516
- readonly name: "Topaz Denoise";
2517
- readonly outputKeys: ["image"];
2518
- readonly price: {
2519
- readonly kind: "megapixel";
2520
- readonly usd: number;
2521
- };
2522
- readonly pricing: "$0.08 per 24 output megapixels at the default Normal model; $0.16 with Denoise Max";
2523
- readonly queued: true;
2524
- readonly sourceUrl: "https://fal.ai/models/topaz/denoise/image";
2525
- readonly task: "image denoising";
2526
- };
2527
- readonly "topaz-generative": {
2528
- readonly category: "restoration";
2529
- readonly defaultOptions: {
2530
- readonly output_format: "png";
2531
- };
2532
- readonly description: "Topaz Wonder upscaling, which synthesises plausible detail as it enlarges.";
2533
- readonly endpoint: "topaz/upscale/image/generative";
2534
- readonly inputField: "image_url";
2535
- readonly inputKind: "image";
2536
- readonly name: "Topaz Generative Upscale";
2537
- readonly outputKeys: ["image"];
2538
- readonly price: {
2539
- readonly kind: "megapixel";
2540
- readonly usd: number;
2541
- };
2542
- 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";
2543
- readonly queued: true;
2544
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/generative";
2545
- readonly task: "generative image upscaling";
2546
- };
2547
- readonly "topaz-image": {
2548
- readonly category: "upscale";
2549
- readonly defaultOptions: {
2550
- readonly model: "Standard V2";
2551
- readonly output_format: "jpeg";
2552
- readonly upscale_factor: 2;
2553
- };
2554
- readonly description: "Professional Topaz image enhancement and upscaling.";
2555
- readonly endpoint: "fal-ai/topaz/upscale/image";
2556
- readonly inputField: "image_url";
2557
- readonly inputKind: "image";
2558
- readonly name: "Topaz Image Upscale";
2559
- readonly outputKeys: ["image"];
2560
- readonly price: {
2561
- readonly kind: "megapixel";
2562
- readonly usd: number;
2563
- };
2564
- readonly pricing: "$0.08 for output up to 24MP; $0.16 to 48MP, $0.32 to 96MP, up to $1.36 at 512MP";
2565
- readonly queued: true;
2566
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image";
2567
- readonly task: "image enhancement";
2568
- };
2569
- readonly "topaz-precision": {
2570
- readonly category: "restoration";
2571
- readonly defaultOptions: {
2572
- readonly output_format: "png";
2573
- };
2574
- readonly description: "Topaz upscaling that preserves the original detail rather than inventing it.";
2575
- readonly endpoint: "topaz/upscale/image/precision";
2576
- readonly inputField: "image_url";
2577
- readonly inputKind: "image";
2578
- readonly name: "Topaz Precision Upscale";
2579
- readonly outputKeys: ["image"];
2580
- readonly price: {
2581
- readonly kind: "megapixel";
2582
- readonly usd: number;
2583
- };
2584
- readonly pricing: "$0.08 per 24 output megapixels, any precision model";
2585
- readonly queued: true;
2586
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/precision";
2587
- readonly task: "faithful image upscaling";
2588
- };
2589
- readonly "topaz-restore": {
2590
- readonly category: "restoration";
2591
- readonly defaultOptions: {
2592
- readonly output_format: "png";
2593
- };
2594
- readonly description: "Topaz restoration of damaged or degraded photographs at source resolution.";
2595
- readonly endpoint: "topaz/restore/image";
2596
- readonly inputField: "image_url";
2597
- readonly inputKind: "image";
2598
- readonly name: "Topaz Restore";
2599
- readonly outputKeys: ["image"];
2600
- readonly price: {
2601
- readonly kind: "megapixel";
2602
- readonly usd: number;
2603
- };
2604
- readonly pricing: "$0.48 per 24 output megapixels at the default Recover 3; $0.08 with Dust-Scratch V2";
2605
- readonly queued: true;
2606
- readonly sourceUrl: "https://fal.ai/models/topaz/restore/image";
2607
- readonly task: "photo restoration";
2608
- };
2609
- readonly "topaz-sharpen": {
2610
- readonly category: "restoration";
2611
- readonly defaultOptions: {
2612
- readonly output_format: "png";
2613
- };
2614
- readonly description: "Topaz deblurring and sharpening at source resolution.";
2615
- readonly endpoint: "topaz/sharpen/image";
2616
- readonly inputField: "image_url";
2617
- readonly inputKind: "image";
2618
- readonly name: "Topaz Sharpen";
2619
- readonly outputKeys: ["image"];
2620
- readonly price: {
2621
- readonly kind: "megapixel";
2622
- readonly usd: number;
2623
- };
2624
- readonly pricing: "$0.08 per 24 output megapixels at the default Standard model; $0.16 with Super Focus";
2625
- readonly queued: true;
2626
- readonly sourceUrl: "https://fal.ai/models/topaz/sharpen/image";
2627
- readonly task: "image sharpening";
2628
- };
2629
- readonly "topaz-transparent": {
2630
- readonly category: "restoration";
2631
- readonly description: "Topaz upscaling that preserves the alpha channel end to end.";
2632
- readonly endpoint: "topaz/upscale/image/transparent";
2633
- readonly inputField: "image_url";
2634
- readonly inputKind: "image";
2635
- readonly name: "Topaz Transparent Upscale";
2636
- readonly outputKeys: ["image"];
2637
- readonly price: {
2638
- readonly kind: "megapixel";
2639
- readonly usd: number;
2640
- };
2641
- readonly pricing: "$0.08 per 24 output megapixels";
2642
- readonly queued: true;
2643
- readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/transparent";
2644
- readonly task: "transparent image upscaling";
2645
- };
2646
- readonly "topaz-video": {
2647
- readonly category: "upscale";
2648
- readonly defaultOptions: {
2649
- readonly model: "Proteus";
2650
- readonly upscale_factor: 2;
2651
- };
2652
- readonly description: "Professional Topaz video enhancement and upscaling.";
2653
- readonly endpoint: "fal-ai/topaz/upscale/video";
2654
- readonly inputField: "video_url";
2655
- readonly inputKind: "video";
2656
- readonly name: "Topaz Video Upscale";
2657
- readonly outputKeys: ["video"];
2658
- readonly price: {
2659
- readonly kind: "second";
2660
- readonly usd: 0.01;
2661
- };
2662
- readonly pricing: "$0.01/sec up to 720p; $0.02 to 1080p, $0.08 above, doubled at 60fps, halved with Gaia 2";
2663
- readonly queued: true;
2664
- readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video";
2665
- readonly task: "video enhancement";
2666
- };
2667
- readonly "bria-eraser": {
2668
- readonly category: "erase";
2669
- readonly description: "Commercial-safe removal of a masked region, inpainted from surrounding context.";
2670
- readonly endpoint: "fal-ai/bria/eraser";
2671
- readonly inputField: "image_url";
2672
- readonly inputKind: "image";
2673
- readonly name: "Bria Eraser";
2674
- readonly outputKeys: ["image"];
2675
- readonly price: {
2676
- readonly kind: "call";
2677
- readonly usd: 0.04;
2678
- };
2679
- readonly pricing: "$0.04/generation";
2680
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/eraser";
2681
- readonly task: "masked object erasure";
2682
- };
2683
- readonly "bria-expand": {
2684
- readonly category: "reframe";
2685
- readonly description: "Expand an image onto a larger canvas, generating the new border area.";
2686
- readonly endpoint: "fal-ai/bria/expand";
2687
- readonly inputField: "image_url";
2688
- readonly inputKind: "image";
2689
- readonly name: "Bria Image Expansion";
2690
- readonly outputKeys: ["image"];
2691
- readonly price: {
2692
- readonly kind: "call";
2693
- readonly usd: 0.04;
2694
- };
2695
- readonly pricing: "$0.04/generation";
2696
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/expand";
2697
- readonly task: "image outpainting";
2698
- };
2699
- readonly "bria-genfill": {
2700
- readonly category: "erase";
2701
- readonly description: "Generative fill of a masked region from a prompt, commercial-safe.";
2702
- readonly endpoint: "fal-ai/bria/genfill";
2703
- readonly inputField: "image_url";
2704
- readonly inputKind: "image";
2705
- readonly name: "Bria GenFill";
2706
- readonly outputKeys: ["images"];
2707
- readonly price: {
2708
- readonly kind: "call";
2709
- readonly usd: 0.04;
2710
- };
2711
- readonly pricing: "$0.04/generation";
2712
- readonly sourceUrl: "https://fal.ai/models/fal-ai/bria/genfill";
2713
- readonly task: "masked generative fill";
2714
- };
2715
- readonly "finegrain-eraser": {
2716
- readonly category: "erase";
2717
- readonly description: "Remove a prompted object and its shadows and reflections, filling the gap.";
2718
- readonly endpoint: "fal-ai/finegrain-eraser";
2719
- readonly inputField: "image_url";
2720
- readonly inputKind: "image";
2721
- readonly name: "Finegrain Object Eraser";
2722
- readonly outputKeys: ["image"];
2723
- readonly price: {
2724
- readonly kind: "call";
2725
- readonly usd: 0.27;
2726
- };
2727
- readonly pricing: "$0.27/image at the default standard mode; $0.18 express, $0.36 premium";
2728
- readonly sourceUrl: "https://fal.ai/models/fal-ai/finegrain-eraser";
2729
- readonly task: "prompted object erasure";
2730
- };
2731
- readonly "flux-outpaint": {
2732
- readonly category: "reframe";
2733
- readonly description: "Outpaint an image by a per-edge pixel expansion with FLUX.2 pro.";
2734
- readonly endpoint: "fal-ai/flux-2-pro/outpaint";
2735
- readonly inputField: "image_url";
2736
- readonly inputKind: "image";
2737
- readonly name: "FLUX.2 Pro Outpaint";
2738
- readonly outputKeys: ["images"];
2739
- readonly price: {
2740
- readonly kind: "metered";
2741
- };
2742
- readonly pricing: "$0.03 for the first output megapixel, then $0.015 per extra megapixel of input and output, rounded up";
2743
- readonly sourceUrl: "https://fal.ai/models/fal-ai/flux-2-pro/outpaint";
2744
- readonly task: "image outpainting";
2745
- };
2746
- readonly "iclight-v2": {
2747
- readonly category: "relight";
2748
- readonly description: "Relight a subject from a prompt, harmonising it with a new light direction.";
2749
- readonly endpoint: "fal-ai/iclight-v2";
2750
- readonly inputField: "image_url";
2751
- readonly inputKind: "image";
2752
- readonly name: "IC-Light v2";
2753
- readonly outputKeys: ["images"];
2754
- readonly price: {
2755
- readonly kind: "megapixel";
2756
- readonly usd: 0.1;
2757
- };
2758
- readonly pricing: "$0.10/megapixel";
2759
- readonly sourceUrl: "https://fal.ai/models/fal-ai/iclight-v2";
2760
- readonly task: "prompted relighting";
2761
- };
2762
- readonly "ideogram-reframe": {
2763
- readonly category: "reframe";
2764
- readonly description: "Reframe an image to a new aspect ratio, generating the fill.";
2765
- readonly endpoint: "fal-ai/ideogram/v3/reframe";
2766
- readonly inputField: "image_url";
2767
- readonly inputKind: "image";
2768
- readonly name: "Ideogram v3 Reframe";
2769
- readonly outputKeys: ["images"];
2770
- readonly price: {
2771
- readonly kind: "call";
2772
- readonly usd: 0.06;
2773
- };
2774
- readonly pricing: "$0.06/image at the default BALANCED speed; $0.03 turbo, $0.09 quality";
2775
- readonly sourceUrl: "https://fal.ai/models/fal-ai/ideogram/v3/reframe";
2776
- readonly task: "aspect ratio reframing";
2777
- };
2778
- readonly "lighting-restoration": {
2779
- readonly category: "relight";
2780
- readonly description: "Restore natural, even lighting across one or more input images.";
2781
- readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
2782
- readonly inputField: "image_urls";
2783
- readonly inputKind: "images";
2784
- readonly name: "Qwen Lighting Restoration";
2785
- readonly outputKeys: ["images"];
2786
- readonly price: {
2787
- readonly kind: "megapixel";
2788
- readonly usd: 0.035;
2789
- };
2790
- readonly pricing: "$0.035/megapixel";
2791
- readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/lighting-restoration";
2792
- readonly task: "lighting restoration";
2793
- };
2794
- readonly "object-removal": {
2795
- readonly category: "erase";
2796
- readonly description: "Remove a prompted object from an image and fill the gap.";
2797
- readonly endpoint: "fal-ai/object-removal";
2798
- readonly inputField: "image_url";
2799
- readonly inputKind: "image";
2800
- readonly name: "Object Removal";
2801
- readonly outputKeys: ["images"];
2802
- readonly price: {
2803
- readonly kind: "call";
2804
- readonly usd: 0.024;
2805
- };
2806
- readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
2807
- readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal";
2808
- readonly task: "prompted object removal";
2809
- };
2810
- readonly "object-removal-bbox": {
2811
- readonly category: "erase";
2812
- readonly description: "Remove whatever falls inside supplied bounding boxes.";
2813
- readonly endpoint: "fal-ai/object-removal/bbox";
2814
- readonly inputField: "image_url";
2815
- readonly inputKind: "image";
2816
- readonly name: "Object Removal by Box";
2817
- readonly outputKeys: ["images"];
2818
- readonly price: {
2819
- readonly kind: "call";
2820
- readonly usd: 0.024;
2821
- };
2822
- readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
2823
- readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/bbox";
2824
- readonly task: "bounding box object removal";
2825
- };
2826
- readonly "object-removal-mask": {
2827
- readonly category: "erase";
2828
- readonly description: "Remove the masked region of an image and fill the gap.";
2829
- readonly endpoint: "fal-ai/object-removal/mask";
2830
- readonly inputField: "image_url";
2831
- readonly inputKind: "image";
2832
- readonly name: "Object Removal by Mask";
2833
- readonly outputKeys: ["images"];
2834
- readonly price: {
2835
- readonly kind: "call";
2836
- readonly usd: 0.024;
2837
- };
2838
- readonly pricing: "$0.024/image at the default best quality; $0.006 low, $0.012 medium, $0.018 high";
2839
- readonly sourceUrl: "https://fal.ai/models/fal-ai/object-removal/mask";
2840
- readonly task: "masked object removal";
2841
- };
2842
- readonly "remove-lighting": {
2843
- readonly category: "relight";
2844
- readonly description: "Strip baked-in lighting and shadows to leave a flat, neutral surface.";
2845
- readonly endpoint: "fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
2846
- readonly inputField: "image_urls";
2847
- readonly inputKind: "images";
2848
- readonly name: "Qwen Remove Lighting";
2849
- readonly outputKeys: ["images"];
2850
- readonly price: {
2851
- readonly kind: "megapixel";
2852
- readonly usd: 0.035;
2853
- };
2854
- readonly pricing: "$0.035/megapixel";
2855
- readonly sourceUrl: "https://fal.ai/models/fal-ai/qwen-image-edit-plus-lora-gallery/remove-lighting";
2856
- readonly task: "lighting removal";
2857
- };
2858
- readonly "smart-resize": {
2859
- readonly category: "reframe";
2860
- readonly description: "Resize one image to several target sizes, recomposing rather than cropping.";
2861
- readonly endpoint: "fal-ai/smart-resize";
2862
- readonly inputField: "image_url";
2863
- readonly inputKind: "image";
2864
- readonly name: "Smart Resize";
2865
- readonly outputKeys: ["images", "results"];
2866
- readonly price: {
2867
- readonly kind: "metered";
2868
- };
2869
- readonly pricing: "$0.15 per output image, doubled at 4K, plus a $0.05 vision analysis fee per request";
2870
- readonly queued: true;
2871
- readonly sourceUrl: "https://fal.ai/models/fal-ai/smart-resize";
2872
- readonly task: "multi-size recomposition";
2873
- };
2874
- readonly "text-removal": {
2875
- readonly category: "erase";
2876
- readonly defaultOptions: {
2877
- readonly output_format: "png";
2878
- };
2879
- readonly description: "Remove all rendered text from an image, rebuilding what sat behind it.";
2880
- readonly endpoint: "fal-ai/image-editing/text-removal";
2881
- readonly inputField: "image_url";
2882
- readonly inputKind: "image";
2883
- readonly name: "Text Removal";
2884
- readonly outputKeys: ["images"];
2885
- readonly price: {
2886
- readonly kind: "call";
2887
- readonly usd: 0.04;
2888
- };
2889
- readonly pricing: "$0.04/image";
2890
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-editing/text-removal";
2891
- readonly task: "text removal";
2892
- };
2893
- readonly "depth-anything": {
2894
- readonly category: "preprocess";
2895
- readonly description: "Generate Depth Anything v2 depth maps from input images.";
2896
- readonly endpoint: "fal-ai/image-preprocessors/depth-anything/v2";
2897
- readonly inputField: "image_url";
2898
- readonly inputKind: "image";
2899
- readonly name: "Depth Anything v2 Preprocessor";
2900
- readonly outputKeys: ["image"];
2901
- readonly price: {
2902
- readonly kind: "metered";
2903
- };
2904
- readonly pricing: "$0/compute-second listed by fal";
2905
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/depth-anything/v2";
2906
- readonly task: "depth preprocessing";
2907
- };
2908
- readonly dwpose: {
2909
- readonly category: "preprocess";
2910
- readonly description: "Extract body, hand, and face pose skeletons from an image.";
2911
- readonly endpoint: "fal-ai/dwpose";
2912
- readonly inputField: "image_url";
2913
- readonly inputKind: "image";
2914
- readonly name: "DWPose Estimation";
2915
- readonly outputKeys: ["image"];
2916
- readonly price: {
2917
- readonly kind: "second";
2918
- readonly usd: 0.0006;
2919
- };
2920
- readonly pricing: "$0.0006/compute-second";
2921
- readonly sourceUrl: "https://fal.ai/models/fal-ai/dwpose";
2922
- readonly task: "pose preprocessing";
2923
- };
2924
- readonly hed: {
2925
- readonly category: "preprocess";
2926
- readonly description: "Generate HED soft edge maps for ControlNet-style workflows.";
2927
- readonly endpoint: "fal-ai/image-preprocessors/hed";
2928
- readonly inputField: "image_url";
2929
- readonly inputKind: "image";
2930
- readonly name: "HED Edge Preprocessor";
2931
- readonly outputKeys: ["image"];
2932
- readonly price: {
2933
- readonly kind: "metered";
2934
- };
2935
- readonly pricing: "$0/compute-second listed by fal";
2936
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/hed";
2937
- readonly task: "edge preprocessing";
2938
- };
2939
- readonly lineart: {
2940
- readonly category: "preprocess";
2941
- readonly defaultOptions: {
2942
- readonly coarse: false;
2943
- };
2944
- readonly description: "Generate line art/control-style edges from an input image.";
2945
- readonly endpoint: "fal-ai/image-preprocessors/lineart";
2946
- readonly inputField: "image_url";
2947
- readonly inputKind: "image";
2948
- readonly name: "Line Art Preprocessor";
2949
- readonly outputKeys: ["image"];
2950
- readonly price: {
2951
- readonly kind: "metered";
2952
- };
2953
- readonly pricing: "$0/compute-second listed by fal";
2954
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/lineart";
2955
- readonly task: "image preprocessing";
2956
- };
2957
- readonly "marigold-depth": {
2958
- readonly category: "depth";
2959
- readonly defaultOptions: {
2960
- readonly ensemble_size: 10;
2961
- readonly num_inference_steps: 10;
2962
- };
2963
- readonly description: "Create depth maps using Marigold depth estimation.";
2964
- readonly endpoint: "fal-ai/imageutils/marigold-depth";
2965
- readonly inputField: "image_url";
2966
- readonly inputKind: "image";
2967
- readonly name: "Marigold Depth Estimation";
2968
- readonly outputKeys: ["image"];
2969
- readonly price: {
2970
- readonly kind: "metered";
2971
- };
2972
- readonly pricing: "$0/compute-second listed by fal";
2973
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/marigold-depth";
2974
- readonly task: "depth map";
2975
- };
2976
- readonly "midas-depth": {
2977
- readonly category: "depth";
2978
- readonly defaultOptions: {
2979
- readonly a: number;
2980
- readonly bg_th: 0.1;
2981
- };
2982
- readonly description: "Create MiDaS depth maps from input images.";
2983
- readonly endpoint: "fal-ai/imageutils/depth";
2984
- readonly inputField: "image_url";
2985
- readonly inputKind: "image";
2986
- readonly name: "MiDaS Depth Estimation";
2987
- readonly outputKeys: ["image"];
2988
- readonly price: {
2989
- readonly kind: "metered";
2990
- };
2991
- readonly pricing: "$0/compute-second listed by fal";
2992
- readonly sourceUrl: "https://fal.ai/models/fal-ai/imageutils/depth";
2993
- readonly task: "depth map";
2994
- };
2995
- readonly "midas-preprocessor": {
2996
- readonly category: "preprocess";
2997
- readonly description: "Generate MiDaS depth and normal maps for image workflows.";
2998
- readonly endpoint: "fal-ai/image-preprocessors/midas";
2999
- readonly inputField: "image_url";
3000
- readonly inputKind: "image";
3001
- readonly name: "MiDaS Preprocessor";
3002
- readonly outputKeys: ["depth_map", "normal_map"];
3003
- readonly price: {
3004
- readonly kind: "metered";
3005
- };
3006
- readonly pricing: "$0/compute-second listed by fal";
3007
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/midas";
3008
- readonly task: "depth and normal preprocessing";
3009
- };
3010
- readonly mlsd: {
3011
- readonly category: "preprocess";
3012
- readonly description: "Detect straight line segments for architectural and interior control maps.";
3013
- readonly endpoint: "fal-ai/image-preprocessors/mlsd";
3014
- readonly inputField: "image_url";
3015
- readonly inputKind: "image";
3016
- readonly name: "M-LSD Line Preprocessor";
3017
- readonly outputKeys: ["image"];
3018
- readonly price: {
3019
- readonly kind: "metered";
3020
- };
3021
- readonly pricing: "$0/compute-second listed by fal";
3022
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/mlsd";
3023
- readonly task: "line segment preprocessing";
3024
- };
3025
- readonly pidi: {
3026
- readonly category: "preprocess";
3027
- readonly description: "Generate PiDiNet soft edge maps from an input image.";
3028
- readonly endpoint: "fal-ai/image-preprocessors/pidi";
3029
- readonly inputField: "image_url";
3030
- readonly inputKind: "image";
3031
- readonly name: "PiDiNet Edge Preprocessor";
3032
- readonly outputKeys: ["image"];
3033
- readonly price: {
3034
- readonly kind: "metered";
3035
- };
3036
- readonly pricing: "$0/compute-second listed by fal";
3037
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/pidi";
3038
- readonly task: "edge preprocessing";
3039
- };
3040
- readonly "sam-preprocessor": {
3041
- readonly category: "preprocess";
3042
- readonly description: "Generate a SAM segmentation map for ControlNet-style workflows.";
3043
- readonly endpoint: "fal-ai/image-preprocessors/sam";
3044
- readonly inputField: "image_url";
3045
- readonly inputKind: "image";
3046
- readonly name: "SAM Preprocessor";
3047
- readonly outputKeys: ["image"];
3048
- readonly price: {
3049
- readonly kind: "metered";
3050
- };
3051
- readonly pricing: "$0/compute-second listed by fal";
3052
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/sam";
3053
- readonly task: "segmentation preprocessing";
3054
- };
3055
- readonly "sam2-auto": {
3056
- readonly category: "segmentation";
3057
- readonly defaultOptions: {
3058
- readonly min_mask_region_area: 100;
3059
- readonly output_format: "png";
3060
- readonly points_per_side: 32;
3061
- readonly pred_iou_thresh: 0.88;
3062
- readonly stability_score_thresh: 0.95;
3063
- };
3064
- readonly description: "Automatically segment an image into combined and individual masks.";
3065
- readonly endpoint: "fal-ai/sam2/auto-segment";
3066
- readonly inputField: "image_url";
3067
- readonly inputKind: "image";
3068
- readonly name: "SAM 2 Auto Segment";
3069
- readonly outputKeys: ["combined_mask", "individual_masks"];
3070
- readonly price: {
3071
- readonly kind: "metered";
3072
- };
3073
- readonly pricing: "$0/compute-second listed by fal";
3074
- readonly queued: true;
3075
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam2/auto-segment";
3076
- readonly task: "automatic image segmentation";
3077
- };
3078
- readonly "sam3-1-image": {
3079
- readonly category: "segmentation";
3080
- readonly defaultOptions: {
3081
- readonly apply_mask: true;
3082
- readonly max_masks: 3;
3083
- readonly output_format: "png";
3084
- };
3085
- readonly description: "Segment image objects with text, point, or box prompts. SAM 3.1 adds Object Multiplex for faster multi-object tracking.";
3086
- readonly endpoint: "fal-ai/sam-3-1/image";
3087
- readonly inputField: "image_url";
3088
- readonly inputKind: "image";
3089
- readonly name: "SAM 3.1 Image";
3090
- readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
3091
- readonly price: {
3092
- readonly kind: "call";
3093
- readonly usd: 0.01;
3094
- };
3095
- readonly pricing: "$0.01/request";
3096
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/image";
3097
- readonly task: "promptable image segmentation";
3098
- };
3099
- readonly "sam3-1-video": {
3100
- readonly category: "segmentation";
3101
- readonly defaultOptions: {
3102
- readonly apply_mask: true;
3103
- readonly prompt: "person";
3104
- };
3105
- readonly description: "SAM 3.1 video segmentation with Object Multiplex tracking for multiple objects.";
3106
- readonly endpoint: "fal-ai/sam-3-1/video";
3107
- readonly inputField: "video_url";
3108
- readonly inputKind: "video";
3109
- readonly name: "SAM 3.1 Video";
3110
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
3111
- readonly price: {
3112
- readonly kind: "metered";
3113
- };
3114
- readonly pricing: "$0.01/16 frames of video input";
3115
- readonly queued: true;
3116
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3-1/video";
3117
- readonly task: "multi-object video segmentation";
3118
- };
3119
- readonly "sam3-image": {
3120
- readonly category: "segmentation";
3121
- readonly defaultOptions: {
3122
- readonly apply_mask: true;
3123
- readonly max_masks: 3;
3124
- readonly output_format: "png";
3125
- };
3126
- readonly description: "Segment image objects with text, point, or box prompts.";
3127
- readonly endpoint: "fal-ai/sam-3/image";
3128
- readonly inputField: "image_url";
3129
- readonly inputKind: "image";
3130
- readonly name: "SAM 3 Image";
3131
- readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
3132
- readonly price: {
3133
- readonly kind: "call";
3134
- readonly usd: 0.005;
3135
- };
3136
- readonly pricing: "$0.005/request";
3137
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image";
3138
- readonly task: "promptable image segmentation";
3139
- };
3140
- readonly "sam3-image-rle": {
3141
- readonly category: "segmentation";
3142
- readonly defaultOptions: {
3143
- readonly apply_mask: true;
3144
- readonly max_masks: 3;
3145
- };
3146
- readonly description: "Segment image objects and return run-length encoded masks.";
3147
- readonly endpoint: "fal-ai/sam-3/image-rle";
3148
- readonly inputField: "image_url";
3149
- readonly inputKind: "image";
3150
- readonly name: "SAM 3 Image RLE";
3151
- readonly outputKeys: ["rle", "scores", "boxes", "metadata"];
3152
- readonly price: {
3153
- readonly kind: "call";
3154
- readonly usd: 0.005;
3155
- };
3156
- readonly pricing: "$0.005/request";
3157
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/image-rle";
3158
- readonly task: "promptable image segmentation to RLE";
3159
- };
3160
- readonly "sam3-video": {
3161
- readonly category: "segmentation";
3162
- readonly defaultOptions: {
3163
- readonly apply_mask: true;
3164
- readonly detection_threshold: 0.5;
3165
- readonly prompt: "person";
3166
- readonly video_output_type: "X264 (.mp4)";
3167
- };
3168
- readonly description: "Segment and track prompted objects across video frames.";
3169
- readonly endpoint: "fal-ai/sam-3/video";
3170
- readonly inputField: "video_url";
3171
- readonly inputKind: "video";
3172
- readonly name: "SAM 3 Video";
3173
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
3174
- readonly price: {
3175
- readonly kind: "metered";
3176
- };
3177
- readonly pricing: "$0.005/16 frames of video input";
3178
- readonly queued: true;
3179
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video";
3180
- readonly task: "promptable video segmentation";
3181
- };
3182
- readonly "sam3-video-rle": {
3183
- readonly category: "segmentation";
3184
- readonly defaultOptions: {
3185
- readonly apply_mask: true;
3186
- readonly detection_threshold: 0.5;
3187
- readonly prompt: "person";
3188
- };
3189
- readonly description: "Track prompted video objects and return RLE mask data.";
3190
- readonly endpoint: "fal-ai/sam-3/video-rle";
3191
- readonly inputField: "video_url";
3192
- readonly inputKind: "video";
3193
- readonly name: "SAM 3 Video RLE";
3194
- readonly outputKeys: ["video", "boundingbox_frames_zip"];
3195
- readonly price: {
3196
- readonly kind: "metered";
3197
- };
3198
- readonly pricing: "$0.005/16 frames of video";
3199
- readonly queued: true;
3200
- readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/video-rle";
3201
- readonly task: "promptable video segmentation to RLE";
3202
- };
3203
- readonly scribble: {
3204
- readonly category: "preprocess";
3205
- readonly description: "Turn an image into a scribble-style control map.";
3206
- readonly endpoint: "fal-ai/image-preprocessors/scribble";
3207
- readonly inputField: "image_url";
3208
- readonly inputKind: "image";
3209
- readonly name: "Scribble Preprocessor";
3210
- readonly outputKeys: ["image"];
3211
- readonly price: {
3212
- readonly kind: "metered";
3213
- };
3214
- readonly pricing: "$0/compute-second listed by fal";
3215
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/scribble";
3216
- readonly task: "scribble preprocessing";
3217
- };
3218
- readonly teed: {
3219
- readonly category: "preprocess";
3220
- readonly description: "Generate TEED edge maps from an input image.";
3221
- readonly endpoint: "fal-ai/image-preprocessors/teed";
3222
- readonly inputField: "image_url";
3223
- readonly inputKind: "image";
3224
- readonly name: "TEED Edge Preprocessor";
3225
- readonly outputKeys: ["image"];
3226
- readonly price: {
3227
- readonly kind: "metered";
3228
- };
3229
- readonly pricing: "$0/compute-second listed by fal";
3230
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/teed";
3231
- readonly task: "edge preprocessing";
3232
- };
3233
- readonly "zoe-depth": {
3234
- readonly category: "preprocess";
3235
- readonly description: "Generate ZoeDepth metric depth maps from an input image.";
3236
- readonly endpoint: "fal-ai/image-preprocessors/zoe";
3237
- readonly inputField: "image_url";
3238
- readonly inputKind: "image";
3239
- readonly name: "ZoeDepth Preprocessor";
3240
- readonly outputKeys: ["image"];
3241
- readonly price: {
3242
- readonly kind: "metered";
3243
- };
3244
- readonly pricing: "$0/compute-second listed by fal";
3245
- readonly sourceUrl: "https://fal.ai/models/fal-ai/image-preprocessors/zoe";
3246
- readonly task: "depth preprocessing";
3247
- };
3248
- };
3249
- export declare const FAL_TOOLS_CHECKED_AT = "2026-08-23";
3250
- export declare const FAL_TOOL_IDS: (keyof typeof FAL_TOOLS)[];
3251
- type FalToolId = (typeof FAL_TOOL_IDS)[number];
3252
- export declare function isFalToolId(tool: string): tool is FalToolId;
3253
- export declare function buildFalToolRequest(options: FalToolRunOptions): FalToolRequest;
1044
+ /** The profile for a Model id, or undefined when no registry knows it. */
1045
+ export declare function modelProfile(model: string): ModelProfile | undefined;
1046
+ /**
1047
+ * Choose the Model for a Task. Pure: no I/O, and the prompt is never read.
1048
+ *
1049
+ * `request.look` must already be a valid Look id; an unknown one is treated as
1050
+ * no Look, because Look validation belongs to the creative layer.
1051
+ */
1052
+ export declare function resolveTask(task: TaskId, request: TaskRequest, environment: TaskEnvironment): TaskResolution;
1053
+ /**
1054
+ * Whether the Tier changes the Model for this Task and request. False for a
1055
+ * Task with one qualifying Model, so `--describe` can say the Tier changes
1056
+ * nothing there.
1057
+ */
1058
+ export declare function tierChangesChoice(task: TaskId, request: Omit<TaskRequest, "tier">, environment: TaskEnvironment): boolean;
3254
1059
  //#endregion
3255
1060
  //#region src/tool-cost.d.ts
3256
1061
  /** Pixel dimensions of one file an endpoint returned. */
@@ -3258,6 +1063,14 @@ interface OutputDimensions {
3258
1063
  height?: number;
3259
1064
  width?: number;
3260
1065
  }
1066
+ /** What a caller knows of a source video before a run, read from its header. */
1067
+ interface SourceVideo {
1068
+ fps?: number;
1069
+ frames?: number;
1070
+ height?: number;
1071
+ seconds: number;
1072
+ width?: number;
1073
+ }
3261
1074
  /** A cost, and enough context for a caller to say why it is what it is. */
3262
1075
  interface ResolvedCost {
3263
1076
  /** USD, or null when the rate cannot be resolved against what we know. */
@@ -3269,22 +1082,6 @@ interface ResolvedCost {
3269
1082
  */
3270
1083
  basis: "measured" | "projected" | "unknown";
3271
1084
  }
3272
- /**
3273
- * The figure to show before a run, from the rate alone.
3274
- *
3275
- * Only a flat per-call price survives this: everything else depends on an
3276
- * output that does not exist yet, and guessing its size is how a dry run comes
3277
- * to promise a number the invoice contradicts.
3278
- */
3279
- export declare function projectedToolCost(price: FalToolPrice): ResolvedCost;
3280
- /**
3281
- * The figure to record after a run, from the rate and the output it produced.
3282
- *
3283
- * A per-megapixel rate becomes exact here, because the files have been written
3284
- * and measured. Per-second rates need a duration nothing in the image path
3285
- * carries, and metered endpoints publish no rate at all, so both stay unknown.
3286
- */
3287
- export declare function measuredToolCost(price: FalToolPrice, outputs: readonly OutputDimensions[]): ResolvedCost;
3288
1085
  /**
3289
1086
  * Render a cost for a human. `null` never becomes "$0.000" - it says what it
3290
1087
  * means, which is that nobody knows.
@@ -3302,61 +1099,205 @@ export declare function sumCosts(costs: readonly (number | null)[]): {
3302
1099
  unknown: number;
3303
1100
  };
3304
1101
  //#endregion
3305
- //#region src/tool-parameters.generated.d.ts
3306
- /** One argument an endpoint accepts. */
3307
- interface FalToolParameter {
3308
- /** Argument name, exactly as fal expects it in the request body. */
1102
+ //#region src/task-client.d.ts
1103
+ interface MotifClientConfig {
1104
+ /** Falls back to FAL_KEY. */
1105
+ falKey?: string;
1106
+ /** Falls back to OPENAI_API_KEY. Used only by Models routed through OpenAI. */
1107
+ openAiKey?: string;
1108
+ /** Models pinned per Task, as `resolveTask` takes them. */
1109
+ pins?: TaskEnvironment["pins"];
1110
+ /** The one network seam. Defaults to global fetch. Retries and timeouts still apply. */
1111
+ fetch?: FalFetch;
1112
+ timeout?: number;
1113
+ retries?: number;
1114
+ }
1115
+ interface TaskInput {
1116
+ /** Source image: https URL or data URL. */
1117
+ image?: string;
1118
+ /**
1119
+ * Boxes to act on, in whole pixels of the source image. A Model that takes
1120
+ * fractions gets them converted using the source's size.
1121
+ */
1122
+ boxes?: readonly {
1123
+ x: number;
1124
+ y: number;
1125
+ width: number;
1126
+ height: number;
1127
+ }[];
1128
+ /**
1129
+ * The source image's pixel size, needed to convert `boxes` for a Model that
1130
+ * takes fractions when `image` is an https URL. Read from a data URL itself.
1131
+ */
1132
+ sourceSize?: {
1133
+ width: number;
1134
+ height: number;
1135
+ };
1136
+ /**
1137
+ * The source video's length, frame count, size and frame rate, read from
1138
+ * its header by the caller. Per-second and per-frame Models price from it;
1139
+ * without it their projected cost is unknown.
1140
+ */
1141
+ sourceVideo?: SourceVideo;
1142
+ /** reframe `margin` mode: pixels to add on each edge. */
1143
+ margin?: {
1144
+ top: number;
1145
+ right: number;
1146
+ bottom: number;
1147
+ left: number;
1148
+ };
1149
+ /** Source video: https URL. */
1150
+ video?: string;
1151
+ prompt?: string;
1152
+ /** Mask image: https URL or data URL. */
1153
+ mask?: string;
1154
+ /** Reference images: https URLs or data URLs. restyle and try-on take exactly one. */
1155
+ references?: readonly string[];
1156
+ aspect?: AspectRatio;
1157
+ resolution?: Resolution;
1158
+ count?: number;
1159
+ seed?: number;
1160
+ negativePrompt?: string;
1161
+ outputFormat?: ImageOutputFormat;
1162
+ transparent?: boolean;
1163
+ /** Upscale factor. */
1164
+ scale?: number;
1165
+ /** reframe `sizes` mode: target sizes. */
1166
+ sizes?: readonly CustomImageSize[];
1167
+ /** animate: seconds. */
1168
+ duration?: number;
1169
+ /** mesh: rig the mesh for animation. */
1170
+ rig?: boolean;
1171
+ look?: string;
1172
+ mood?: string;
1173
+ tier?: Tier;
1174
+ model?: string;
1175
+ mode?: string;
1176
+ /** Model-only fal body fields, sent as given. Requires `model`. */
1177
+ params?: Readonly<Record<string, unknown>>;
1178
+ /** Ask fal not to store IO payloads. */
1179
+ ephemeral?: boolean;
1180
+ onProgress?: (status: string, queuePosition?: number) => void;
1181
+ }
1182
+ interface TaskFile {
1183
+ /** Output key the URL came from, e.g. "image", "masks", "model_glb". */
3309
1184
  key: string;
3310
- /** fal's own default when the caller sends nothing. */
3311
- fallback?: boolean | number | string | readonly unknown[];
3312
- /** Whether fal rejects the request without it. */
3313
- required?: true;
3314
- /** Compact rendering of fal's declared type, e.g. `enum(a|b)`, `list[string]`. */
3315
- type: string;
1185
+ url: string;
1186
+ /** Semantic name from the registry's outputLabels, when one applies. */
1187
+ label?: string;
3316
1188
  }
3317
- export declare const FAL_TOOL_PARAMETERS: Record<string, readonly FalToolParameter[]>;
3318
- /** Arguments a tool accepts, including ones Motif does not surface as flags. */
3319
- export declare function falToolParameters(tool: string): readonly FalToolParameter[];
3320
- //#endregion
3321
- //#region src/model-output.generated.d.ts
3322
- interface ModelOutputShape {
3323
- /** File container the endpoint returns. */
3324
- container: string;
3325
- /** Whether the encoding preserves every pixel exactly. */
3326
- lossless: boolean;
3327
- /** Bits per channel. */
3328
- bitDepth?: number;
3329
- /** Whether the returned file carries an alpha channel. */
3330
- hasAlpha?: boolean;
3331
- /** JPEG chroma subsampling, e.g. "4:4:4" or "4:2:0". Absent for lossless containers. */
3332
- subsampling?: string;
1189
+ interface TaskPlan {
1190
+ task: TaskId;
1191
+ model: string;
1192
+ tier: Tier;
1193
+ chosenBy: ChosenBy;
1194
+ mode?: string;
1195
+ endpoint: string;
1196
+ /** Request body as it will be sent. */
1197
+ body: Record<string, unknown>;
1198
+ /** Prompt after Look and Mood enrichment, when the Task takes one. */
1199
+ prompt?: string;
1200
+ queued: boolean;
1201
+ /** Projected: before the call. */
1202
+ cost: ResolvedCost;
1203
+ /** The provider carrying the request. "openai" only for a transparency route. */
1204
+ provider: "fal" | "openai";
1205
+ }
1206
+ interface TaskOutput extends Omit<TaskPlan, "body" | "cost" | "queued"> {
1207
+ files: TaskFile[];
1208
+ /** Non-file result fields: answer, reasoning, boxes, scores, points, rle, text... */
1209
+ data: Record<string, unknown>;
1210
+ /** Measured where the rate allows, else projected or unknown. */
1211
+ cost: ResolvedCost;
1212
+ requestId?: string;
1213
+ /** Raw provider response, for callers that need a field we don't lift. */
1214
+ raw: Record<string, unknown>;
3333
1215
  }
3334
- export declare const MODEL_OUTPUT: Record<string, ModelOutputShape>;
1216
+ interface PlanOptions {
1217
+ /** Resolve as if FAL_KEY were set, so a dry run can price without a key. */
1218
+ dryRun?: boolean;
1219
+ }
1220
+ type TaskFunction = (input: TaskInput) => Promise<Result$1<TaskOutput, MotifError>>;
1221
+ interface MotifClient {
1222
+ /** Pure: resolve the Model, build the request, price it. No I/O. */
1223
+ plan: (task: TaskId, input: TaskInput, options?: PlanOptions) => Result$1<TaskPlan, MotifError>;
1224
+ run: (task: TaskId, input: TaskInput) => Promise<Result$1<TaskOutput, MotifError>>;
1225
+ animate: TaskFunction;
1226
+ ask: TaskFunction;
1227
+ cutout: TaskFunction;
1228
+ erase: TaskFunction;
1229
+ generate: TaskFunction;
1230
+ layers: TaskFunction;
1231
+ map: TaskFunction;
1232
+ material: TaskFunction;
1233
+ mesh: TaskFunction;
1234
+ reframe: TaskFunction;
1235
+ relight: TaskFunction;
1236
+ restore: TaskFunction;
1237
+ restyle: TaskFunction;
1238
+ segment: TaskFunction;
1239
+ tile: TaskFunction;
1240
+ "try-on": TaskFunction;
1241
+ upscale: TaskFunction;
1242
+ vary: TaskFunction;
1243
+ vectorize: TaskFunction;
1244
+ /** Upload bytes to fal storage; returns the public URL. */
1245
+ upload: (bytes: Uint8Array, contentType: string, fileName?: string) => Promise<Result$1<string, MotifError>>;
1246
+ deletePayloads: (requestId: string) => Promise<Result$1<void, MotifError>>;
1247
+ }
1248
+ /** Create the Task client. Keys fall back to FAL_KEY and OPENAI_API_KEY. */
1249
+ export declare function createMotif(config?: MotifClientConfig): MotifClient;
3335
1250
  //#endregion
3336
- //#region src/model-output.d.ts
3337
- /** Whether a lossless file can be obtained, and what it costs to ask. */
3338
- type LosslessAvailability =
3339
- /** Lossless by default; ask for nothing. */
3340
- "default" |
3341
- /** Lossy by default, lossless when `outputFormat` is set. */
3342
- "on-request" |
3343
- /** No lossless route: the endpoint returns a lossy container and rejects the argument. */
3344
- "unavailable" |
3345
- /** Not probed. Absence of evidence, not evidence of a limitation. */
3346
- "unknown";
3347
- /** Measured shape of what a model returns by default, if it has been probed. */
3348
- export declare function modelOutput(model: string): ModelOutputShape | undefined;
1251
+ //#region src/task-plan-shared.d.ts
1252
+ export declare const INVALID_OPTION = "INVALID_OPTION";
1253
+ //#endregion
1254
+ //#region src/prompt-warnings.d.ts
3349
1255
  /**
3350
- * Whether this model can produce a lossless file at all.
1256
+ * Advisory checks on a user-written prompt.
3351
1257
  *
3352
- * The question a caller actually has, answered from the measured default and
3353
- * the accepted arguments together.
1258
+ * These run on the caller's own prompt only, never on look or mood text, and
1259
+ * never block a request. They flag phrasings that image models tend to
1260
+ * misread.
3354
1261
  */
3355
- export declare function losslessAvailability(model: string): LosslessAvailability;
1262
+ /** Stable id of a prompt warning rule. */
1263
+ type PromptWarningRule = "edit-has-verb" | "negated-object" | "text-bearing-object";
1264
+ /** One advisory finding about a prompt. */
1265
+ interface PromptWarning {
1266
+ /** The text in the prompt that triggered the rule. */
1267
+ match: string;
1268
+ /** Plain-English advice for the caller. */
1269
+ message: string;
1270
+ rule: PromptWarningRule;
1271
+ }
3356
1272
  /**
3357
- * One line a human or an agent can act on, e.g.
3358
- * `"jpeg 4:2:0, no lossless route"` or `"jpeg 4:4:4, PNG on request"`.
1273
+ * Check a user prompt for phrasings that tend to backfire.
1274
+ *
1275
+ * - `negated-object`: "no <object>" for anything other than text, logos,
1276
+ * people, faces, watermarks, words or lettering. Naming an object tends to
1277
+ * draw it into the picture.
1278
+ * - `text-bearing-object`: the prompt asks for no text or no words but also
1279
+ * names something that usually carries text, such as a sign or a poster.
1280
+ * - `edit-has-verb`: an edit (`context.editing`) whose prompt starts with
1281
+ * remove, erase, extend or outpaint, jobs the CLI has a verb for.
1282
+ *
1283
+ * Pass the caller's own prompt, not an enriched one, and `editing: true` when
1284
+ * the request carries reference images to edit.
3359
1285
  */
3360
- export declare function describeModelOutput(model: string): string;
1286
+ export declare function promptWarnings(prompt: string, context?: {
1287
+ editing?: boolean;
1288
+ }): PromptWarning[];
1289
+ //#endregion
1290
+ //#region src/env.d.ts
1291
+ export declare const motifEnvSchema: import("@howells/envy").EnvSchema<{
1292
+ readonly optional: {
1293
+ FAL_KEY: z.ZodString;
1294
+ OPENAI_API_KEY: z.ZodString;
1295
+ };
1296
+ }>;
1297
+ type MotifEnv = ReturnType<typeof motifEnvSchema.parse>;
1298
+ export declare function parseMotifEnv(input?: Record<string, unknown>): MotifEnv;
1299
+ export declare function getFalKeyFromEnv(input?: Record<string, unknown>): string | undefined;
1300
+ /** The OpenAI key, used by direct OpenAI routes such as gpt2 transparency. */
1301
+ export declare function getOpenAiKeyFromEnv(input?: Record<string, unknown>): string | undefined;
3361
1302
  //#endregion
3362
- export { type AspectRatio, type BackgroundMode, type CreativeDirection, type CreativeField, type CreativeOption, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, type EnrichPromptOptions, type FalClientConfig, type FalImageSizePreset, type FalToolConfig, type FalToolId, type FalToolInputKind, type FalToolParameter, type FalToolPrice, type FalToolRequest, type FalToolRunOptions, type GenerateOptions, type GenerationModelName, type GptImageSize, type ImageOutputFormat, type ImageQuality, type ImageSize, type JobStatus, type LeaderboardEntry, type LeaderboardSnapshot, type LosslessAvailability, type ModelConfig, type ModelOutputShape, type ModelType, type MotifEnv, type MotifImage, type MotifResponse, type OutputDimensions, type QueuedJob, type QueuedToolJob, type RemoveBackgroundOptions, type Resolution, type ResolvedCost, type Result, type ResultAsync, type SizeMode, type ThinkingLevel, type ToolResponse, type ToolRunOptions, type UpscaleOptions, type VideoOptions, type VideoResponse, err, ok };
1303
+ export { type AspectRatio, type Blocker, type Capability, type ChosenBy, type CreativeDirection, type CreativeField, type CreativeOption, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, type EnrichPromptOptions, type FalFetch, type ImageSizeBounds, type LookId, type LookOption, type ModelProfile, type MoodId, type MotifClient, type MotifClientConfig, type MotifEnv, type OutputDimensions, type PlanOptions, type PromptWarning, type PromptWarningRule, type RankedFrom, type RankedModel, type Resolution, type ResolvedCost, type Result, type ResultAsync, type TaskDefinition, type TaskEnvironment, type TaskFile, type TaskFunction, type TaskId, type TaskInput, type TaskMode, type TaskOutput, type TaskPlan, type TaskRequest, type TaskResolution, type TaskResolved, type TaskUnresolved, type Tier, type Unblocker, err, ok };