Image generation
openrouter:image_generation
Lets any text model produce images. The model writes an image prompt, OpenRouter generates the image with the configured image model (openai/gpt-5-image by default), and the image is returned alongside the response.
How it works
For adding images to any model’s responses, including text-only models.
Your model decides an image would help and writes a prompt for it.
OpenRouter generates it with the configured image model and returns the URL.
Your model includes the image in its response, and can create several.
Providers and pricing
Standard model token costs apply to every request.
Using this tool
OpenRouter runs the tool during the request and returns the result to the model, so no client-side tool loop is needed.
Supported APIs: Chat Completions, Responses, and Anthropic Messages.
curl https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.2",
"tools": [
{
"type": "openrouter:image_generation"
}
],
"messages": [
{
"role": "user",
"content": "Draw a watercolor painting of a lighthouse at dusk."
}
]
}'Setup, parameters, and examples in the docs.
Read the integration guide