Image Generation
OpenRouter provides a dedicated Image API for generating images from text prompts (and optional reference images). The API covers model discovery, per-endpoint capabilities, and generation. You can browse available models and pricing on the models page filtered by image output.
Model Discovery
Via the Image Models API
The dedicated image models endpoint lists every available image model with its capabilities:
Each entry in the data array includes:
Per-Endpoint Records
Each model may be served by multiple providers. To see the definitive capabilities, pricing, and passthrough options per endpoint:
Capability Descriptors
The supported_parameters map uses typed descriptors to describe what each request field accepts:
An absent key means the parameter is unsupported by that endpoint.
Via the Models API
You can also discover image models through the general Models API:
On the Models Page
Visit the Models page and filter by output modalities to find models with image generation capabilities.
API Usage
Send a POST request to /api/v1/images with the model and prompt:
Response Format
Images are returned as base64-encoded bytes. The usage field reports token counts and cost when available.
Image Configuration Options
Resolution and Aspect Ratio
Control output dimensions with resolution, aspect_ratio, or the convenience size shorthand:
resolution— normalized tier (512,1K,2K,4K). Concrete pixel dimensions are derived per-provider.aspect_ratio— normalized ratio. Passautoto let the provider choose. Common values include1:1,16:9,9:16,4:3,3:4,3:2,2:3,4:5,5:4, and extended ratios like1:2,2:1,1:4,4:1,1:8,8:1,9:21,21:9. Providers clamp to their supported subset — check the model’ssupported_parametersfor accepted values.size— convenience shorthand. Pass a tier ("2K") or explicit pixels ("2048x2048") and it gets normalized for the provider. Interchangeable withresolution+aspect_ratio; conflicting values are rejected.
Check the model’s supported_parameters to see which values each endpoint accepts.
Quality and Output Format
quality—auto,low,medium, orhigh. Providers without a quality knob ignore this.output_format—png,jpeg, orwebp.background—auto,transparent, oropaque.transparentrequires an alpha-capable format (png or webp).output_compression— 0–100 for webp/jpeg. Ignored for png.
Multiple Images
Request up to 10 images per call with n:
Not all providers support n > 1. Check the model’s supported_parameters for availability.
Image-to-Image (Reference Images)
Pass reference images to guide generation via input_references:
Reference images can be HTTP(S) URLs or base64 data URLs. The number of references accepted varies by provider.
Provider-Specific Options
Pass provider-specific parameters through provider.options, keyed by the provider slug from the endpoints API:
The allowed_passthrough_parameters field in each endpoint record lists which keys are accepted.
Streaming Image Generation
Models that support native SSE streaming (supports_streaming: true in the discovery API) can return partial images as they’re generated:
The response is an SSE stream with three event types:
Partial image — emitted as each partial render becomes available:
Completed — emitted when the final image is ready:
The usage object in the completed event includes cost (USD), matching the buffered response shape.
Error — emitted if generation fails mid-stream:
The stream terminates with data: [DONE].
Request Parameters
Use the Image Models API to check which parameters each model and endpoint supports.