Generate Image with Replicate
replicate_generate_imageGenerate images from text prompts using Replicate's image models such as Flux Schnell. Customize aspect ratio, model, and number of outputs; results include URLs and optional local downloads.
Instructions
Generate one or more images from a text prompt using a Replicate image model.
Use this for any "draw / create / generate an image of …" request. By default it uses Flux Schnell (fast, ~2 seconds per image).
DISPLAY REQUIREMENT — after this tool returns successfully, you MUST embed the image inline in your reply by pasting ONE of the three embed blocks the tool prints verbatim (Option 1 iframe, Option 2 , or Option 3 markdown — try them in that order; pick the first one your chat client renders). The iframe variant scales to the chat column width with the image's native aspect ratio; the variant is a responsive fallback; markdown is the universal last resort. Place the chosen embed BEFORE any descriptive prose. Do NOT paraphrase the URL or omit the embed — the user wants the image to appear in the main chat flow, not only inside the collapsed tool widget. URLs expire in ~24h.
Args:
prompt (string): Text description of the image to generate.
model (string, default "flux-schnell"): Either a curated key (flux-schnell, flux-dev, flux-pro, flux-2-max, sd-3.5-large, recraft-v3, recraft-v4.1, ideogram-v2, imagen-3, seedream) or a full Replicate identifier "owner/name[:version]".
aspect_ratio ("1:1" | "16:9" | "9:16" | "4:3" | "3:4" | "21:9" | "3:2" | "2:3", optional): Aspect ratio. Default 1:1.
num_outputs (1-4, optional): How many images to generate.
seed (integer, optional): Random seed for reproducible output.
extra_input (object, optional): Model-specific extra inputs (e.g. {guidance: 3.5, num_inference_steps: 28}). Use replicate_get_model_schema if unsure.
download (boolean, default true): Download files locally to ~/Downloads/replicate-mcp/.
timeout_ms (5000-1800000, optional): Max wait. Default 300000 (5min).
Returns structuredContent matching PredictionResult: { "status": "starting" | "processing" | "succeeded" | "failed" | "canceled", "prediction_id": string, "model": string, "urls": string[], // Replicate URLs (expire ~24h) "local_paths": string[], // Absolute paths on disk when download=true "metrics": { "predict_time_seconds": number } | undefined, "error": string | undefined, "pending": boolean | undefined // true if timed out — poll via replicate_get_prediction }
Examples:
"An origami fox in a misty forest" → uses flux-schnell, 1:1
prompt="logo for a coffee shop called Crema", model="recraft-v3" → for text-in-image
prompt="cinematic shot of a lighthouse", model="flux-pro", aspect_ratio="21:9", seed=42
Error handling:
If REPLICATE_API_TOKEN is missing, returns an actionable error telling the user how to set it.
Invalid model IDs return Replicate's error message verbatim.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Random seed for reproducible outputs. | |
| model | No | Either a curated key (flux-schnell, flux-dev, flux-pro, sd-3.5-large, recraft-v3, recraft-v4.1, flux-2-max, seedream, ideogram-v2, imagen-3) or a Replicate identifier like "owner/name" or "owner/name:version". | flux-schnell |
| prompt | Yes | Text prompt describing the image to generate. | |
| download | No | Whether to download the generated files locally. Default true. When false, only Replicate URLs are returned (URLs expire after ~24h). | |
| timeout_ms | No | Max ms to wait for the prediction. If exceeded, returns the prediction ID so you can poll via replicate_get_prediction. Default: 300000 (5min). | |
| extra_input | No | Additional model-specific inputs merged into the request (e.g. {guidance: 3.5}). Use replicate_get_model_schema to see what a model accepts. | |
| num_outputs | No | Number of images to generate (1-4). | |
| aspect_ratio | No | Aspect ratio. Supported by Flux models. Default 1:1. |