BetaServer tools are currently in beta. The API and behavior may change.
openrouter:image_generation server tool enables any model to generate images from text prompts. When the model determines it needs to create an image, it calls the tool with a description. OpenRouter executes the image generation and returns the result to the model.
How It Works
- You include
{ "type": "openrouter:image_generation" }in yourtoolsarray. - Based on the user’s request, the model decides whether image generation is needed and crafts a prompt.
- OpenRouter generates the image using the configured model (defaults to
openai/gpt-5-image). - The generated image URL is returned to the model.
- The model incorporates the image into its response. It may generate multiple images in a single request if needed.
Quick Start
Configuration
The image generation tool accepts optionalparameters to customize the output:
All parameters except
model are passed directly to the underlying image generation API. Available options depend on the specific model being used.
Response
When the model calls the image generation tool, it receives a response like:Works with the Responses API
The image generation server tool also works with the Responses API:Pricing
Image generation pricing depends on the underlying model used:- openai/gpt-5-image (default): See model page
- openai/gpt-5-image-mini: See model page
- openai/gpt-5.4-image-2: See model page
- Other models: See the image models list on OpenRouter
Next Steps
- Server Tools Overview — Learn about server tools
- Web Search — Search the web for real-time information
- Datetime — Get the current date and time
- Tool Calling — Learn about user-defined tool calling