OpenRouter supports image generation via the Chat Completions and Responses endpoints. You can find the supported models, their capabilities, and pricing by filtering our model list by image output.
You can find image generation models in several ways:
Use the output_modalities query parameter on the Models API to programmatically discover image generation models:
See Models - Query Parameters for the full list of supported modality values.
Visit the Models page and filter by output modalities to find models capable of image generation. Look for models that list "image" in their output modalities.
When using the Chatroom, click the Image button to automatically filter and select models with image generation capabilities. If no image-capable model is active, you’ll be prompted to add one.
To generate images, send a request to the /api/v1/chat/completions endpoint with the modalities parameter. The value depends on the model’s capabilities:
modalities: ["image", "text"]modalities: ["image"]Some image generation models support additional configuration through the image_config parameter.
Set image_config.aspect_ratio to request specific aspect ratios for generated images.
Supported aspect ratios:
1:1 → 1024×1024 (default)2:3 → 832×12483:2 → 1248×8323:4 → 864×11844:3 → 1184×8644:5 → 896×11525:4 → 1152×8969:16 → 768×134416:9 → 1344×76821:9 → 1536×672Azure MAI Image aspect ratios (supported by microsoft/mai-image-2.5):
1:1 → 1024×1024 (default)4:3 → 1024×7683:4 → 768×102416:9 → 1365×7689:16 → 768×13653:2 → 1152×7682:3 → 768×1152Extended aspect ratios (supported by google/gemini-3.1-flash-image-preview only):
1:4 → Tall, narrow format ideal for scrolling carousels and vertical UI elements4:1 → Wide, short format for hero banners and horizontal layouts1:8 → Extra-tall format for notification headers and narrow vertical spaces8:1 → Extra-wide format for wide-format banners and panoramic layoutsSet image_config.image_size to control the resolution of generated images.
Supported sizes:
1K → Standard resolution (default)2K → Higher resolution4K → Highest resolution0.5K → Lower resolution, optimized for efficiency (supported by google/gemini-3.1-flash-image-preview only)You can combine both aspect_ratio and image_size in the same request:
Set image_config.strength to control how much the output image differs from the input image during image-to-image generation. This parameter only applies when input images are provided in messages. It is only supported by Recraft models.
0.0 to 1.00.2Example:
Use image_config.text_layout to place text at specific positions on the generated image. Each entry specifies the text to render and a bounding box defined by four corner points in normalized coordinates (0 to 1). This parameter is only supported by Recraft V3 (recraft/recraft-v3) for both text-to-image and image-to-image requests. Recraft V4 and V4 Pro do not support text_layout.
Each text layout entry is an object with:
text (required): The text string to renderbbox (required): Array of 4 [x, y] coordinate pairs defining the bounding box corners (top-left, top-right, bottom-right, bottom-left), with values from 0 to 1Example:
Use image_config.style to apply a specific artistic style to the generated image. This parameter is only supported by Recraft V3 (recraft/recraft-v3). Recraft V4 and V4 Pro do not support styles.
See the full list of available styles in Recraft’s documentation. Note that vector styles are not supported.
Example:
Use image_config.rgb_colors to specify a color palette that influences the generated image. Each color is a [r, g, b] array of three integers (0 to 255). This parameter is supported by Recraft models for both text-to-image and image-to-image requests.
Example:
Use image_config.background_rgb_color to set a specific background color for the generated image. The value is a [r, g, b] array of three integers (0 to 255). This parameter is supported by Recraft models for both text-to-image and image-to-image requests.
Example:
You can combine rgb_colors and background_rgb_color in the same request:
Use image_config.font_inputs to render custom text with specific fonts in generated images. The text you want to render must also be included in your prompt for best results. This parameter is only supported by Sourceful models (sourceful/riverflow-v2-fast and sourceful/riverflow-v2-pro).
Each font input is an object with:
font_url (required): URL to the font filetext (required): Text to render with the fontLimits:
Example:
Tips for best results:
text parameter should match exactly what’s in your prompt - avoid extra wording or quotation marksUse image_config.super_resolution_references to enhance low-quality elements in your input image using high-quality reference images. The output image will match the size of your input image, so use larger input images for better results. This parameter is only supported by Sourceful models (sourceful/riverflow-v2-fast and sourceful/riverflow-v2-pro) when using image-to-image generation (i.e., when input images are provided in messages).
Limits:
messages)Example:
Tips for best results:
Use image_config.scoring_prompt to give the model free-form guidance it uses to evaluate and refine its own output during generation. This parameter is only supported by Sourceful V2.5 models (sourceful/riverflow-v2.5-fast and sourceful/riverflow-v2.5-pro).
Example:
Use image_config.scoring_rubric to provide a structured set of weighted dimensions the model scores its output against. This is the structured complement to scoring_prompt — the two are independent and can be provided together in the same request (rubric for weighted dimension scoring, prompt for additional free-form guidance). This parameter is only supported by Sourceful V2.5 models (sourceful/riverflow-v2.5-fast and sourceful/riverflow-v2.5-pro).
Each rubric entry is an object with:
key (required): unique machine-readable identifier for the dimensionlabel (required): human-readable namedescription (required): what this dimension evaluatesweight (required): relative importance as a positive numberpassing_score (optional): minimum acceptable scorescore_guidance (optional): array of { "score": number, "description": string } anchorsLimits:
Example:
Use image_config.background_mode to control how the generated image’s background is handled, and image_config.background_hex_color to set the fill color for solid backgrounds. These parameters are only supported by Sourceful V2.5 models (sourceful/riverflow-v2.5-fast and sourceful/riverflow-v2.5-pro).
background_mode: one of original (default — keep the generated background), transparent (remove the background), or solid (composite onto a flat color).background_hex_color: a #RRGGBB hex string. Required when background_mode is solid.Behavior:
background_hex_color (without background_mode) is treated as solid with that color.background_hex_color is validated but then discarded for original and transparent modes — a malformed hex string always returns a 400 regardless of mode.Example (solid color):
Example (transparent):
Recraft uses background_rgb_color (an [r, g, b] array) to set a solid background color, whereas Sourceful V2.5 uses background_mode together with background_hex_color.
Image generation also works with streaming responses:
When generating images, the assistant message includes an images field containing the generated images:
data:image/png;base64,)Not all models support image generation. To use this feature:
"image" in its output_modalities["image", "text"] for models that output both, or ["image"] for image-only modelsgoogle/gemini-3.1-flash-image-preview (supports extended aspect ratios and 0.5K resolution)google/gemini-2.5-flash-imageblack-forest-labs/flux.2-problack-forest-labs/flux.2-flexsourceful/riverflow-v2-standard-previewimages field in responses before processingNo images in response?
output_modalities includes "image")modalities parameter correctly: ["image", "text"] for models that output both, or ["image"] for image-only modelsModel not found?