Images

Full-featured image generation with all parameters.

The images.generate method gives you full control over image generation, including dimensions, negative prompts, seeds, caching, and webhooks.

Basic Usage

result = client.images.generate(
    model="fal-ai/flux/schnell",
    prompt="a futuristic city at night",
    negative_prompt=None,
    width=1024,
    height=1024,
    num_images=1,
    seed=None,
    params=None,
)

Full Options (JavaScript)

The JavaScript SDK supports additional options for caching and webhooks:

const result = await client.images.generate(
  "fal-ai/flux/schnell",
  "a cat in space",
  {
    width: 1024,
    height: 1024,
    numImages: 1,
    negativePrompt: null,
    seed: null,
    imageUrl: null,        // input image for img2img
    preferCache: true,     // use cache (exact or semantic match)
    maxLatencyMs: null,    // max acceptable latency
    webhookUrl: null,      // callback URL when done
    callbackId: null,      // id in callback payload
  }
);

ImageResult Properties

PropertyPythonJavaScriptTypeDescription
IDresult.idresult.idstringRequest ID
Imagesresult.imagesresult.imageslist[str] / string[]Generated image URLs
Modelresult.modelresult.modelstringModel identifier
Providerresult.providerresult.providerstringProvider name
Costresult.costresult.costfloat / numberCost in USD
Cache hitresult.cache_hitresult.cacheHitbool / booleanServed from cache?
Latencyresult.latency_msresult.latencyMsint | None / numberLatency in ms
Created atresult.created_atresult.createdAtdatetime / stringCreation timestamp

On this page