跳转到内容
Alpha
  • 模型
  • 排行榜
  • Ori
联系销售

页脚

OpenRouterOpenRouter
© 2026 OpenRouter, Inc

产品

  • 聊天
  • 排行榜
  • 基准测试
  • 应用
  • 发现
  • 模型
  • Ori
  • 合集
  • 提供商
  • 工具
  • 定价
  • Business
  • Enterprise
  • 实验室

公司

  • 关于
  • 博客
  • 客户
  • 招聘
    招聘
  • 隐私
  • 服务条款
  • 信任中心
  • 支持
  • 兼容 OR
  • 数据
  • 品牌

开发者

  • 文档
  • API 参考
  • 开发者平台
  • 状态
  • AI 站点地图

连接

  • Discord
  • GitHub
  • LinkedIn
  • X
  • YouTube
所有服务器工具

Image generation

openrouter:image_generation

文档试用此工具

让任何文本模型都能生成图像。模型编写图像提示词,OpenRouter 使用配置的图像模型(默认为 openai/gpt-5-image)生成图像,并将图像与响应一同返回。

文档试用此工具
工作原理提供商和定价使用此工具常见问题

工作原理

用于向任何模型的回复添加图像,包括纯文本模型。

  1. 1

    您的模型 判断图像会有帮助,并为其编写提示词。

  2. 2

    OpenRouter 使用配置的图像模型生成图像并返回 URL。

  3. 3

    您的模型 在响应中包含图像,并且可以创建多张图像。

提供商与定价

  • https://openrouter.ai 的网站图标

    OpenRouter

    图像模型定价

    按工具调用的图像模型计价;可选择任何支持图像输出的模型。

每个请求均按标准模型 token 费用计费。

使用此工具

OpenRouter 在请求期间运行工具并将结果返回给模型,因此无需客户端工具循环。

支持的 API:Chat Completions, Responses, and Anthropic Messages。

shell
curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "openai/gpt-5.2",
  "tools": [
    {
      "type": "openrouter:image_generation"
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": "Draw a watercolor painting of a lighthouse at dusk."
    }
  ]
}'

文档中提供了设置、参数和示例。

阅读集成指南

常见问题

Yes. Add the openrouter:image_generation tool to the request’s tools array. The model writes an image prompt when the conversation calls for one, OpenRouter generates the image with an image model, and the image comes back with the response. A model with text-only output, such as openai/gpt-5.2, can answer with images this way.

The tool uses openai/gpt-5-image unless you set parameters.model on the tool entry. Any model with image output on OpenRouter can be selected, so switching image models changes one field and keeps the same API key and request shape. Other parameters such as quality, size and aspect_ratio pass through to that model.

Each image is billed at the selected image model’s price, on top of the token cost of the model that calls the tool. Each image model’s price is on its model page and in the image models collection.

With the Images API (POST /api/v1/images), your code writes the prompt and calls the image model directly. With the tool, the model decides when an image helps, writes the prompt itself and can create several images in one Chat Completions, Responses or Anthropic Messages request.