openrouter-gemini-image-generation

Generate Gemini images via the chat completions endpoint with modalities.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/strataga/claude-skill-inception --skill openrouter-gemini-image-generation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openrouter-gemini-image-generation
Source: https://github.com/strataga/claude-skill-inception/tree/main/openrouter-gemini-image-generation
Command: npx skills add https://github.com/strataga/claude-skill-inception --skill openrouter-gemini-image-generation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

OpenRouter Gemini image generation often returns 404 or 400 errors, especially with Nano Banana and Gemini image models, due to endpoint mismatches and invalid aspect_ratio handling. This Skill provides a robust workaround by switching the workflow to the chat completions endpoint with modalities to reliably generate images and properly parse responses.

Core Features & Use Cases

  • Endpoint workaround: Use /chat/completions with modalities to generate images instead of /images/generations.
  • Model compatibility: Supports Gemini image models (e.g., Nano Banana Pro and Nano Banana) and their edge cases.
  • Input validation & parsing: Validates allowed aspect ratios and parses the nested response to extract image data for downstream use.

Quick Start

To generate an image, call the chat completions endpoint with modalities ["image","text"] and model "google/gemini-3-pro-image-preview" (or "google/gemini-2.5-flash-image"), ensuring aspect_ratio is a permitted value such as "16:9".

Frequently Asked Questions about openrouter-gemini-image-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does OpenRouter Gemini image generation return a 404 or 400 error?

OpenRouter Gemini image generation returns 404 or 400 errors due to endpoint mismatches when using the /images/generations endpoint. Switching to the chat completions endpoint with modalities resolves these failures.

How do I generate images with Gemini models using OpenRouter chat completions?

To generate images with Gemini models, call the OpenRouter /chat/completions endpoint using modalities ["image","text"] instead of /images/generations, then parse the nested response to extract the image data.

What aspect ratios are allowed for OpenRouter Gemini image generation?

OpenRouter Gemini image generation requires validating permitted aspect ratios like "16:9" before sending requests. Using invalid aspect_ratio values with Gemini models triggers parsing errors and request failures.

Can I use Nano Banana models for image generation on OpenRouter?

Yes, you can use Nano Banana and Nano Banana Pro models for image generation on OpenRouter. These Gemini models work reliably when you apply the chat completions endpoint workaround with the modalities parameter.

What is the best way to fix invalid aspect_ratio errors with OpenRouter image generation?

The best way to fix invalid aspect_ratio errors is to bypass the /images/generations endpoint and use the chat completions endpoint with modalities, ensuring you pass only permitted aspect ratio values.

Does OpenRouter support the modalities parameter for Gemini image models?

Yes, OpenRouter supports the modalities parameter for Gemini image models via the chat completions endpoint. Setting modalities to ["image","text"] provides a robust workaround for image generation endpoint failures.