
Generated with openai/gpt-image-2 — 16:9, high quality
Prompt and parameters
Prompt and parameters
Editorial architectural photograph of a contemporary neighborhood storefront at blue hour, glowing warmly against the dusk. Above the entrance, a warm-white neon sign in flowing hand-bent cursive reads exactly “OpenRouter”, the only text in the scene. Large windows reveal a cozy, lived-in interior: wood shelves styled with books and ceramics, lush trailing plants, and soft pendant lighting. Potted plants and a bicycle rest by the entrance, and golden light spills across the wet pavement in gentle reflections. Straight-on composition, realistic materials, quiet street with no people.
- Model:
openai/gpt-image-2 - Parameters:
quality: "high",aspect_ratio: "16:9",n: 1 - Output:
1536×864PNG - Generation time: 94s
- Cost: $0.13
Model Discovery
Via the Image Models API
The dedicated image models endpoint lists every available image model with its capabilities: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
Thesupported_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 aPOST request to /api/v1/images with the model and prompt:
Response Format
Images are returned as base64-encoded bytes. Theusage field reports token counts and cost when available.
The media_type field is present whenever the format is identifiable (including image/png), and omitted only when it could not be determined:
media_type reflects the actual format:
Signed URLs Instead of Base64
Setresponse_format to url to receive a download link for each image instead of base64. URLs expire after 24 hours.
Image Configuration Options
Resolution and Aspect Ratio
Control output dimensions withresolution, aspect_ratio, or the convenience size shorthand:
resolution: normalized tier (512,768,1K,1.5K,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"). A tier size is equivalent to settingresolutionand combines withaspect_ratio. Explicit pixel sizes are provider-dependent: providers that accept them treat the value as authoritative and reject a mismatchedresolutionoraspect_ratioalongside it with a 400. xAI and Sourceful V2/V2.5 reject explicit pixel sizes (useresolutionandaspect_ratiothere); Sourceful V2.6 supports them within its dimension limits and does not allow combining them withresolutionoraspect_ratio.
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,webp,svg(vectorization models only), orgif(animation-capable models only, e.g. OpenAI gpt-image-2.6). If omitted, the provider’s default applies.frame_countandframe_duration_ms— animation length (2-64 frames; each model accepts its own range and returns its own error for values outside it) and per-frame display time (20-2000 ms) whenoutput_formatisgif. Ignored by models that do not produce animations. OpenAI renders every frame onto one sprite sheet with a fixed pixel budget, so a bareaspect_ratiois shaped to the largest frame that fits (for example1:1at 9 frames is 928x928); an explicitsizeis forwarded as-is and can be rejected upstream when the sheet does not fit.markup— a transparent PNG overlay (same dimensions as the first reference image) that marks where an edit applies. Image-to-image only; honored by models with markup-guided editing (OpenAI gpt-image-2.6).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 withn:
n > 1. Check the model’s supported_parameters for availability.
Image-to-Image (Reference Images)
Pass reference images to guide generation viainput_references:
Provider Routing
When a model has multiple providers, use theprovider object to choose which endpoints can serve the request:
only— allow only the listed provider slugs.order— try providers in the listed order.ignore— exclude the listed provider slugs.sort— sort eligible endpoints byprice,throughput, orlatency.allow_fallbacks— whenfalse, stop after the primary provider instead of trying another eligible provider.zdr— whentrue, route only to Zero Data Retention endpoints. If no endpoint qualifies, the request fails.data_collection—allow(default) ordeny. Whendeny, route only to endpoints that don’t train on your data. Those endpoints may still retain prompts; usezdrto exclude retention.
provider_tag from the per-endpoint records as the base provider slug. See Provider Routing for the routing behavior shared across OpenRouter APIs.
Provider-Specific Options
Pass provider-specific parameters throughprovider.options, keyed by the provider slug from the endpoints API:
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:
media_type field is present whenever the format is identifiable:
media_type reflects the actual format:
usage object in the completed event includes cost (USD), matching the buffered response shape.
Error — emitted if generation fails mid-stream:
data: [DONE].
Billing and Cancellation
Image generation billing is all-or-nothing. A generation is either completed and billed in full, or it fails and is not billed — there is no partial or fractional image billing. This differs from chat completions, where a cancelled stream still bills for the tokens produced before cancellation.- Completed generations are billed for the full image output based on the endpoint’s pricing.
response_format: "url": a completed generation is billed once its output is stored, even if the client disconnects before the response arrives. The signed URL is only delivered in the response, so a client that never receives the response cannot retrieve the stored copy; storage is not a recovery mechanism for a lost response.- Failed or cancelled generations are not billed. When a generation does not complete, the request returns a
502 Bad Gatewayrather than a partial result, and no charge is recorded.
response_format: "url" case above, OpenRouter does not attempt to bill the user for work they did not receive.
For streaming requests, any partial preview images delivered before the stream ends do not create partial charges. Billing keys off completion of the final image, so a stream that terminates early (client disconnect or mid-stream error) is billed exactly as a failed generation: not at all.
Request Parameters
Use the Image Models API to check which parameters each model and endpoint supports.