跳到正文
北京时间
原文
OpenRouter:Announcements(RSS)· Brian Thomas·· 2026-06-23精选AI 评分73

OpenRouter推出统一图像API

Introducing the Unified Image API

AI 导读

OpenRouter推出统一图像API,整合Google、OpenAI、Black Forest Labs、Recraft、ByteDance、Sourceful、Microsoft、xAI等30+模型。新API提供标准化请求格式,通过`/api/v1/images/models`端点返回每个模型的分辨率、宽高比、输出数量、输入参考图数量、种子等能力描述;通过`/api/v1/images/models/{id}/endpoints`端点获取具体服务商的定价与参数支持(如Seedream 4.5每张$0.04、FLUX.2 Pro每百万像素$0.03、GPT-5.4 Image 2按token计费)。OpenAI的GPT 5系列图像模型支持SSE流式预览,启用`"stream": true`即可边生成边返回预览。新图像模型将仅添加至专用API,建议现有用户切换。

推荐理由

OpenRouter 把 30+ 图像模型收进一个 API,参数自动发现和流式预览让频繁切换模型的开发者省去不少适配麻烦,尤其对 Agent 工作流很友好。

正文 · 原文

Introducing the Unified Image API

Image generation on OpenRouter now has a dedicated API with unified access to 30+ models.

Like all our media generation APIs, we’ve standardized the interface for easy model switching, allowed passthrough for unique model capabilities, and provided programmatic access to discover the details of each individual model. We support models from Google, OpenAI, Black Forest Labs, Recraft, ByteDance, Sourceful, Microsoft, and xAI, with more being added all the time.

Know What Each Model Can Do

Image models differ in ways that break requests. Seedream 4.5 supports 18 aspect ratios; Gemini 3.1 Flash Image supports 14 (overlapping, but not identical). Some models generate up to 10 images per call; others cap at 1. Some accept 16 input references; others accept 4.

The /api/v1/images/models endpoint returns typed capability descriptors for every model:

{
  "id": "bytedance-seed/seedream-4.5",
  "supported_parameters": {
    "resolution": { "type": "enum", "values": ["1K", "2K", "4K"] },
    "aspect_ratio": { "type": "enum", "values": ["1:1", "16:9", "9:16", "..."] },
    "n": { "type": "range", "min": 1, "max": 10 },
    "input_references": { "type": "range", "min": 0, "max": 14 },
    "seed": { "type": "boolean" }
  },
  "supports_streaming": false
}

Your code can adapt to any model without hardcoding provider differences or battling 400 errors over unacceptable parameters.

This is especially useful for agents. Give your coding agent the /api/v1/images/models response and it has everything it needs to pick a model, validate inputs, and generate images without trial-and-error.

Per-Provider Granularity

Each model may be served by multiple providers. The per-endpoint records (/api/v1/images/models/{id}/endpoints) give you the definitive truth for each one: which parameters this specific endpoint accepts, what passthrough keys are allowed, streaming support, and granular pricing.

curl "https://openrouter.ai/api/v1/images/models/google/gemini-3.1-flash-image/endpoints"

Each endpoint also returns a pricing array with the exact billing structure. Different providers charge in different units:

"pricing": [
  { "billable": "output_image", "unit": "image", "cost_usd": 0.04 }
]

Seedream 4.5 charges a flat $0.04 per image. FLUX.2 Pro bills at $0.03 per megapixel (so resolution affects cost). GPT-5.4 Image 2 and Gemini 3.1 Flash Image bill per token. No more guessing why a generation cost what it did; the usage object in every response includes the exact cost in USD.

One Request Shape, Any Model

The API normalizes the fragmented world of image generation into one schema:

curl -X POST "https://openrouter.ai/api/v1/images" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bytedance-seed/seedream-4.5",
    "prompt": "a red panda astronaut floating in space, studio lighting",
    "resolution": "2K",
    "aspect_ratio": "16:9"
  }'

Resolution, aspect ratio, quality, output format, background transparency, input references, streaming: all normalized across every provider. When you need provider-specific features (like Black Forest Labs’ steps or guidance), pass them through provider.options keyed by the provider slug from the endpoints API.

Streaming Previews for GPT Image Models

OpenAI’s GPT Image models (GPT-5 Image, GPT-5 Image Mini, GPT-5.4 Image 2) support native SSE streaming through the Image API. Set "stream": true and you’ll receive partial image previews as they’re rendered, so users see progress instead of waiting for the full generation. Check the supports_streaming field on any endpoint to see if it’s available.

FAQ

What happens to image generation through chat completions?

Until now, we supported image generation via completions and responses. All existing image models continue to be supported here, however new image models will be added exclusively to the dedicated Image API.

If you’re using openai/gpt-5-image, openai/gpt-5-image-mini, or openai/gpt-5.4-image-2, we recommend switching to one of the dedicated image models. The GPT 5 and 5.4 versions generate images through an LLM, so they don’t provide access to the full set of supported parameters and may incur extra inference cost.

Can I use provider-specific features?

Yes. Each endpoint exposes an allowed_passthrough_parameters list. Pass provider-specific keys under provider.options keyed by the provider slug. The endpoints API tells you exactly which keys are accepted.

How does pricing work?

Each endpoint returns granular pricing lines with a billable unit, cost in USD, and optional variant tiers (e.g., resolution-based pricing). The usage object in every response includes the exact cost.


Tell us what you think and which models you want next in #feedback on Discord.

来源:OpenRouter:Announcements(RSS) · openrouter.ai