Routescope APIRoutescope API

编辑图片

状态:已发布
状态依据:需要已启用的图像编辑/生成模型

图片编辑接口。请求体使用 application/json 提交,参考图通过 URL 传入;推荐使用 images[].image_url,同时兼容 image(单 URL/数组/对象)和 image_urls 字符串数组。可选参数包括 masknsizequalityresponse_formatbackgroundoutput_formatoutput_compressionmoderationwatermarkuser

POST
/v1/images/edits
curl -X POST "https://api.routescope.ai/v1/images/edits" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-image-2",    "prompt": "基于这两张参考图生成一张新图",    "images": [      {        "image_url": "https://example.com/a.png"      },      {        "image_url": "https://example.com/b.png"      }    ],    "size": "1024x1024"  }'
{
  "created": 1,
  "data": {}
}

Authorization

BearerAuth

AuthorizationBearer <token>

模型 relay 接口鉴权。请求头:Authorization: Bearer

In: header

Request Body

application/json

model*string

模型名称。腾讯 tokenhub 渠道会在网关内映射为上游需要的模型名。

Default"gpt-image-2"
prompt*string

图片编辑提示词。

images?

推荐的 JSON URL 图片参数。每一项一个图片 URL 对象。

image?string||

兼容字段:可传单个 URL、URL 数组或对象。推荐优先使用 images[].image_url

image_urls?array<string>

兼容字段:URL 字符串数组。推荐优先使用 images[].image_url

mask?string

可选。蒙版图片 URL,透明区域表示需要编辑的区域。

Formaturi
n?integer

生成图片数量。

Formatint32
Range1 <= value
size?string

输出图片尺寸。

Default"1024x1024"
quality?string

图片质量。具体可用值取决于上游模型。

response_format?string

返回格式。支持 urlb64_json;默认无需传此字段,不同上游通道支持情况可能不同。

Value in"url" | "b64_json"
background?string

背景填充方式。支持情况取决于模型。

Default"auto"
Value in"transparent" | "opaque" | "auto"
output_format?string

输出格式。具体可用值取决于上游模型。

output_compression?integer

输出压缩级别,仅适用于 jpegwebp

Default90
Formatint32
Range0 <= value <= 100
moderation?string

安全审核强度。支持情况取决于模型。

Default"auto"
Value in"auto" | "low"
watermark?boolean

是否添加水印。支持情况取决于上游通道。

Defaultfalse
user?string

终端用户标识,可用于滥用监控。

Response Body

application/json

最后更新于