Overview
What imgen does, what it needs, and how this documentation is organised.
imgen is a command-line tool that generates images through the Replicate API. You pass a prompt, it creates a prediction, waits for the result and saves the image to disk. A JSON prompt file runs many jobs in one go.
What it does
- Works with any Replicate model that takes a
promptand returns an image URL. The default isblack-forest-labs/flux-1.1-pro. - Reads each model’s input schema from the API and decides how to send the requested size: exact
pixels, the closest allowed aspect ratio, or plain
widthandheight. - Saves PNG or WebP. Models with server-side format selection deliver WebP directly; for all others imgen converts locally.
- Retries rate-limited requests and gives up on a single image after 120 seconds.
What it needs
A Replicate account and an API token in REPLICATE_API_TOKEN. Replicate bills each prediction to
that account. imgen talks only to the Replicate API and downloads the image from the URL the API
returns.
How the docs are organised
- Getting started: installation, API token and a quickstart.
- Guides: choosing a model, automatic schema detection, batch mode and WebP output.
- Reference: CLI options and the prompt file format.