Synthome Docs
Generation

Image Generation

Generate images with AI models using generateImage()

Image Generation

Use generateImage() to create AI-generated images from text prompts or transform existing images.

Basic Usage

import { compose, generateImage, imageModel } from "@synthome/sdk";

const execution = await compose(
  generateImage({
    model: imageModel("google/nano-banana", "fal"),
    prompt: "A futuristic city skyline at night, neon lights",
  }),
).execute();

console.log(execution.result?.url);

Options

Required

OptionTypeDescription
modelImageModelThe image model to use

Optional

OptionTypeDescription
promptstringText description of the image to generate
imagestring | string[]Input image URL(s) for image-to-image
aspectRatiostringAspect ratio (e.g., "16:9", "1:1", "9:16")
outputFormat"jpg" | "png" | "webp"Output format
seednumberRandom seed for reproducibility
Either prompt or image must be provided.

Text-to-Image

Generate an image from a text prompt:

const execution = await compose(
  generateImage({
    model: imageModel("google/nano-banana", "fal"),
    prompt: "A serene Japanese garden with cherry blossoms and a wooden bridge",
    aspectRatio: "16:9",
  }),
).execute();

Image-to-Image

Transform an existing image:

const execution = await compose(
  generateImage({
    model: imageModel("google/nano-banana", "fal"),
    prompt: "Make this photo look like a watercolor painting",
    image: "https://example.com/photo.jpg",
  }),
).execute();

Background Removal

Remove backgrounds from images using the background remover model:

const execution = await compose(
  generateImage({
    model: imageModel("codeplugtech/background_remover", "replicate"),
    image: "https://example.com/portrait.jpg",
  }),
).execute();

Using with Video Generation

Generate an image and use it as input for video:

const execution = await compose(
  generateVideo({
    model: videoModel("bytedance/seedance-1-pro", "replicate"),
    prompt: "Gentle waves lapping on the shore",
    image: generateImage({
      model: imageModel("google/nano-banana", "fal"),
      prompt: "A peaceful tropical beach at sunset",
    }),
  }),
).execute();

Using with Merge

Mix generated and existing images in a slideshow:

const execution = await compose(
  merge([
    { url: "https://example.com/intro.jpg", duration: 3 },
    {
      url: generateImage({
        model: imageModel("google/nano-banana", "fal"),
        prompt: "Scene 1: A mountain landscape",
      }),
      duration: 4,
    },
    {
      url: generateImage({
        model: imageModel("google/nano-banana", "fal"),
        prompt: "Scene 2: A forest path",
      }),
      duration: 4,
    },
  ]),
).execute();

Available Models

ModelProviderFeatures
google/nano-bananareplicate, falText-to-image, image-to-image
google/nano-banana-proreplicate, falAdvanced, typography support
bytedance/seedream-4replicateHigh-resolution
codeplugtech/background_removerreplicateBackground removal

Next Steps

How is this guide?