@apicity/fal 0.32.1 → 0.32.3

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/src/zod.js CHANGED
@@ -1357,6 +1357,36 @@ export const FalSeedreamV55EditRequestSchema = z.object({
1357
1357
  .min(1)
1358
1358
  .describe("List of URLs of input reference images. Up to 10 images are supported; if more are sent, only the last 10 are used."),
1359
1359
  });
1360
+ // Docs: https://fal.ai/models/bytedance/seedream/v5.5/text-to-image/api
1361
+ const [seedreamV55Presets, seedreamV55Dimensions] = FalSeedreamV55ImageSizeSchema.options;
1362
+ const seedreamV55TextToImageSize = z.union([
1363
+ seedreamV55Presets,
1364
+ z
1365
+ .object({
1366
+ width: seedreamV55Dimensions.shape.width.default(512),
1367
+ height: seedreamV55Dimensions.shape.height.default(512),
1368
+ })
1369
+ .refine(({ width, height }) => {
1370
+ const area = width * height;
1371
+ return (area >= 921600 &&
1372
+ area <= 8294400 &&
1373
+ width <= 16 * height &&
1374
+ height <= 16 * width);
1375
+ }, "Custom sizes require 921600 to 8294400 pixels and an aspect ratio between 1/16 and 16."),
1376
+ ]);
1377
+ export const FalSeedreamV55TextToImageRequestSchema = FalSeedreamV55EditRequestSchema.omit({ image_urls: true })
1378
+ .extend({
1379
+ prompt: z
1380
+ .string()
1381
+ .describe("The text prompt used to generate the image."),
1382
+ image_size: seedreamV55TextToImageSize
1383
+ .default("auto_2K")
1384
+ .describe("The size of the generated image. Total pixels must be between 921600 and 8294400, with aspect ratio between 1/16 and 16."),
1385
+ })
1386
+ .refine((p) => p.background !== "transparent" || p.output_format === "png", {
1387
+ path: ["output_format"],
1388
+ message: "Transparent backgrounds require PNG output.",
1389
+ });
1360
1390
  // ---------------------------------------------------------------------------
1361
1391
  // Bytedance Seed Speech TTS v2
1362
1392
  // ---------------------------------------------------------------------------
@@ -3205,6 +3235,201 @@ export const FalFlux3EditImageRequestSchema = z.object({
3205
3235
  });
3206
3236
  // Docs: https://fal.ai/models/blackforestlabs/flux-3/text-to-image/api
3207
3237
  export const FalFlux3TextToImageRequestSchema = FalFlux3EditImageRequestSchema.omit({ image_urls: true });
