Documentation Index
Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt
Use this file to discover all available pages before exploring further.
GPT Image
gpt-image-2 通过 OpenAI Images API 兼容路径调用:
生成图像
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 固定为 gpt-image-2 |
prompt | string | 是 | 图像描述提示词 |
n | integer | 否 | 生成数量,默认 1,范围 1-10 |
size | string | 否 | auto 或 宽x高。宽高必须为 16 的倍数,单边不超过 3840,总像素在 655360 到 8294400 之间,长短边比例不超过 3:1。常用值:1024x1024、1536x1024、1024x1536 |
quality | string | 否 | auto、low、medium、high。兼容 hd,服务端会归一为 high;不接受 standard |
background | string | 否 | auto 或 opaque。gpt-image-2 不支持 transparent |
output_format | string | 否 | png、jpeg、webp |
output_compression | integer | 否 | 0-100,仅当 output_format 为 jpeg 或 webp 时可用 |
moderation | string | 否 | auto 或 low |
stream | boolean | 否 | 是否使用 SSE 流式响应 |
partial_images | integer | 否 | 0-3,仅当 stream=true 时可用 |
user | string | 否 | 终端用户标识 |
gpt-image-2 接受:response_format、style、input_fidelity、background=transparent、quality=standard、output_format=png 搭配 output_compression。
请求示例
流式生成
gpt-image-2 支持 stream=true。如果请求中包含 partial_images,必须同时开启 stream,且取值范围为 0-3。
cURL
quality=high 或兼容写法 quality=hd 的同步请求可能耗时较长。图片生成业务请优先走 https://cn.crazyrouter.com/v1;高质量请求建议使用 stream=true,或确保客户端超时大于 180 秒。响应示例
编辑图像
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 固定为 gpt-image-2 |
image / image[] | file 或 file[] | 是 | 原始图片或参考图片文件(multipart);gpt-image-2 最多支持 16 张参考图 |
prompt | string | 是 | 编辑描述 |
mask | file | 否 | 遮罩图片,透明区域为需要编辑的部分 |
n | integer | 否 | 生成数量,默认 1,范围 1-10 |
size | string | 否 | 同生成接口 |
quality | string | 否 | auto、low、medium、high;hd 会归一为 high |
background | string | 否 | auto 或 opaque |
output_format | string | 否 | png、jpeg、webp |
output_compression | integer | 否 | 0-100,仅当 output_format 为 jpeg 或 webp 时可用 |
stream | boolean | 否 | 是否使用 SSE 流式响应 |
partial_images | integer | 否 | 0-3,仅当 stream=true 时可用 |
单图编辑示例
Python
多图参考编辑示例
多图编辑请求必须使用multipart/form-data。推荐用多个 image[] 字段传参考图;服务端也兼容重复的 image 字段。
gpt-image-2 多图参考最多支持 16 张图片。多图请求会优先路由到支持多图参考的官方 OpenAI 承载渠道。