Skip to main content
POST
OpenAI image edits
このエンドポイントは、画像の編集、修復、ソース画像の変換に使用します。
  • Authorization: Bearer {API_KEY}で認証する
  • このエンドポイントは通常、multipart/form-data を使用します
  • 必要な入力は通常、imageprompt ですが、mask は編集可能な領域を狭めます。
  • gpt-image-1dall-e-2 は、ファイル サイズ制限、マルチイメージ サポート、および input_fidelity において大きく異なります。
  • 応答に一時的な url 値が含まれている場合は、それらをすぐにミラーリングします。 b64_json が含まれている場合は、メインスレッドで大きな画像をデコードしすぎないようにします。

承認

Authorization
string
header
必須

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

ボディ

multipart/form-data
image
必須

Input image or images to edit.

prompt
string
必須

Text instruction describing the desired edit.

:

"在图片中添加一朵红色的玫瑰花"

background
enum<string>

Only supported by gpt-image-1.

利用可能なオプション:
transparent,
opaque,
auto
input_fidelity
enum<string>

Only supported by gpt-image-1.

利用可能なオプション:
high,
low
mask
file

Optional PNG mask file. Usually must match the image dimensions.

model
enum<string>

Image editing model.

利用可能なオプション:
gpt-image-1,
dall-e-2
n
integer
デフォルト:1

Number of edited images to generate.

必須範囲: 1 <= x <= 10
output_compression
integer
デフォルト:100

Compression level for gpt-image-1 jpeg/webp output.

必須範囲: 0 <= x <= 100
output_format
enum<string>

Only supported by gpt-image-1.

利用可能なオプション:
png,
jpeg,
webp
partial_images
integer
デフォルト:0

Number of partial images for streaming previews.

必須範囲: 0 <= x <= 3
quality
enum<string>

Supported values vary by model.

利用可能なオプション:
auto,
high,
medium,
low,
standard
response_format
enum<string>

Only applies to dall-e-2.

利用可能なオプション:
url,
b64_json
size
enum<string>

Allowed values depend on the selected model.

利用可能なオプション:
1024x1024,
1536x1024,
1024x1536,
auto,
256x256,
512x512
stream
boolean
デフォルト:false

Streams edited image output when supported.

user
string

Unique identifier for the end user.

レスポンス

Successful image edit response

created
integer<int64>
必須

Unix timestamp in seconds.

data
object[]
必須
background
enum<string>
利用可能なオプション:
transparent,
opaque,
auto
output_format
enum<string>
利用可能なオプション:
png,
jpeg,
webp
quality
enum<string>
利用可能なオプション:
auto,
high,
medium,
low,
hd,
standard
size
string
usage
object