3238
+ // ---------------------------------------------------------------------------
3239
+ // Black Forest Labs FLUX 3.1 Image (Quality) text-to-image
3240
+ // ---------------------------------------------------------------------------
3241
+ // Queue OpenAPI read 2026-12-03
3242
+ // (sha256 8525af48a4a3c31f582e64f8fbf11fd8ca9f8afbd04cf75dbdc8f3bd8c27f0d2).
3243
+ // Docs: https://fal.ai/models/blackforestlabs/flux-3.1/text-to-image/api
3244
+ export const FalFlux3p1BoxSchema = z.object({
3245
+ x_min: z
3246
+ .number()
3247
+ .min(0)
3248
+ .max(1)
3249
+ .describe("Left edge as a fraction of the image width (0-1)."),
3250
+ y_min: z
3251
+ .number()
3252
+ .min(0)
3253
+ .max(1)
3254
+ .describe("Top edge as a fraction of the image height (0-1)."),
3255
+ x_max: z
3256
+ .number()
3257
+ .min(0)
3258
+ .max(1)
3259
+ .describe("Right edge as a fraction of the image width (0-1)."),
3260
+ y_max: z
3261
+ .number()
3262
+ .min(0)
3263
+ .max(1)
3264
+ .describe("Bottom edge as a fraction of the image height (0-1)."),
3265
+ });
3266
+ export const FalFlux3p1BoundingBoxSchema = z.object({
3267
+ label: z
3268
+ .string()
3269
+ .max(64)
3270
+ .regex(/^[A-Za-z][A-Za-z0-9_]*$/)
3271
+ .nullable()
3272
+ .optional()
3273
+ .describe("Short name for the object in this box, e.g. `fox`. Write `<fox>` in the prompt to tie the box to those words; a box the prompt doesn't name is added to the scene. Defaults to `obj_<n>`."),
3274
+ description: z
3275
+ .string()
3276
+ .max(500)
3277
+ .describe("What to draw in this box: the object and its look."),
3278
+ box: FalFlux3p1BoxSchema.describe("Where the object goes in the output image."),
3279
+ });
3280
+ export const FalFlux3p1TextToImageRequestSchema = z.object({
3281
+ prompt: z.string().describe("The prompt to generate an image from."),
3282
+ bounding_boxes: z
3283
+ .array(FalFlux3p1BoundingBoxSchema)
3284
+ .max(32)
3285
+ .nullable()
3286
+ .optional()
3287
+ .describe("Optional layout: draw each described object inside its box. Box edges are fractions of the image size, with (0, 0) at the top-left. Name boxes in the prompt by label, e.g. `A red fox <fox> sits under a red umbrella <umbrella>`."),
3288
+ aspect_ratio: z
3289
+ .enum([
3290
+ "auto",
3291
+ "21:9",
3292
+ "2:1",
3293
+ "16:9",
3294
+ "3:2",
3295
+ "7:5",
3296
+ "4:3",
3297
+ "5:4",
3298
+ "1:1",
3299
+ "4:5",
3300
+ "3:4",
3301
+ "5:7",
3302
+ "2:3",
3303
+ "9:16",
3304
+ "1:2",
3305
+ ])
3306
+ .default("auto")
3307
+ .describe("Output aspect ratio. Auto uses the first reference image when editing."),
3308
+ resolution: z
3309
+ .enum(["1k", "2k", "4k"])
3310
+ .default("1k")
3311
+ .describe("Output resolution tier."),
3312
+ enable_prompt_expansion: z
3313
+ .boolean()
3314
+ .default(false)
3315
+ .describe("Expand the prompt while preserving its intent and reference roles."),
3316
+ safety_tolerance: z
3317
+ .number()
3318
+ .int()
3319
+ .min(0)
3320
+ .max(4)
3321
+ .default(2)
3322
+ .describe("Safety tolerance, from 0 (strictest) to 4."),
3323
+ output_format: z
3324
+ .enum(["jpeg", "png"])
3325
+ .default("jpeg")
3326
+ .describe("The format of the generated image."),
3327
+ sync_mode: z
3328
+ .boolean()
3329
+ .default(false)
3330
+ .describe("Return the image as a data URI instead of storing it in request history."),
3331
+ version: z.literal("latest").default("latest").describe("The model version."),
3332
+ });
3333
+ // The Fast and Quality text-to-image OpenAPI contracts share the same fields.
3334
+ export const FalFlux3p1FastTextToImageRequestSchema = FalFlux3p1TextToImageRequestSchema;
3335
+ // ---------------------------------------------------------------------------
3336
+ // Black Forest Labs FLUX 3.1 Image (Quality) edit-image
3337
+ // ---------------------------------------------------------------------------
3338
+ // Queue OpenAPI read 2026-12-04
3339
+ // (sha256 f3cd126e9c78a80456dc2bcab506abc03c35f42f7dc188a9d1f5d76c29a2342b).
3340
+ // Docs: https://fal.ai/models/blackforestlabs/flux-3.1/edit-image/api
3341
+ export const FalFlux3p1EditBoundingBoxSchema = z.object({
3342
+ label: z
3343
+ .string()
3344
+ .max(64)
3345
+ .regex(/^[A-Za-z][A-Za-z0-9_]*$/)
3346
+ .nullable()
3347
+ .optional()
3348
+ .describe("Short name for the object in this box, e.g. `dragon`. Write `<dragon>` in the prompt to tie the box to those words; a box the prompt doesn't name is added to the scene. Defaults to `obj_<n>`."),
3349
+ description: z
3350
+ .string()
3351
+ .max(500)
3352
+ .describe("What to draw in this box: the object and its look."),
3353
+ box: FalFlux3p1BoxSchema.nullable()
3354
+ .optional()
3355
+ .describe("Where the object goes in the output image, as on text-to-image. Use instead of `source_box`/`target_box`."),
3356
+ source_image_index: z
3357
+ .number()
3358
+ .int()
3359
+ .min(0)
3360
+ .nullable()
3361
+ .optional()
3362
+ .describe("0-based index into `image_urls` of the reference the object comes from. Leave unset for a new object."),
3363
+ source_box: FalFlux3p1BoxSchema.nullable()
3364
+ .optional()
3365
+ .describe("Where the object is in the reference image. Requires `source_image_index`."),
3366
+ target_box: FalFlux3p1BoxSchema.nullable()
3367
+ .optional()
3368
+ .describe("Where the object goes in the output image. Leave unset to remove a referenced object; set both boxes to move or resize it."),
3369
+ });
3370
+ export const FalFlux3p1EditImageRequestSchema = z.object({
3371
+ prompt: z.string().describe("The prompt to generate an image from."),
3372
+ image_urls: z
3373
+ .array(z.string())
3374
+ .min(1)
3375
+ .max(10)
3376
+ .describe("Reference image URLs or data URIs, in image 1 through image 10 order. Each must be at least 256 pixels per dimension. Oversized images are automatically downscaled to at most 4 megapixels while preserving aspect ratio. The first controls auto aspect ratio."),
3377
+ bounding_boxes: z
3378
+ .array(FalFlux3p1EditBoundingBoxSchema)
3379
+ .max(32)
3380
+ .nullable()
3381
+ .optional()
3382
+ .describe("Optional layout, with (0, 0) at the top-left of each image: keep, move, resize or remove objects from the references, or place new ones. Name boxes in the prompt by label, e.g. `<dragon>`."),
3383
+ aspect_ratio: z
3384
+ .enum([
3385
+ "auto",
3386
+ "21:9",
3387
+ "2:1",
3388
+ "16:9",
3389
+ "3:2",
3390
+ "7:5",
3391
+ "4:3",
3392
+ "5:4",
3393
+ "1:1",
3394
+ "4:5",
3395
+ "3:4",
3396
+ "5:7",
3397
+ "2:3",
3398
+ "9:16",
3399
+ "1:2",
3400
+ ])
3401
+ .default("auto")
3402
+ .describe("Output aspect ratio. Auto uses the first reference image when editing."),
3403
+ resolution: z
3404
+ .enum(["1k", "2k", "4k"])
3405
+ .default("1k")
3406
+ .describe("Output resolution tier."),
3407
+ enable_prompt_expansion: z
3408
+ .boolean()
3409
+ .default(false)
3410
+ .describe("Expand the prompt while preserving its intent and reference roles."),
3411
+ safety_tolerance: z
3412
+ .number()
3413
+ .int()
3414
+ .min(0)
3415
+ .max(4)
3416
+ .default(2)
3417
+ .describe("Safety tolerance, from 0 (strictest) to 4."),
3418
+ output_format: z
3419
+ .enum(["jpeg", "png"])
3420
+ .default("jpeg")
3421
+ .describe("The format of the generated image."),
3422
+ sync_mode: z
3423
+ .boolean()
3424
+ .default(false)
3425
+ .describe("Return the image as a data URI instead of storing it in request history."),
3426
+ version: z.literal("latest").default("latest").describe("The model version."),
3427
+ });
3428
+ // The Fast and Quality edit-image OpenAPI contracts share the same fields.
3429
+ // Queue OpenAPI read 2026-12-04
3430
+ // (sha256 890c21e098619b3e6312b746f1ce8dc59aa81f2e8decae87161000f945c1af84).
3431
+ // Docs: https://fal.ai/models/blackforestlabs/flux-3.1/fast/edit-image/api
3432
+ export const FalFlux3p1FastEditImageRequestSchema = FalFlux3p1EditImageRequestSchema;
3208
3433
  // FLUX 3 Klein (blackforestlabs/flux-3/klein/*): the shapes its LoRA endpoints
