典名词元典名词元首页
API 文档
AI 模型接口图像OpenAi

图片编辑

POST
/api/v1/image/generation

Header Parameters

Authorization*string

格式: Authorization: Bearer sk-xxxxxx

Request Body

application/json

images*

Input image references to edit. For GPT image models, you can provide up to 16 images.

prompt*string

A text description of the desired image edit.

minLength1 maxLength32000

background?string

optional "transparent" or "opaque" or "auto" Background behavior for generated image output.

input_fidelity?string

optional "high" or "low" Controls fidelity to the original input image(s).

mask?

Reference an input image by either URL or uploaded file ID. Provide exactly one of image_url or file_id.

model*string

模型名称,固定值: gpt-image-1.5

moderation?string

optional "low" or "auto" Moderation level for GPT image models.

n?integer

The number of edited images to generate.

minimum1 maximum10

output_compression?integer

Compression level for jpeg or webp output.

minimum0 maximum100

output_format?string

optional "png" or "jpeg" or "webp" Output image format. Supported for GPT image models.

partial_images?string

The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to 0, the response will be a single image sent in one streaming event.

Note that the final image may be sent before the full number of partial images are generated if the full image is generated more quickly.

maximum3 minimum0

quality?integer

optional "low" or "medium" or "high" or "auto" Output quality for GPT image models.

size?string

optional "auto" or "1024x1024" or "1536x1024" or "1024x1536" Requested output image size.

stream?boolean

Stream partial image results as events.

user?string

A unique identifier representing your end-user, which can help OpenAI monitor and detect abuse.

Response Body

application/json

curl -X POST "https://api.aa.com.cn/api/v1/image/generation" \  -H "Authorization: string" \  -H "Content-Type: application/json" \  -d '{    "images": [      {        "file_id": "string",        "image_url": "string"      }    ],    "prompt": "string",    "model": "string"  }'
{
  "code": 0,
  "data": {
    "urls": [
      "string"
    ],
    "usage": {
      "images": 0,
      "seconds": 0,
      "input_tokens": 0,
      "total_tokens": 0,
      "output_tokens": 0
    },
    "expired": "string",
    "task_id": "string",
    "task_status": "string"
  },
  "message": "string",
  "request_id": "string"
}