@howells/motif-sdk 7.1.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/image.d.ts +3 -10
- package/dist/image.js +118 -1711
- package/dist/index.cjs +6403 -5996
- package/dist/index.d.cts +132 -36
- package/dist/index.d.ts +132 -36
- package/dist/index.js +6401 -5997
- package/dist/registry.d.ts +253 -183
- package/dist/registry.js +151 -67
- package/package.json +1 -1
package/dist/registry.d.ts
CHANGED
|
@@ -3,154 +3,6 @@
|
|
|
3
3
|
* resolution, for callers that show or price Models themselves. Most callers
|
|
4
4
|
* want the Task client from the package root instead.
|
|
5
5
|
*/
|
|
6
|
-
/** ─── Model Types ─────────────────────────────────────────────── */
|
|
7
|
-
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";
|
|
8
|
-
type Resolution = "0.5K" | "1K" | "2K" | "4K";
|
|
9
|
-
type ModelType = "generation" | "utility" | "video";
|
|
10
|
-
/** `gif` is an animation and `svg` a vector image, on the Models that make them. */
|
|
11
|
-
type ImageOutputFormat = "jpeg" | "png" | "webp" | "gif" | "svg";
|
|
12
|
-
type ImageQuality = "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
13
|
-
interface CustomImageSize {
|
|
14
|
-
height: number;
|
|
15
|
-
width: number;
|
|
16
|
-
}
|
|
17
|
-
/** Limits an endpoint puts on an exact `{ width, height }` image size. */
|
|
18
|
-
interface ImageSizeBounds {
|
|
19
|
-
/** Largest width or height over smallest, e.g. 3 for 3:1. */
|
|
20
|
-
maxRatio?: number;
|
|
21
|
-
maxEdge?: number;
|
|
22
|
-
maxPixels?: number;
|
|
23
|
-
minEdge?: number;
|
|
24
|
-
minPixels?: number;
|
|
25
|
-
/** Both edges must be multiples of this. Motif uses 16 when absent. */
|
|
26
|
-
multipleOf?: number;
|
|
27
|
-
}
|
|
28
|
-
/** How the model accepts image dimensions */
|
|
29
|
-
type SizeMode = "aspect_ratio" | "image_size_enum" | "gpt_size" | "none";
|
|
30
|
-
type QualityTier = "good" | "better" | "best" | "frontier";
|
|
31
|
-
type SpeedTier = "fast" | "balanced" | "slow" | "very_slow" | "unknown";
|
|
32
|
-
type PriceTier = "budget" | "standard" | "premium" | "ultra" | "variable";
|
|
33
|
-
interface FalPricing {
|
|
34
|
-
checkedAt: string;
|
|
35
|
-
currency: "USD";
|
|
36
|
-
endpointId: string;
|
|
37
|
-
estimatedCostPerImageUsd?: number;
|
|
38
|
-
source: "fal-pricing-api";
|
|
39
|
-
unit: string;
|
|
40
|
-
unitPrice: number;
|
|
41
|
-
}
|
|
42
|
-
interface LeaderboardMetric {
|
|
43
|
-
elo: number;
|
|
44
|
-
rank: number;
|
|
45
|
-
winRate?: number;
|
|
46
|
-
}
|
|
47
|
-
interface ModelBenchmark {
|
|
48
|
-
artificialAnalysis?: {
|
|
49
|
-
editing?: LeaderboardMetric;
|
|
50
|
-
sourceUrls: string[];
|
|
51
|
-
snapshotDate: string;
|
|
52
|
-
textToImage?: LeaderboardMetric;
|
|
53
|
-
};
|
|
54
|
-
speed?: {
|
|
55
|
-
medianSeconds?: number;
|
|
56
|
-
p95Seconds?: number;
|
|
57
|
-
source: "artificial-analysis-models";
|
|
58
|
-
};
|
|
59
|
-
tiers?: {
|
|
60
|
-
price: PriceTier;
|
|
61
|
-
quality: QualityTier;
|
|
62
|
-
speed: SpeedTier;
|
|
63
|
-
};
|
|
64
|
-
useCase?: string;
|
|
65
|
-
}
|
|
66
|
-
interface ModelConfig {
|
|
67
|
-
benchmark?: ModelBenchmark;
|
|
68
|
-
/**
|
|
69
|
-
* The fal endpoint's `image_size` also takes an exact `{ width, height }`,
|
|
70
|
-
* within these limits read from fal's OpenAPI schema. Absent means only the
|
|
71
|
-
* named presets are sent. Only meaningful with `sizeMode: "image_size_enum"`.
|
|
72
|
-
*/
|
|
73
|
-
customImageSize?: ImageSizeBounds;
|
|
74
|
-
/** Explicit fal streaming support for generation and edit routes. */
|
|
75
|
-
streaming?: {
|
|
76
|
-
generation: boolean;
|
|
77
|
-
edit: boolean;
|
|
78
|
-
};
|
|
79
|
-
editEndpoint?: string;
|
|
80
|
-
editImagesField?: "image_urls" | "image_url";
|
|
81
|
-
endpoint: string;
|
|
82
|
-
falPricing?: FalPricing;
|
|
83
|
-
maxReferenceImages?: number;
|
|
84
|
-
name: string;
|
|
85
|
-
pricing: string;
|
|
86
|
-
/** Null means token-metered with no per-image estimate. */
|
|
87
|
-
pricePerImageUsd?: number | null;
|
|
88
|
-
/** How this model accepts dimensions (default: "aspect_ratio") */
|
|
89
|
-
sizeMode?: SizeMode;
|
|
90
|
-
supportsAspect: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* The aspect ratios fal's `aspect_ratio` enum accepts, where it is narrower
|
|
93
|
-
* than `ASPECT_RATIOS`. Absent means every ratio is accepted.
|
|
94
|
-
*/
|
|
95
|
-
supportedAspects?: readonly AspectRatio[];
|
|
96
|
-
/** The resolutions fal's `resolution` enum accepts, where it is narrower than `RESOLUTIONS`. */
|
|
97
|
-
supportedResolutions?: readonly Resolution[];
|
|
98
|
-
supportsBackground?: boolean;
|
|
99
|
-
supportsEdit: boolean;
|
|
100
|
-
supportsExpandPrompt?: boolean;
|
|
101
|
-
supportsGuidanceScale?: boolean;
|
|
102
|
-
supportsGoogleSearch?: boolean;
|
|
103
|
-
supportsInferenceSteps?: boolean;
|
|
104
|
-
supportsLimitGenerations?: boolean;
|
|
105
|
-
supportsMaskImage?: boolean;
|
|
106
|
-
maskImageField?: "mask_image_url" | "mask_url";
|
|
107
|
-
/**
|
|
108
|
-
* Takes `markup_image_url`: a transparent PNG of annotations (circles,
|
|
109
|
-
* arrows, notes) the size of the first edit image, guiding its edit.
|
|
110
|
-
*/
|
|
111
|
-
supportsMarkupImage?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* An edit with no aspect asked for sends `image_size: "auto"`, so the
|
|
114
|
-
* result keeps the edited image's shape. For Models whose fal edit
|
|
115
|
-
* endpoint takes `auto`.
|
|
116
|
-
*/
|
|
117
|
-
autoEditSize?: boolean;
|
|
118
|
-
supportsNegativePrompt?: boolean;
|
|
119
|
-
supportsNumImages: boolean;
|
|
120
|
-
supportsOutputFormat?: boolean;
|
|
121
|
-
/** Formats the Model returns. Absent means jpeg, png and webp. */
|
|
122
|
-
supportedOutputFormats?: readonly ImageOutputFormat[];
|
|
123
|
-
/** Formats an edit returns, where they differ from `supportedOutputFormats`. */
|
|
124
|
-
supportedEditOutputFormats?: readonly ImageOutputFormat[];
|
|
125
|
-
supportsQuality?: boolean;
|
|
126
|
-
/** Default matching the quality variant used in this Model's ranking. */
|
|
127
|
-
defaultQuality?: ImageQuality;
|
|
128
|
-
supportedQualities?: readonly ImageQuality[];
|
|
129
|
-
supportsRenderingSpeed?: boolean;
|
|
130
|
-
supportsResolution: boolean;
|
|
131
|
-
supportsSafetyTolerance?: boolean;
|
|
132
|
-
supportsSafetyChecker?: boolean;
|
|
133
|
-
supportsSeed?: boolean;
|
|
134
|
-
supportsSyncMode?: boolean;
|
|
135
|
-
supportsThinkingLevel?: boolean;
|
|
136
|
-
supportsWebSearch?: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* The endpoint only makes transparent images and takes no `background`
|
|
139
|
-
* parameter (Ideogram V3 Transparent). Every output has an alpha channel.
|
|
140
|
-
*/
|
|
141
|
-
transparentOutput?: boolean;
|
|
142
|
-
type: ModelType;
|
|
143
|
-
/** Use fal queue submit/status/result even for generate() calls. */
|
|
144
|
-
useQueue?: boolean;
|
|
145
|
-
}
|
|
146
|
-
/** Pixel sizes of fal's named `image_size` presets. `auto` has none. */
|
|
147
|
-
export declare const FAL_PRESET_SIZES: Readonly<Record<string, CustomImageSize>>;
|
|
148
|
-
/**
|
|
149
|
-
* Estimate cost based on model and settings. `editImages` is the number of
|
|
150
|
-
* input images on an edit, for Models whose edits cost more than generation.
|
|
151
|
-
*/
|
|
152
|
-
export declare function estimateCost(model: string, resolution?: Resolution, numImages?: number, editImages?: number): number | null;
|
|
153
|
-
export declare const MODELS: Record<string, ModelConfig>;
|
|
154
6
|
type FalToolInputKind = "image" | "images" | "video";
|
|
155
7
|
/**
|
|
156
8
|
* Machine-readable cost, so `--dry-run` can emit a number rather than the
|
|
@@ -229,6 +81,15 @@ type FalToolPrice = {
|
|
|
229
81
|
usd: number;
|
|
230
82
|
}[];
|
|
231
83
|
} |
|
|
84
|
+
/**
|
|
85
|
+
* Per second of output video, the body's `duration`. `audioUsd` is the rate
|
|
86
|
+
* while the body's `generate_audio` is not false, for a Model that makes audio.
|
|
87
|
+
*/
|
|
88
|
+
{
|
|
89
|
+
kind: "output-second";
|
|
90
|
+
usd: number;
|
|
91
|
+
audioUsd?: number;
|
|
92
|
+
} |
|
|
232
93
|
/** `usd` for every started `frames` frames of source video. */
|
|
233
94
|
{
|
|
234
95
|
kind: "frames";
|
|
@@ -248,13 +109,26 @@ type FalToolPrice = {
|
|
|
248
109
|
} | {
|
|
249
110
|
kind: "metered";
|
|
250
111
|
};
|
|
112
|
+
/** The upscale factors an endpoint takes, from its fal OpenAPI schema. */
|
|
113
|
+
interface ScaleRange {
|
|
114
|
+
max: number;
|
|
115
|
+
min: number;
|
|
116
|
+
}
|
|
251
117
|
interface FalToolConfig {
|
|
252
118
|
category: "3d" | "analysis" | "background" | "depth" | "erase" | "layers" | "material" | "moderation" | "preprocess" | "reframe" | "relight" | "restoration" | "restyle" | "segmentation" | "try-on" | "upscale" | "vector";
|
|
253
119
|
defaultOptions?: Record<string, unknown>;
|
|
254
120
|
description: string;
|
|
255
121
|
endpoint: string;
|
|
122
|
+
/** Every output is this many times the source's width and height. */
|
|
123
|
+
fixedScale?: number;
|
|
124
|
+
/** `box_prompts` take exactly one box, as fractions (0-1) of the image. */
|
|
125
|
+
fractionBoxes?: true;
|
|
256
126
|
inputField: "content_image_url" | "image_url" | "image_urls" | "input_image_url" | "input_image_urls" | "person_image_url" | "video_url";
|
|
257
127
|
inputKind: FalToolInputKind;
|
|
128
|
+
/** Keeps the source's alpha channel end to end, so `transparent` asks for nothing. */
|
|
129
|
+
keepsAlpha?: true;
|
|
130
|
+
/** Body key for the Task's mask, on a tool that takes one. */
|
|
131
|
+
maskField?: "mask_image_url" | "mask_url";
|
|
258
132
|
name: string;
|
|
259
133
|
outputKeys: string[];
|
|
260
134
|
/**
|
|
@@ -301,14 +175,203 @@ interface FalToolConfig {
|
|
|
301
175
|
* a restyle copies, the garment in a try-on. Absent on tools that take none.
|
|
302
176
|
*/
|
|
303
177
|
referenceField?: "product_image_url" | "style_image_url";
|
|
178
|
+
/**
|
|
179
|
+
* Segments nothing useful without a prompt or a box: fal falls back to a
|
|
180
|
+
* sample prompt ("wheel", "person"), so the request must name its target.
|
|
181
|
+
*/
|
|
182
|
+
needsTarget?: true;
|
|
183
|
+
/**
|
|
184
|
+
* fal falls back to a sample prompt when none is sent, so the request must
|
|
185
|
+
* carry one. Says what it must name, e.g. "a prompt naming the objects".
|
|
186
|
+
*/
|
|
187
|
+
requiredPrompt?: string;
|
|
304
188
|
/**
|
|
305
189
|
* Endpoint routinely exceeds the 120s sync timeout; callers should use the
|
|
306
190
|
* queue path.
|
|
307
191
|
*/
|
|
308
192
|
queued?: true;
|
|
193
|
+
/** Upscale factors the endpoint takes; absent where its schema states no range. */
|
|
194
|
+
scaleRange?: ScaleRange;
|
|
309
195
|
sourceUrl: string;
|
|
310
196
|
task: string;
|
|
311
197
|
}
|
|
198
|
+
/** ─── Model Types ─────────────────────────────────────────────── */
|
|
199
|
+
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";
|
|
200
|
+
type Resolution = "0.5K" | "1K" | "2K" | "4K";
|
|
201
|
+
type ModelType = "generation" | "utility" | "video";
|
|
202
|
+
/** `gif` is an animation and `svg` a vector image, on the Models that make them. */
|
|
203
|
+
type ImageOutputFormat = "jpeg" | "png" | "webp" | "gif" | "svg";
|
|
204
|
+
type ImageQuality = "auto" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
205
|
+
interface CustomImageSize {
|
|
206
|
+
height: number;
|
|
207
|
+
width: number;
|
|
208
|
+
}
|
|
209
|
+
/** Limits an endpoint puts on an exact `{ width, height }` image size. */
|
|
210
|
+
interface ImageSizeBounds {
|
|
211
|
+
/** Largest width or height over smallest, e.g. 3 for 3:1. */
|
|
212
|
+
maxRatio?: number;
|
|
213
|
+
maxEdge?: number;
|
|
214
|
+
maxPixels?: number;
|
|
215
|
+
minEdge?: number;
|
|
216
|
+
minPixels?: number;
|
|
217
|
+
/** Both edges must be multiples of this. Motif uses 16 when absent. */
|
|
218
|
+
multipleOf?: number;
|
|
219
|
+
}
|
|
220
|
+
/** How the model accepts image dimensions */
|
|
221
|
+
type SizeMode = "aspect_ratio" | "image_size_enum" | "gpt_size" | "none";
|
|
222
|
+
type QualityTier = "good" | "better" | "best" | "frontier";
|
|
223
|
+
type SpeedTier = "fast" | "balanced" | "slow" | "very_slow" | "unknown";
|
|
224
|
+
type PriceTier = "budget" | "standard" | "premium" | "ultra" | "variable";
|
|
225
|
+
interface FalPricing {
|
|
226
|
+
checkedAt: string;
|
|
227
|
+
currency: "USD";
|
|
228
|
+
endpointId: string;
|
|
229
|
+
estimatedCostPerImageUsd?: number;
|
|
230
|
+
source: "fal-pricing-api";
|
|
231
|
+
unit: string;
|
|
232
|
+
unitPrice: number;
|
|
233
|
+
}
|
|
234
|
+
interface LeaderboardMetric {
|
|
235
|
+
elo: number;
|
|
236
|
+
rank: number;
|
|
237
|
+
winRate?: number;
|
|
238
|
+
}
|
|
239
|
+
interface ModelBenchmark {
|
|
240
|
+
artificialAnalysis?: {
|
|
241
|
+
editing?: LeaderboardMetric;
|
|
242
|
+
sourceUrls: string[];
|
|
243
|
+
snapshotDate: string;
|
|
244
|
+
textToImage?: LeaderboardMetric;
|
|
245
|
+
};
|
|
246
|
+
speed?: {
|
|
247
|
+
medianSeconds?: number;
|
|
248
|
+
p95Seconds?: number;
|
|
249
|
+
source: "artificial-analysis-models";
|
|
250
|
+
};
|
|
251
|
+
tiers?: {
|
|
252
|
+
price: PriceTier;
|
|
253
|
+
quality: QualityTier;
|
|
254
|
+
speed: SpeedTier;
|
|
255
|
+
};
|
|
256
|
+
useCase?: string;
|
|
257
|
+
}
|
|
258
|
+
interface ModelConfig {
|
|
259
|
+
benchmark?: ModelBenchmark;
|
|
260
|
+
/**
|
|
261
|
+
* The fal endpoint's `image_size` also takes an exact `{ width, height }`,
|
|
262
|
+
* within these limits read from fal's OpenAPI schema. Absent means only the
|
|
263
|
+
* named presets are sent. Only meaningful with `sizeMode: "image_size_enum"`.
|
|
264
|
+
*/
|
|
265
|
+
customImageSize?: ImageSizeBounds;
|
|
266
|
+
/** Explicit fal streaming support for generation and edit routes. */
|
|
267
|
+
streaming?: {
|
|
268
|
+
generation: boolean;
|
|
269
|
+
edit: boolean;
|
|
270
|
+
};
|
|
271
|
+
editEndpoint?: string;
|
|
272
|
+
editImagesField?: "image_urls" | "image_url";
|
|
273
|
+
endpoint: string;
|
|
274
|
+
falPricing?: FalPricing;
|
|
275
|
+
maxReferenceImages?: number;
|
|
276
|
+
name: string;
|
|
277
|
+
pricing: string;
|
|
278
|
+
/** Upscale factor fal applies when none is sent. */
|
|
279
|
+
defaultScale?: number;
|
|
280
|
+
/** Makes audio unless `params: { generate_audio: false }`; priced with it. */
|
|
281
|
+
generatesAudio?: true;
|
|
282
|
+
/** Keys of the fal response that hold files, where the Model does not return `images`. */
|
|
283
|
+
outputKeys?: readonly string[];
|
|
284
|
+
/** Typed rate for a Model priced outside `pricePerImageUsd`. */
|
|
285
|
+
price?: FalToolPrice;
|
|
286
|
+
/** Upscale factors the endpoint takes, from its fal OpenAPI schema. */
|
|
287
|
+
scaleRange?: ScaleRange;
|
|
288
|
+
/** Body key for the upscale factor. */
|
|
289
|
+
scaleField?: "scale_factor" | "upscale_factor";
|
|
290
|
+
/** Body key the start frame goes under, on a video Model. */
|
|
291
|
+
startFrameField?: "image_url" | "start_image_url";
|
|
292
|
+
/** Takes a prompt that steers the result. */
|
|
293
|
+
supportsPrompt?: true;
|
|
294
|
+
/** Null means token-metered with no per-image estimate. */
|
|
295
|
+
pricePerImageUsd?: number | null;
|
|
296
|
+
/** How this model accepts dimensions (default: "aspect_ratio") */
|
|
297
|
+
sizeMode?: SizeMode;
|
|
298
|
+
supportsAspect: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* The aspect ratios fal's `aspect_ratio` enum accepts, where it is narrower
|
|
301
|
+
* than `ASPECT_RATIOS`. Absent means every ratio is accepted.
|
|
302
|
+
*/
|
|
303
|
+
supportedAspects?: readonly AspectRatio[];
|
|
304
|
+
/** The resolutions fal's `resolution` enum accepts, where it is narrower than `RESOLUTIONS`. */
|
|
305
|
+
supportedResolutions?: readonly Resolution[];
|
|
306
|
+
supportsBackground?: boolean;
|
|
307
|
+
supportsEdit: boolean;
|
|
308
|
+
supportsExpandPrompt?: boolean;
|
|
309
|
+
supportsGuidanceScale?: boolean;
|
|
310
|
+
supportsGoogleSearch?: boolean;
|
|
311
|
+
supportsInferenceSteps?: boolean;
|
|
312
|
+
supportsLimitGenerations?: boolean;
|
|
313
|
+
supportsMaskImage?: boolean;
|
|
314
|
+
maskImageField?: "mask_image_url" | "mask_url";
|
|
315
|
+
/**
|
|
316
|
+
* Takes `markup_image_url`: a transparent PNG of annotations (circles,
|
|
317
|
+
* arrows, notes) the size of the first edit image, guiding its edit.
|
|
318
|
+
*/
|
|
319
|
+
supportsMarkupImage?: boolean;
|
|
320
|
+
/**
|
|
321
|
+
* An edit with no aspect asked for sends `image_size: "auto"`, so the
|
|
322
|
+
* result keeps the edited image's shape. For Models whose fal edit
|
|
323
|
+
* endpoint takes `auto`.
|
|
324
|
+
*/
|
|
325
|
+
autoEditSize?: boolean;
|
|
326
|
+
supportsNegativePrompt?: boolean;
|
|
327
|
+
/** Most images one request makes, from the endpoint's `num_images` schema. Set wherever `supportsNumImages` is. */
|
|
328
|
+
maxCount?: number;
|
|
329
|
+
/** Output formats that make one image whatever `num_images` says. */
|
|
330
|
+
singleImageFormats?: readonly ImageOutputFormat[];
|
|
331
|
+
supportsNumImages: boolean;
|
|
332
|
+
supportsOutputFormat?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* The one format an endpoint with no `output_format` parameter always
|
|
335
|
+
* returns (Ideogram V3 Transparent: png). Asking for it is accepted, and
|
|
336
|
+
* nothing is sent.
|
|
337
|
+
*/
|
|
338
|
+
fixedOutputFormat?: ImageOutputFormat;
|
|
339
|
+
/** Formats the Model returns. Absent means jpeg, png and webp. */
|
|
340
|
+
supportedOutputFormats?: readonly ImageOutputFormat[];
|
|
341
|
+
/** Formats an edit returns, where they differ from `supportedOutputFormats`. */
|
|
342
|
+
supportedEditOutputFormats?: readonly ImageOutputFormat[];
|
|
343
|
+
supportsQuality?: boolean;
|
|
344
|
+
/** Default matching the quality variant used in this Model's ranking. */
|
|
345
|
+
defaultQuality?: ImageQuality;
|
|
346
|
+
supportedQualities?: readonly ImageQuality[];
|
|
347
|
+
supportsRenderingSpeed?: boolean;
|
|
348
|
+
supportsResolution: boolean;
|
|
349
|
+
supportsSafetyTolerance?: boolean;
|
|
350
|
+
supportsSafetyChecker?: boolean;
|
|
351
|
+
supportsSeed?: boolean;
|
|
352
|
+
supportsSyncMode?: boolean;
|
|
353
|
+
supportsThinkingLevel?: boolean;
|
|
354
|
+
supportsWebSearch?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* The endpoint only makes transparent images and takes no `background`
|
|
357
|
+
* parameter (Ideogram V3 Transparent). Every output has an alpha channel.
|
|
358
|
+
*/
|
|
359
|
+
transparentOutput?: boolean;
|
|
360
|
+
/** fal's `resolution` enum is lower case ("1k"), not Motif's "1K". */
|
|
361
|
+
lowercaseResolution?: true;
|
|
362
|
+
type: ModelType;
|
|
363
|
+
/** Use fal queue submit/status/result even for generate() calls. */
|
|
364
|
+
useQueue?: boolean;
|
|
365
|
+
}
|
|
366
|
+
/** Pixel sizes of fal's named `image_size` presets. `auto` has none. */
|
|
367
|
+
export declare const FAL_PRESET_SIZES: Readonly<Record<string, CustomImageSize>>;
|
|
368
|
+
/**
|
|
369
|
+
* Estimate cost based on model and settings. `editImages` is the number of
|
|
370
|
+
* input images on an edit, for Models whose edits cost more than generation.
|
|
371
|
+
* Null for a token-metered Model; throws for an id with no per-image price.
|
|
372
|
+
*/
|
|
373
|
+
export declare function estimateCost(model: string, resolution?: Resolution, numImages?: number, editImages?: number): number | null;
|
|
374
|
+
export declare const MODELS: Record<string, ModelConfig>;
|
|
312
375
|
export declare const FAL_TOOLS: {
|
|
313
376
|
readonly "got-ocr": {
|
|
314
377
|
readonly category: "analysis";
|
|
@@ -646,6 +709,7 @@ export declare const FAL_TOOLS: {
|
|
|
646
709
|
};
|
|
647
710
|
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";
|
|
648
711
|
readonly queued: true;
|
|
712
|
+
readonly requiredPrompt: "a prompt naming the objects";
|
|
649
713
|
readonly sourceUrl: "https://fal.ai/models/fal-ai/sam-3/3d-objects";
|
|
650
714
|
readonly task: "single-image 3D object reconstruction";
|
|
651
715
|
};
|
|
@@ -687,6 +751,10 @@ export declare const FAL_TOOLS: {
|
|
|
687
751
|
};
|
|
688
752
|
readonly pricing: "$0.0025/megapixel";
|
|
689
753
|
readonly queued: true;
|
|
754
|
+
readonly scaleRange: {
|
|
755
|
+
readonly max: 10;
|
|
756
|
+
readonly min: 1;
|
|
757
|
+
};
|
|
690
758
|
readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image/seamless";
|
|
691
759
|
readonly task: "seamless texture upscaling";
|
|
692
760
|
};
|
|
@@ -728,7 +796,6 @@ export declare const FAL_TOOLS: {
|
|
|
728
796
|
readonly defaultOptions: {
|
|
729
797
|
readonly model: "General Use (Light)";
|
|
730
798
|
readonly operating_resolution: "1024x1024";
|
|
731
|
-
readonly output_format: "png";
|
|
732
799
|
readonly refine_foreground: true;
|
|
733
800
|
};
|
|
734
801
|
readonly description: "High-resolution dichotomous image segmentation and background removal.";
|
|
@@ -858,9 +925,6 @@ export declare const FAL_TOOLS: {
|
|
|
858
925
|
};
|
|
859
926
|
readonly "seedvr-upscale": {
|
|
860
927
|
readonly category: "restoration";
|
|
861
|
-
readonly defaultOptions: {
|
|
862
|
-
readonly output_format: "png";
|
|
863
|
-
};
|
|
864
928
|
readonly description: "Diffusion image restoration and upscaling with SeedVR.";
|
|
865
929
|
readonly endpoint: "fal-ai/seedvr/upscale/image";
|
|
866
930
|
readonly inputField: "image_url";
|
|
@@ -873,14 +937,15 @@ export declare const FAL_TOOLS: {
|
|
|
873
937
|
};
|
|
874
938
|
readonly pricing: "$0.001/megapixel";
|
|
875
939
|
readonly queued: true;
|
|
940
|
+
readonly scaleRange: {
|
|
941
|
+
readonly max: 10;
|
|
942
|
+
readonly min: 1;
|
|
943
|
+
};
|
|
876
944
|
readonly sourceUrl: "https://fal.ai/models/fal-ai/seedvr/upscale/image";
|
|
877
945
|
readonly task: "image restoration and upscaling";
|
|
878
946
|
};
|
|
879
947
|
readonly "topaz-adjust": {
|
|
880
948
|
readonly category: "restoration";
|
|
881
|
-
readonly defaultOptions: {
|
|
882
|
-
readonly output_format: "png";
|
|
883
|
-
};
|
|
884
949
|
readonly description: "Topaz exposure, white balance, and colour adjustment.";
|
|
885
950
|
readonly endpoint: "topaz/adjust/image";
|
|
886
951
|
readonly inputField: "image_url";
|
|
@@ -899,9 +964,6 @@ export declare const FAL_TOOLS: {
|
|
|
899
964
|
};
|
|
900
965
|
readonly "topaz-creative": {
|
|
901
966
|
readonly category: "restoration";
|
|
902
|
-
readonly defaultOptions: {
|
|
903
|
-
readonly output_format: "png";
|
|
904
|
-
};
|
|
905
967
|
readonly description: "Topaz Bloom upscaling, which reimagines detail rather than preserving it.";
|
|
906
968
|
readonly endpoint: "topaz/upscale/image/creative";
|
|
907
969
|
readonly inputField: "image_url";
|
|
@@ -915,14 +977,15 @@ export declare const FAL_TOOLS: {
|
|
|
915
977
|
};
|
|
916
978
|
readonly pricing: "$0.08 per started 2 output megapixels, any Bloom model";
|
|
917
979
|
readonly queued: true;
|
|
980
|
+
readonly scaleRange: {
|
|
981
|
+
readonly max: 4;
|
|
982
|
+
readonly min: 1;
|
|
983
|
+
};
|
|
918
984
|
readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/creative";
|
|
919
985
|
readonly task: "creative image upscaling";
|
|
920
986
|
};
|
|
921
987
|
readonly "topaz-denoise": {
|
|
922
988
|
readonly category: "restoration";
|
|
923
|
-
readonly defaultOptions: {
|
|
924
|
-
readonly output_format: "png";
|
|
925
|
-
};
|
|
926
989
|
readonly description: "Topaz noise reduction at source resolution.";
|
|
927
990
|
readonly endpoint: "topaz/denoise/image";
|
|
928
991
|
readonly inputField: "image_url";
|
|
@@ -941,9 +1004,6 @@ export declare const FAL_TOOLS: {
|
|
|
941
1004
|
};
|
|
942
1005
|
readonly "topaz-generative": {
|
|
943
1006
|
readonly category: "restoration";
|
|
944
|
-
readonly defaultOptions: {
|
|
945
|
-
readonly output_format: "png";
|
|
946
|
-
};
|
|
947
1007
|
readonly description: "Topaz Wonder upscaling, which synthesises plausible detail as it enlarges.";
|
|
948
1008
|
readonly endpoint: "topaz/upscale/image/generative";
|
|
949
1009
|
readonly inputField: "image_url";
|
|
@@ -957,6 +1017,10 @@ export declare const FAL_TOOLS: {
|
|
|
957
1017
|
};
|
|
958
1018
|
readonly pricing: "$0.08 per started 8 output megapixels at the default Wonder 3; per started 4 with Wonder, Wonder 2, Standard MAX, Redefine or Recover 3";
|
|
959
1019
|
readonly queued: true;
|
|
1020
|
+
readonly scaleRange: {
|
|
1021
|
+
readonly max: 4;
|
|
1022
|
+
readonly min: 1;
|
|
1023
|
+
};
|
|
960
1024
|
readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/generative";
|
|
961
1025
|
readonly task: "generative image upscaling";
|
|
962
1026
|
};
|
|
@@ -964,7 +1028,6 @@ export declare const FAL_TOOLS: {
|
|
|
964
1028
|
readonly category: "upscale";
|
|
965
1029
|
readonly defaultOptions: {
|
|
966
1030
|
readonly model: "Standard V2";
|
|
967
|
-
readonly output_format: "jpeg";
|
|
968
1031
|
readonly upscale_factor: 2;
|
|
969
1032
|
};
|
|
970
1033
|
readonly description: "Professional Topaz image enhancement and upscaling.";
|
|
@@ -980,14 +1043,15 @@ export declare const FAL_TOOLS: {
|
|
|
980
1043
|
};
|
|
981
1044
|
readonly pricing: "$0.08 for output up to 24MP; $0.16 to 48MP, $0.32 to 96MP, up to $1.36 at 512MP";
|
|
982
1045
|
readonly queued: true;
|
|
1046
|
+
readonly scaleRange: {
|
|
1047
|
+
readonly max: 4;
|
|
1048
|
+
readonly min: 1;
|
|
1049
|
+
};
|
|
983
1050
|
readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/image";
|
|
984
1051
|
readonly task: "image enhancement";
|
|
985
1052
|
};
|
|
986
1053
|
readonly "topaz-precision": {
|
|
987
1054
|
readonly category: "restoration";
|
|
988
|
-
readonly defaultOptions: {
|
|
989
|
-
readonly output_format: "png";
|
|
990
|
-
};
|
|
991
1055
|
readonly description: "Topaz upscaling that preserves the original detail rather than inventing it.";
|
|
992
1056
|
readonly endpoint: "topaz/upscale/image/precision";
|
|
993
1057
|
readonly inputField: "image_url";
|
|
@@ -1001,14 +1065,15 @@ export declare const FAL_TOOLS: {
|
|
|
1001
1065
|
};
|
|
1002
1066
|
readonly pricing: "$0.08 per 24 output megapixels, any precision model";
|
|
1003
1067
|
readonly queued: true;
|
|
1068
|
+
readonly scaleRange: {
|
|
1069
|
+
readonly max: 4;
|
|
1070
|
+
readonly min: 1;
|
|
1071
|
+
};
|
|
1004
1072
|
readonly sourceUrl: "https://fal.ai/models/topaz/upscale/image/precision";
|
|
1005
1073
|
readonly task: "faithful image upscaling";
|
|
1006
1074
|
};
|
|
1007
1075
|
readonly "topaz-restore": {
|
|
1008
1076
|
readonly category: "restoration";
|
|
1009
|
-
readonly defaultOptions: {
|
|
1010
|
-
readonly output_format: "png";
|
|
1011
|
-
};
|
|
1012
1077
|
readonly description: "Topaz restoration of damaged or degraded photographs at source resolution.";
|
|
1013
1078
|
readonly endpoint: "topaz/restore/image";
|
|
1014
1079
|
readonly inputField: "image_url";
|
|
@@ -1027,9 +1092,6 @@ export declare const FAL_TOOLS: {
|
|
|
1027
1092
|
};
|
|
1028
1093
|
readonly "topaz-sharpen": {
|
|
1029
1094
|
readonly category: "restoration";
|
|
1030
|
-
readonly defaultOptions: {
|
|
1031
|
-
readonly output_format: "png";
|
|
1032
|
-
};
|
|
1033
1095
|
readonly description: "Topaz deblurring and sharpening at source resolution.";
|
|
1034
1096
|
readonly endpoint: "topaz/sharpen/image";
|
|
1035
1097
|
readonly inputField: "image_url";
|
|
@@ -1050,8 +1112,10 @@ export declare const FAL_TOOLS: {
|
|
|
1050
1112
|
readonly category: "restoration";
|
|
1051
1113
|
readonly description: "Topaz upscaling that preserves the alpha channel end to end.";
|
|
1052
1114
|
readonly endpoint: "topaz/upscale/image/transparent";
|
|
1115
|
+
readonly fixedScale: 4;
|
|
1053
1116
|
readonly inputField: "image_url";
|
|
1054
1117
|
readonly inputKind: "image";
|
|
1118
|
+
readonly keepsAlpha: true;
|
|
1055
1119
|
readonly name: "Topaz Transparent Upscale";
|
|
1056
1120
|
readonly outputKeys: ["image"];
|
|
1057
1121
|
readonly price: {
|
|
@@ -1092,6 +1156,10 @@ export declare const FAL_TOOLS: {
|
|
|
1092
1156
|
};
|
|
1093
1157
|
readonly pricing: "$0.01/sec up to 720p output; $0.02 to 1080p, $0.08 above, doubled at 60fps, halved with Gaia 2";
|
|
1094
1158
|
readonly queued: true;
|
|
1159
|
+
readonly scaleRange: {
|
|
1160
|
+
readonly max: 4;
|
|
1161
|
+
readonly min: 1;
|
|
1162
|
+
};
|
|
1095
1163
|
readonly sourceUrl: "https://fal.ai/models/fal-ai/topaz/upscale/video";
|
|
1096
1164
|
readonly task: "video enhancement";
|
|
1097
1165
|
};
|
|
@@ -1101,6 +1169,7 @@ export declare const FAL_TOOLS: {
|
|
|
1101
1169
|
readonly endpoint: "fal-ai/bria/eraser";
|
|
1102
1170
|
readonly inputField: "image_url";
|
|
1103
1171
|
readonly inputKind: "image";
|
|
1172
|
+
readonly maskField: "mask_url";
|
|
1104
1173
|
readonly name: "Bria Eraser";
|
|
1105
1174
|
readonly outputKeys: ["image"];
|
|
1106
1175
|
readonly price: {
|
|
@@ -1133,6 +1202,7 @@ export declare const FAL_TOOLS: {
|
|
|
1133
1202
|
readonly endpoint: "fal-ai/bria/genfill";
|
|
1134
1203
|
readonly inputField: "image_url";
|
|
1135
1204
|
readonly inputKind: "image";
|
|
1205
|
+
readonly maskField: "mask_url";
|
|
1136
1206
|
readonly name: "Bria GenFill";
|
|
1137
1207
|
readonly outputKeys: ["images"];
|
|
1138
1208
|
readonly price: {
|
|
@@ -1183,6 +1253,7 @@ export declare const FAL_TOOLS: {
|
|
|
1183
1253
|
readonly endpoint: "fal-ai/iclight-v2";
|
|
1184
1254
|
readonly inputField: "image_url";
|
|
1185
1255
|
readonly inputKind: "image";
|
|
1256
|
+
readonly maskField: "mask_image_url";
|
|
1186
1257
|
readonly name: "IC-Light v2";
|
|
1187
1258
|
readonly outputKeys: ["images"];
|
|
1188
1259
|
readonly price: {
|
|
@@ -1246,6 +1317,7 @@ export declare const FAL_TOOLS: {
|
|
|
1246
1317
|
readonly category: "erase";
|
|
1247
1318
|
readonly description: "Remove whatever falls inside supplied bounding boxes.";
|
|
1248
1319
|
readonly endpoint: "fal-ai/object-removal/bbox";
|
|
1320
|
+
readonly fractionBoxes: true;
|
|
1249
1321
|
readonly inputField: "image_url";
|
|
1250
1322
|
readonly inputKind: "image";
|
|
1251
1323
|
readonly name: "Object Removal by Box";
|
|
@@ -1264,6 +1336,7 @@ export declare const FAL_TOOLS: {
|
|
|
1264
1336
|
readonly endpoint: "fal-ai/object-removal/mask";
|
|
1265
1337
|
readonly inputField: "image_url";
|
|
1266
1338
|
readonly inputKind: "image";
|
|
1339
|
+
readonly maskField: "mask_url";
|
|
1267
1340
|
readonly name: "Object Removal by Mask";
|
|
1268
1341
|
readonly outputKeys: ["images"];
|
|
1269
1342
|
readonly price: {
|
|
@@ -1333,9 +1406,6 @@ export declare const FAL_TOOLS: {
|
|
|
1333
1406
|
};
|
|
1334
1407
|
readonly "text-removal": {
|
|
1335
1408
|
readonly category: "erase";
|
|
1336
|
-
readonly defaultOptions: {
|
|
1337
|
-
readonly output_format: "png";
|
|
1338
|
-
};
|
|
1339
1409
|
readonly description: "Remove all rendered text from an image, rebuilding what sat behind it.";
|
|
1340
1410
|
readonly endpoint: "fal-ai/image-editing/text-removal";
|
|
1341
1411
|
readonly inputField: "image_url";
|
|
@@ -1544,7 +1614,6 @@ export declare const FAL_TOOLS: {
|
|
|
1544
1614
|
readonly category: "segmentation";
|
|
1545
1615
|
readonly defaultOptions: {
|
|
1546
1616
|
readonly min_mask_region_area: 100;
|
|
1547
|
-
readonly output_format: "png";
|
|
1548
1617
|
readonly points_per_side: 32;
|
|
1549
1618
|
readonly pred_iou_thresh: 0.88;
|
|
1550
1619
|
readonly stability_score_thresh: 0.95;
|
|
@@ -1569,13 +1638,13 @@ export declare const FAL_TOOLS: {
|
|
|
1569
1638
|
readonly defaultOptions: {
|
|
1570
1639
|
readonly apply_mask: true;
|
|
1571
1640
|
readonly max_masks: 3;
|
|
1572
|
-
readonly output_format: "png";
|
|
1573
1641
|
};
|
|
1574
1642
|
readonly description: "Segment image objects with text, point, or box prompts. SAM 3.1 adds Object Multiplex for faster multi-object tracking.";
|
|
1575
1643
|
readonly endpoint: "fal-ai/sam-3-1/image";
|
|
1576
1644
|
readonly inputField: "image_url";
|
|
1577
1645
|
readonly inputKind: "image";
|
|
1578
1646
|
readonly name: "SAM 3.1 Image";
|
|
1647
|
+
readonly needsTarget: true;
|
|
1579
1648
|
readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
|
|
1580
1649
|
readonly price: {
|
|
1581
1650
|
readonly kind: "call";
|
|
@@ -1589,13 +1658,13 @@ export declare const FAL_TOOLS: {
|
|
|
1589
1658
|
readonly category: "segmentation";
|
|
1590
1659
|
readonly defaultOptions: {
|
|
1591
1660
|
readonly apply_mask: true;
|
|
1592
|
-
readonly prompt: "person";
|
|
1593
1661
|
};
|
|
1594
1662
|
readonly description: "SAM 3.1 video segmentation with Object Multiplex tracking for multiple objects.";
|
|
1595
1663
|
readonly endpoint: "fal-ai/sam-3-1/video";
|
|
1596
1664
|
readonly inputField: "video_url";
|
|
1597
1665
|
readonly inputKind: "video";
|
|
1598
1666
|
readonly name: "SAM 3.1 Video";
|
|
1667
|
+
readonly needsTarget: true;
|
|
1599
1668
|
readonly outputKeys: ["video", "boundingbox_frames_zip"];
|
|
1600
1669
|
readonly price: {
|
|
1601
1670
|
readonly frames: 16;
|
|
@@ -1612,13 +1681,13 @@ export declare const FAL_TOOLS: {
|
|
|
1612
1681
|
readonly defaultOptions: {
|
|
1613
1682
|
readonly apply_mask: true;
|
|
1614
1683
|
readonly max_masks: 3;
|
|
1615
|
-
readonly output_format: "png";
|
|
1616
1684
|
};
|
|
1617
1685
|
readonly description: "Segment image objects with text, point, or box prompts.";
|
|
1618
1686
|
readonly endpoint: "fal-ai/sam-3/image";
|
|
1619
1687
|
readonly inputField: "image_url";
|
|
1620
1688
|
readonly inputKind: "image";
|
|
1621
1689
|
readonly name: "SAM 3 Image";
|
|
1690
|
+
readonly needsTarget: true;
|
|
1622
1691
|
readonly outputKeys: ["image", "masks", "metadata", "scores", "boxes"];
|
|
1623
1692
|
readonly price: {
|
|
1624
1693
|
readonly kind: "call";
|
|
@@ -1639,6 +1708,7 @@ export declare const FAL_TOOLS: {
|
|
|
1639
1708
|
readonly inputField: "image_url";
|
|
1640
1709
|
readonly inputKind: "image";
|
|
1641
1710
|
readonly name: "SAM 3 Image RLE";
|
|
1711
|
+
readonly needsTarget: true;
|
|
1642
1712
|
readonly outputKeys: ["rle", "scores", "boxes", "metadata"];
|
|
1643
1713
|
readonly price: {
|
|
1644
1714
|
readonly kind: "call";
|
|
@@ -1653,7 +1723,6 @@ export declare const FAL_TOOLS: {
|
|
|
1653
1723
|
readonly defaultOptions: {
|
|
1654
1724
|
readonly apply_mask: true;
|
|
1655
1725
|
readonly detection_threshold: 0.5;
|
|
1656
|
-
readonly prompt: "person";
|
|
1657
1726
|
readonly video_output_type: "X264 (.mp4)";
|
|
1658
1727
|
};
|
|
1659
1728
|
readonly description: "Segment and track prompted objects across video frames.";
|
|
@@ -1661,6 +1730,7 @@ export declare const FAL_TOOLS: {
|
|
|
1661
1730
|
readonly inputField: "video_url";
|
|
1662
1731
|
readonly inputKind: "video";
|
|
1663
1732
|
readonly name: "SAM 3 Video";
|
|
1733
|
+
readonly needsTarget: true;
|
|
1664
1734
|
readonly outputKeys: ["video", "boundingbox_frames_zip"];
|
|
1665
1735
|
readonly price: {
|
|
1666
1736
|
readonly frames: 16;
|
|
@@ -1677,13 +1747,13 @@ export declare const FAL_TOOLS: {
|
|
|
1677
1747
|
readonly defaultOptions: {
|
|
1678
1748
|
readonly apply_mask: true;
|
|
1679
1749
|
readonly detection_threshold: 0.5;
|
|
1680
|
-
readonly prompt: "person";
|
|
1681
1750
|
};
|
|
1682
1751
|
readonly description: "Track prompted video objects and return RLE mask data.";
|
|
1683
1752
|
readonly endpoint: "fal-ai/sam-3/video-rle";
|
|
1684
1753
|
readonly inputField: "video_url";
|
|
1685
1754
|
readonly inputKind: "video";
|
|
1686
1755
|
readonly name: "SAM 3 Video RLE";
|
|
1756
|
+
readonly needsTarget: true;
|
|
1687
1757
|
readonly outputKeys: ["video", "boundingbox_frames_zip"];
|
|
1688
1758
|
readonly price: {
|
|
1689
1759
|
readonly frames: 16;
|