---
title: "图片编辑接口"
method: POST
path: "/images/edits"
tags: ["ImageEdit"]
---

# 图片编辑接口

`POST /images/edits`

基于文本提示对图片进行编辑，支持多种图片生成模型和参数配置，目前仅 `gpt-image-1` 和 `gemini-nano-banana` 模型支持该接口

## Request body

- object
  - `model` string, required — 画图模型
  - `prompt` string, required — 文本提示
  - `image` union, required
    - string — 单张图片URL/Base64编码数据
    - string[] — 多张图片URL/Base64编码数组列表
  - `background` 'transparent' | 'opaque' | 'auto' — 背景透明度，目前仅 gpt-image-1 支持该配置
  - `mask` string — 用于遮罩的图片URL/Base64编码数据
  - `size` string — 图片尺寸，不同模型设置不同，详见模型尺寸表
  - `n` integer — 图片数量，默认为1
  - `quality` 'auto' | 'low' | 'medium' | 'high' — 图片质量，支持 auto/low/medium/high 四个配置项，默认为auto
  - `response_format` 'url' | 'b64_json' — 图片响应格式，支持 url/b64_json 两种格式，默认为url
  - `output_format` 'png' | 'jpg' | 'webp' — 图片输出格式，支持 png/jpg/webp 三种格式，默认为png
  - `retries` integer — 自动重试次数，默认0，表示失败不重试

## Response `200`

成功响应

- object
  - `created` integer, required — 创建时间戳
  - `task_id` string — 任务ID
  - `task_status` 'pending' | 'running' | 'succeed' | 'failed' — 任务状态
  - `data` object[], required — 生成的图片列表
    - `url` string, uri, required — 图片URL
    - `b64_json` string, base64 — 图片Base64编码数据
    - `revised_prompt` string — 优化后的提示文本

## Other responses

- `400` — 参数验证错误
- `401` — 未授权
- `413` — 提示文本过长
- `500` — 标准错误响应

---

[API](https://skmtc.dev/geekai/apis/api.md) · [All operations](https://skmtc.dev/geekai/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/geekai/api/revisions/2bf0c8f70a39/schema)
