generate_image
Create images from text prompts with OpenRouter image models; options are validated before billing, and outputs save with settings and cost.
Instructions
Generate new images from a text prompt with an OpenRouter image model.
Call list_image_models first to choose a model, and get_image_model for its exact
allowed values. Options are checked against the model before anything is sent: an
invalid value fails with the allowed values and costs nothing.
Each call costs money on the user's OpenRouter account; the result reports the cost. Prompts go to a third-party model provider through OpenRouter: get the user's OK before sending client or project images or details to third-party providers.
Images are saved (never overwriting) to the configured output folder with a JSON sidecar of the settings used. The result lists the saved paths, any notes and failures, the model, provider, time and cost, plus JPEG previews.
Args:
prompt: What to create.
model: Model id from list_image_models.
n: Number of images, 1 to 10. Above the model's max n, the server splits them
into several calls (each billed) and says so in the notes.
aspect_ratio: One of the model's aspect ratios, e.g. "16:9".
resolution: One of the model's resolution tiers.
size: Exact pixel size such as "1024x1024", for models that support it.
quality: One of the model's quality values.
seed: Integer for repeatable results, for models that support it.
background: One of the model's background values, e.g. "transparent".
output_format: One of the model's output formats, e.g. "png" or "svg".
output_dir: Folder to save into instead of the default. Must be an absolute
path or start with "~".
filename_prefix: File name stem; defaults to a slug of the prompt.
provider_options: Provider passthrough options as a flat dict, e.g.
{"moderation": "low"}. Keys must be in the model's passthrough parameters
(see get_image_model); the server sends each key to every provider that
allows it. Any other key is rejected before anything is spent.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | ||
| seed | No | ||
| size | No | ||
| model | Yes | ||
| prompt | Yes | ||
| quality | No | ||
| background | No | ||
| output_dir | No | ||
| resolution | No | ||
| aspect_ratio | No | ||
| output_format | No | ||
| filename_prefix | No | ||
| provider_options | No |