3209
3434
  // and base trainers share, from each endpoint's queue OpenAPI on 2026-10-28.
3210
3435
  // The distilled and base text-to-image LoRA endpoints take one input, as do
@@ -8164,6 +8389,14 @@ export const FalMicrosoftMaiImage2p7TextToImageRequestSchema = z.object({
8164
8389
  .default(false)
8165
8390
  .describe("If `True`, the media will be returned as a data URI and the output data won't be available in the request history."),
8166
8391
  });
8392
+ // Flash publishes the same image options as the base model and a shorter prompt limit.
8393
+ export const FalMicrosoftMaiImage2p7FlashTextToImageRequestSchema = FalMicrosoftMaiImage2p7TextToImageRequestSchema.extend({
8394
+ prompt: z
8395
+ .string()
8396
+ .min(1)
8397
+ .max(20000)
8398
+ .describe("The text prompt to generate an image from."),
8399
+ });
8167
8400
  const FalNvidiaCosmos3SuperImageToVideoImageSizeSchema = z.object({
8168
8401
  width: z
8169
8402
  .number()
@@ -14587,11 +14820,70 @@ export const FalKlingV4ImageToImageRequestSchema = z.object({
14587
14820
  .default(false)
14588
14821
  .describe("If `True`, the media will be returned as a data URI."),
14589
14822
  });
14823
+ // Docs: https://fal.ai/models/kling/v4/long-image/api
14824
+ export const FalKlingV4LongImageRequestSchema = z
14825
+ .object({
14826
+ prompt: z
14827
+ .string()
14828
+ .min(1)
14829
+ .max(166000)
14830
+ .describe("Text prompt for the long image."),
14831
+ skill: z
14832
+ .enum(["ecommerce", "webpage"])
14833
+ .default("webpage")
14834
+ .describe("Design a product detail page (ecommerce) or a website (webpage)."),
14835
+ image_urls: z
14836
+ .array(KlingV4MediaUrlSchema)
14837
+ .min(1)
14838
+ .max(3)
14839
+ .nullish()
14840
+ .describe("Product images for ecommerce (1–3), referenced as @Image1, @Image2, and @Image3. Images must be at least 300 × 300 pixels, up to 30 MB, with an aspect ratio between 0.4 and 2.5."),
14841
+ style_image_url: KlingV4MediaUrlSchema.nullish().describe("Optional webpage layout and style reference, addressed as @StyleImage. Images must be at least 300 × 300 pixels, up to 30 MB, with an aspect ratio between 0.4 and 2.5."),
14842
+ subject_image_url: KlingV4MediaUrlSchema.nullish().describe("Optional webpage subject reference, addressed as @SubjectImage. Images must be at least 300 × 300 pixels, up to 30 MB, with an aspect ratio between 0.4 and 2.5."),
14843
+ length: z
14844
+ .enum(["short", "medium", "long"])
14845
+ .default("medium")
14846
+ .describe("Ecommerce page length. Webpage designs ignore this field."),
14847
+ resolution: z
14848
+ .enum(["1K", "2K"])
14849
+ .default("1K")
14850
+ .describe("Output resolution."),
14851
+ sync_mode: z
14852
+ .boolean()
14853
+ .default(false)
14854
+ .describe("Return the media as a data URI."),
14855
+ })
14856
+ .superRefine((request, ctx) => {
14857
+ if (request.skill === "webpage") {
14858
+ if (request.image_urls != null) {
14859
+ ctx.addIssue({
14860
+ code: "custom",
14861
+ path: ["image_urls"],
14862
+ message: "Product images require the ecommerce skill.",
14863
+ });
14864
+ }
14865
+ return;
14866
+ }
14867
+ if (request.image_urls == null) {
14868
+ ctx.addIssue({
14869
+ code: "custom",
14870
+ path: ["image_urls"],
14871
+ message: "Ecommerce requires one to three product images.",
14872
+ });
14873
+ }
14874
+ for (const field of ["style_image_url", "subject_image_url"]) {
14875
+ if (request[field] != null) {
14876
+ ctx.addIssue({
14877
+ code: "custom",
14878
+ path: [field],
14879
+ message: "This reference requires the webpage skill.",
14880
+ });
14881
+ }
14882
+ }
14883
+ });
14590
14884
  // Pinned to the live queue OpenAPI read on 2026-11-20
14591
14885
  // (sha256 a6a499f3f677057d97bc6a9cc076c8b801a2323ce8250f85e3a9cf4fa9ad0c74).
14592
- // Field order follows x-fal-order-properties. The input is open. llms.txt
14593
- // still says $0.063 per units, matching the 2026-11-19 survey. This route
14594
- // was not probed with a rejected body, because a rejection can still be billed.
14886
+ // Field order follows x-fal-order-properties. The input is open.
14595
14887
  // Docs: https://fal.ai/models/kling/v4/text-to-image/api
14596
14888
  export const FalKlingV4TextToImageRequestSchema = z.object({
14597
14889
  prompt: z
@@ -14713,6 +15005,7 @@ export const FAL_ENDPOINT_REQUEST_SCHEMAS = {
14713
15005
  "fal-ai/heygen/v2/video-agent": FalHeygenV2VideoAgentRequestSchema,
14714
15006
  "kling/v4/video-to-video/edit": FalKlingV4VideoToVideoEditRequestSchema,
14715
15007
  "kling/v4/reference-to-video": FalKlingV4ReferenceToVideoRequestSchema,
15008
+ "kling/v4/long-image": FalKlingV4LongImageRequestSchema,
14716
15009
  "kling/v4/image-to-image": FalKlingV4ImageToImageRequestSchema,
14717
15010
  "kling/v4/text-to-image": FalKlingV4TextToImageRequestSchema,
14718
15011
  "kling/v4/flash/image-to-video": FalKlingV4FlashImageToVideoRequestSchema,
@@ -14800,6 +15093,7 @@ export const FAL_ENDPOINT_REQUEST_SCHEMAS = {
14800
15093
  "microsoft/mai-image-2.5-pro": FalMicrosoftMaiImage2p5ProRequestSchema,
14801
15094
  "microsoft/mai-image-2.7/edit": FalMicrosoftMaiImage2p7EditRequestSchema,
14802
15095
  "microsoft/mai-image-2.7/flash/edit": FalMicrosoftMaiImage2p7FlashEditRequestSchema,
15096
+ "microsoft/mai-image-2.7/flash/text-to-image": FalMicrosoftMaiImage2p7FlashTextToImageRequestSchema,
14803
15097
  "microsoft/mai-image-2.7/text-to-image": FalMicrosoftMaiImage2p7TextToImageRequestSchema,
14804
15098
  "openai/gpt-image-2.5/flare/text-to-image": FalOpenaiGptImage2p5FlareTextToImageRequestSchema,
14805
15099
  "openai/gpt-image-2.5/flare/edit": FalOpenaiGptImage2p5FlareEditRequestSchema,
@@ -14878,6 +15172,10 @@ export const FAL_ENDPOINT_REQUEST_SCHEMAS = {
14878
15172
  "ideogram/v4.5/edit": FalIdeogramV4p5EditRequestSchema,
14879
15173
  "xai/grok-imagine-video/v1.5/lite/image-to-video": FalXaiGrokImagineVideoV1p5LiteImageToVideoRequestSchema,
14880
15174
  "blackforestlabs/flux-3/text-to-image": FalFlux3TextToImageRequestSchema,
15175
+ "blackforestlabs/flux-3.1/edit-image": FalFlux3p1EditImageRequestSchema,
15176
+ "blackforestlabs/flux-3.1/fast/edit-image": FalFlux3p1FastEditImageRequestSchema,
15177
+ "blackforestlabs/flux-3.1/fast/text-to-image": FalFlux3p1FastTextToImageRequestSchema,
15178
+ "blackforestlabs/flux-3.1/text-to-image": FalFlux3p1TextToImageRequestSchema,
14881
15179
  "blackforestlabs/flux-3/klein/base/trainer": FalFlux3KleinTrainerRequestSchema,
14882
15180
  "blackforestlabs/flux-3/klein/base/trainer/edit": FalFlux3KleinTrainerRequestSchema,
14883
15181
  "blackforestlabs/flux-3/klein/base/edit-image/lora": FalFlux3KleinEditImageLoraRequestSchema,
@@ -14942,6 +15240,7 @@ export const FAL_ENDPOINT_REQUEST_SCHEMAS = {
14942
15240
  "bytedance/seedream/v5/pro/text-to-image": FalSeedreamV5ProTextToImageRequestSchema,
14943
15241
  "bytedance/seedream/v5/pro/edit": FalSeedreamV5ProEditRequestSchema,
14944
15242
  "bytedance/seedream/v5.5/edit": FalSeedreamV55EditRequestSchema,
15243
+ "bytedance/seedream/v5.5/text-to-image": FalSeedreamV55TextToImageRequestSchema,
14945
15244
  "fal-ai/bytedance/seed-speech/tts/v2": FalSeedSpeechTtsV2RequestSchema,
14946
15245
  "minimax/music-3": FalMinimaxMusic3RequestSchema,
14947
15246
  "fal-ai/elevenlabs/speech-to-text/scribe-v2": FalElevenlabsSpeechToTextScribeV2RequestSchema,