聊天 API
OpenAI 兼容的图像生成
通过标准的 POST /v1/images/generations endpoint,使用 Seedream、Wan 和 gpt-image-2 生成图像。请求结构为 OpenAI 兼容;Seedream 路由要求图像最小尺寸为 3,686,400 像素(例如 1920×1920)。
POST
标准的 OpenAI 兼容
AIsa 的响应在原生 OpenAI schema 之上增加了几处扩展:
POST /v1/images/generations endpoint。截至 2026 年 7 月 28 日,它服务 seedream-5-0-260128、wan2.7-image、wan2.7-image-pro 和 gpt-image-2。较早的 seedream-4-5-251128 路由改为通过经由 Chat 的图像生成访问。
路由速览
支持的模型
尺寸限制 ⚠️(Seedream 路由)
Seedream 上游强制要求最少 3,686,400 像素。低于该值的请求会被拒绝:
只要
宽 × 高 ≥ 3,686,400,任意宽高比都可以。
请求
请求字段
响应
- 根层级回显
model data[].size——每张返回图像的实际尺寸usage——包含generated_images(用于计费),以及用于 token 核算的output_tokens/total_tokens
常见 4xx 原因
400 InvalidParameter — image size must be at least 3686400 pixels——size太小。请使用1920x1920或更大。404 openai_error——传入的模型不走该 endpoint(例如wan2.7-image)。请改用基于 chat 的路由。400 invalid_request——size字符串格式不正确(例如写成1024而不是1024x1024)。
相关
Image Generation via Chat
Wan 2.7 系列使用的
/v1/chat/completions 路由。Gemini generateContent
Gemini 兼容的 generateContent endpoint。
Media Gen skill
封装图像与视频生成的 Agent 技能。
授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json
图像生成模型。seedream-5-0-260128($0.035/次请求)、wan2.7-image($0.030/次请求)、wan2.7-image-pro($0.075/次请求)或 gpt-image-2($0.03/次请求,或 1024×1024 图像 $0.05/张)。
可用选项:
seedream-5-0-260128, wan2.7-image, wan2.7-image-pro, gpt-image-2 要生成的图像的文本描述。
要生成的图像数量。每张图像均按单张图像费率单独计费。
必填范围:
x >= 1图像尺寸,格式为 宽x高。Seedream 路由要求 宽 × 高 ≥ 3,686,400(例如 1920x1920、2048x2048);Wan 和 gpt-image-2 可接受更小尺寸,如 1024x1024。
示例:
"2048x2048"