Skip to main content
Glama

Generate Image with Replicate

replicate_generate_image

Generate 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

TableJSON Schema
NameRequiredDescriptionDefault
seedNoRandom seed for reproducible outputs.
modelNoEither 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
promptYesText prompt describing the image to generate.
downloadNoWhether to download the generated files locally. Default true. When false, only Replicate URLs are returned (URLs expire after ~24h).
timeout_msNoMax ms to wait for the prediction. If exceeded, returns the prediction ID so you can poll via replicate_get_prediction. Default: 300000 (5min).
extra_inputNoAdditional model-specific inputs merged into the request (e.g. {guidance: 3.5}). Use replicate_get_model_schema to see what a model accepts.
num_outputsNoNumber of images to generate (1-4).
aspect_ratioNoAspect ratio. Supported by Flux models. Default 1:1.
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description reveals multiple behavioral traits beyond annotations: URLs expire in ~24h, download behavior, timeout with polling fallback, error handling for missing API token, and the return structure with status fields. It also notes the display requirement for embedding images. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured: purpose, usage, display requirement, args, returns, examples, error handling. It is front-loaded with the core action. While somewhat lengthy, each section is justified and no redundant sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (8 parameters, nested object, no output schema), the description covers all essential aspects: input details, return structure, error cases, polling mechanism, and even display instructions. It is comprehensive for an AI agent to invoke correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (all 8 parameters described), so baseline is 3. The description adds value by explaining defaults (model, aspect_ratio, download), providing examples, and guiding use of extra_input with replicate_get_model_schema. It goes beyond schema repetition.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates images from text prompts and specifies it handles 'draw/create/generate an image of' requests. It distinguishes from sibling tools like replicate_generate_audio or replicate_generate_video by focusing on image generation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use the tool ('any draw/create/generate an image of request') and mentions the default model (Flux Schnell) for speed. It does not explicitly exclude alternatives but the domain is clearly image generation, which is sufficient given sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sena-labs/replicate-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server