openrouter-image-generation

Parse OpenRouter image generation responses and decode base64 images.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fixes parsing issues when using OpenRouter image generation responses, ensuring images are correctly extracted from the response and decoded from base64 when needed.

Core Features & Use Cases

  • Corrects endpoint usage by using the chat/completions endpoint instead of /images/generations.
  • Extracts images from the message.images array and decodes base64 data URLs to usable images.
  • Supports models like google/gemini-2.5-flash-image and similar OpenRouter image generation APIs.

Quick Start

Provide the first image from an OpenRouter image generation response by locating it in choices[0].message.images and decoding the base64 data URL.

Frequently Asked Questions about openrouter-image-generation

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

FAQPage Schema
How do I extract images from an OpenRouter chat completions response?

To extract images from an OpenRouter chat completions response, locate the image data within the choices[0].message.images array and decode the base64 data URL from the image_url.url field to retrieve a usable image payload.

Why does my OpenRouter image generation return parsing errors?

OpenRouter image generation parsing errors often occur because the image data appears in an unexpected location like choices[0].message.images. Correctly targeting this array and decoding the base64 data URL resolves the parsing failure.

Does OpenRouter use the /images/generations endpoint for image generation models?

No, OpenRouter image generation models like google/gemini-2.5-flash-image use the chat/completions endpoint rather than /images/generations, requiring specific response parsing to extract the generated image successfully.

How do I decode base64 data URLs from OpenRouter image responses?

To decode base64 data URLs from OpenRouter image responses, parse the image_url.url property located in the message.images array and convert the base64 encoded string into a usable image file format.

Can I use google/gemini-2.5-flash-image with the OpenRouter API for image generation?

Yes, you can use google/gemini-2.5-flash-image with the OpenRouter API by sending requests through the chat/completions endpoint and parsing the choices[0].message.images array to extract the base64 encoded image output.