主题切换
蒙版 gpt-image-1
OpenAPI Specification
yaml
openapi: 3.0.1
info:
title: ''
description: ''
version: 1.0.0
paths:
/v1/images/edits:
post:
summary: 蒙版 gpt-image-1
deprecated: false
description: |-
给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。
为提供的提示和参数创建完成
官方文档:https://platform.openai.com/docs/api-reference/images/createEdit
tags:
- 绘画模型/GPT Image 系列
parameters:
- name: Accept
in: header
description: ''
required: true
example: application/json
schema:
type: string
- name: Authorization
in: header
description: ''
required: false
example: Bearer {{YOUR_API_KEY}}
schema:
type: string
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
image:
format: binary
type: string
description: >
要编辑的图片。必须是受支持的图片文件或图片数组。对于 gpt-image-1,每张图片应为小于 25MB 的
png、webp 或 jpg 文件。对于 dall-e-2,您只能提供一张图片,并且该图片应为小于 4MB 的方形
png 文件。
example: file://C:\Users\Administrator\Desktop\sunlit_lounge.png
prompt:
description: >
所需图像的文本描述。dall-e-2 的最大长度为 1000 个字符,gpt-image-1 的最大长度为 32000
个字符。
example: >-
A sunlit indoor lounge area with a pool containing a
flamingo
type: string
mask:
format: binary
type: string
description: >
一张附加图片,其完全透明区域(例如,alpha 值为零)指示应编辑 image
位置。如果提供了多张图片,则遮罩将应用于第一张图片。必须是有效的 PNG 文件,小于 4MB,且尺寸与 image
相同。
example: file://C:\Users\Administrator\Desktop\mask.png
model:
description: >
用于生成图像的模型。仅 gpt-image-1, gpt-image-1-all ,
flux-kontext-pro , flux-kontext-max。
example: gpt-image-1
type: string
'n':
description: |
要生成的图像数量。必须介于 1 到 10 之间。
example: '1'
type: string
quality:
description: >
生成图像的质量。只有 gpt-image-1 支持 high、medium 和 low 质量。dall-e-2 仅支持
standard 质量。默认为 auto。
example: ''
type: string
response_format:
description: >
返回生成图像的格式。必须是 url 或 b64_json 之一。URL 在图像生成后 60 分钟内有效。此参数仅适用于
dall-e-2,因为 gpt-image-1 始终返回 base64 编码的图像,请不要使用这个参数。
example: b64_json
type: string
size:
description: >+
生成图像的尺寸。对于 GPT 图像模型,必须是 1024x1024 、 1536x1024 (横版)、
1024x1536 (竖版)或 auto (默认值)之一,对于 dall-e-2 必须是 256x256 、
512x512 或 1024x1024 之一,对于 dall-e-3 必须是 1024x1024 、 1792x1024
或 1024x1792 之一。
example: 1024x1024
type: string
background:
description: >
允许为生成的图像的背景设置透明度。此参数仅在 gpt-image-1 中受支持。其值必须为
“透明(transparent)”、“不透明(opaque)” 或 “自动(auto)”(默认值)之一。当使用
“自动(auto)” 时,模型将自动为图像确定最佳背景。
example: transparent
type: string
moderation:
description: >
控制由 gpt-image-1 生成的图像的内容审核级别。可以设置为 “low” 以进行限制较少的过滤,也可以设置为
“auto”(默认值)。
example: low
type: string
required:
- image
- prompt
example:
size: 1024x1024
prompt: 一直可爱的小猪
model: gpt-image-1
'n': 1
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties:
id:
type: string
object:
type: string
created:
type: integer
choices:
type: array
items:
type: object
properties:
index:
type: integer
message:
type: object
properties:
role:
type: string
content:
type: string
required:
- role
- content
x-apifox-orders:
- role
- content
finish_reason:
type: string
x-apifox-orders:
- index
- message
- finish_reason
usage:
type: object
properties:
prompt_tokens:
type: integer
completion_tokens:
type: integer
total_tokens:
type: integer
required:
- prompt_tokens
- completion_tokens
- total_tokens
x-apifox-orders:
- prompt_tokens
- completion_tokens
- total_tokens
required:
- id
- object
- created
- choices
- usage
x-apifox-orders:
- id
- object
- created
- choices
- usage
example:
id: chatcmpl-123
object: chat.completion
created: 1677652288
choices:
- index: 0
message:
role: assistant
content: |-
Hello there, how may I assist you today?
finish_reason: stop
usage:
prompt_tokens: 9
completion_tokens: 12
total_tokens: 21
headers: {}
x-apifox-name: OK
security: []
x-apifox-folder: 绘画模型/GPT Image 系列
x-apifox-status: released
x-run-in-apifox: https://app.apifox.com/web/project/7937429/apis/api-427877304-run
components:
schemas: {}
securitySchemes:
bearer:
type: http
scheme: bearer
servers:
- url: https://new.22codex.xyz
description: 正式环境
security:
- bearer: []