API 文档AI 模型接口图像OpenAI
编辑图像
在给定原始图像和提示的情况下创建编辑或扩展图像。
编辑图像
在给定原始图像和提示的情况下创建编辑或扩展图像。
Base URL
https://autorouter.top— Production
Authentication
BearerAuth: http (bearer)
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
Endpoints
POST /v1/images/edits
编辑图像
在给定原始图像和提示的情况下创建编辑或扩展图像。
Request Body
Content-Type: multipart/form-data
Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | 图像编辑模型的 ID。 |
image | string | Yes | 要编辑的图像文件(PNG 格式,小于 4MB,方形)。如果未提供遮罩,图像必须具有透明度。 |
prompt | string | Yes | 所需图像的文本描述。最大长度为 1000 个字符。 |
mask | string | No | 遮罩图像文件(PNG 格式,小于 4MB,与原图同尺寸)。完全透明区域指示 image 应编辑的位置。 |
n | string | No | 要生成的图像数。必须介于 1 和 10 之间。 |
size | string | No | gpt-image-2 支持 1024x1024、1536x1024、1024x1536、auto;dall-e-2 支持 256x256、512x512、1024x1024。 |
user | string | No | 代表您的最终用户的唯一标识符。 |
Responses
200: Response
Content-Type: application/json
请求示例
curl -X POST "https://autorouter.top/v1/images/edits" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F model="gpt-image-2" \
-F image="@/path/to/image.png" \
-F prompt="A cute baby sea otter wearing a beret."响应示例
{}