メインコンテンツへスキップ
POST
Image editing: edit or fuse reference images with locked output size
右側のインタラクティブな Playground では、ローカル画像の直接アップロードに対応しています。Authorization フィールドに API Key を入力し(形式: Bearer sk-xxx)、画像を選択して prompt / model / size を設定したら、送信をクリックしてください。
対象範囲: このページは1枚または複数の参照画像の編集や融合を対象としています。リクエストには multipart/form-data を使用します。純粋なテキストからの画像生成については、テキストから画像生成のエンドポイントをご覧ください。gpt-image-2-all との違い: 呼び出しの構造は同一で、size フィールドが1つ追加されているだけです。寸法を固定する必要がなく、最速の出力を希望する場合は、gpt-image-2-allをご利用ください。
🖥️ ブラウザ Playground の制限事項このエンドポイントはデフォルトで base64 文字列(b64_json)を返します。これは数MBになることがあるため、ブラウザの Playground では 请求时发生错误: unable to complete request と表示される場合があります — リクエスト自体は実際には成功しています。ブラウザ側でこれほど長い base64 文字列をレンダリングできないだけです。推奨ワークフロー: base64 を取得したい場合や、非常に大きな参照画像をアップロードする必要がある場合は、以下のコードサンプルをコピーしてローカルで実行してください。
📎 複数画像の融合順序に関する注意image フィールドは複数の参照画像を受け付けます。その順序が、prompt 内で「image1 / image2 / image3」として参照する際の基準となります。 prompt 内でそれらを明示的に参照してください(例:
image1 の人物を image2 のシーンに配置し、image3 の絵画スタイルにしてください
1画像あたり ≤ 10MB、フォーマットは png / jpg / webp を推奨します。画像サイズが大きすぎると、ゲートウェイの制限に達する可能性があります。
🎯 形状を維持した編集: size=auto を渡す(または size を省略する)と、出力は prompt で編集対象として指定された参照画像のアスペクト比を継承します。複数画像のシナリオにおいて、必ずしも最初の画像とは限りません。たとえば、「image2 を変更し、image2 の服装と帽子を image1 に合わせて変更」という prompt の場合、image2 が 1:1 であれば、出力も 1:1 になります(たとえ image1 が横長の 16:9 であっても)。服装の着せ替え、小物の追加、レタッチなど、形状を維持した編集に役立ちます。prompt で対象が指定されていない場合、モデルが独自に判断します。アスペクト比を変更する必要がある場合のみ、明示的な30種類のバケットから size を渡してください。
⚠️ 主要パラメータの注意事項
  • size: 編集を行う場合は、auto を推奨します(またはフィールドを省略してください) — モデルは、複数画像のシナリオにおいて必ずしも最初の画像ではなく、prompt で編集対象として指定された参照画像のアスペクト比を維持します。たとえば、「image2 を変更し、image2 の服装を image1 に合わせて変更」という prompt の場合、出力比率は image2 と一致します。prompt で区別されていない場合は、モデルが独自に判断します。異なる寸法を強制したい場合は、サポートされている30種類のサイズから1つ選択してください。小文字の ASCII x を使用します(例: 2048x1360、3840x2160)。一覧表: 概要ページ。
  • quality: 任意指定であり、テストで有効です(チャネルの動作であり、確約ではありません — 実際のレスポンスに従ってください)。2.5 モデル(gpt-image-2.5-vip = gpt-image-2.5-sunburst-vip、gpt-image-2.5-flare-vip)は全6段階(auto / low / medium / high / xhigh / max)を受け入れます。gpt-image-2-vip は high までで、xhigh / max は拒否されます。同名の階層でも同等ではありません。2.5 の high は gpt-image-2-vip medium にのみ一致し、2.5 の max はその high に一致します。1画像あたり一律 $0.03 であり、階層によって変わりませんが、上位の階層ほど時間がかかります。
  • n: ❌ 拒否されます — 1回の呼び出しにつき1画像のみです。
  • response_format: 省略すると base64 が返されます(プレフィックスなしの生データ、2026年7月検証済み)。画像 URL を取得するには "url" を渡してください。URL 出力に依存するビジネスでは、base64 へのフォールバックなしで確実に URL を出力させるために、token を image2_OSS グループに切り替えてください。

コード例

Python

単一画像編集:
複数画像の融合:

cURL

単一画像編集:
複数画像の融合:

Node.js(ネイティブ fetch + FormData)

ブラウザー JavaScript(Fileオブジェクト)

パラメーター

マルチターン反復:前回の出力を次の呼び出しのimageとして再入力し、新しい編集指示で段階的に調整します。各ラウンドでは独自のsizeを指定できます。

応答形式

text-to-image エンドポイントと同様です: 既定で base64 を返します(data[0].b64_json、プレフィックスなしの生の base64、2026年7月に確認済み)。画像URL を取得するには、response_format: "url" を明示的に指定してください。URL 出力に依存する 事業者は、プレフィックスなしで決定的に URL を出力するよう、トークンを image2_OSS グループ に切り替える必要があります。data[0] は url または b64_json のどちらかを返し、両方が返ることはありません。 b64_json モード(既定):
url モード(response_format: "url" を明示的に指定してください。URL に依存する場合は image2_OSS グループを使用してください):
2026年7月に確認済み: b64_json フィールドは data: プレフィックスなしの生の base64 です — レンダリングする前にデコードするか、自分でプレフィックスを付けてください。以前のバージョンではプレフィックスが含まれていました ので、両方の形式に対応するために最初に必ず startsWith('data:') を確認してください。

関連リソース

モデル概要(フルサイズ表)

30サイズの完全な表、料金、技術仕様

テキストから画像への API

/v1/images/generations互換エンドポイント

姉妹モデル gpt-image-2-all

固定サイズが不要な場合は同じ呼び出し形式で利用でき、出力がより高速です

承認

Authorization
string
header
必須

API Key from the API易 Console

ボディ

multipart/form-data
model
enum<string>
デフォルト:gpt-image-2.5-vip
必須

Model name: gpt-image-2.5-vip (= sunburst-vip) / gpt-image-2.5-flare-vip / gpt-image-2-vip, same price and call format

利用可能なオプション:
gpt-image-2.5-vip,
gpt-image-2.5-sunburst-vip,
gpt-image-2.5-flare-vip,
gpt-image-2-vip
prompt
string
必須

Edit/fusion instruction. For multi-image flows, reference upload order as image1/image2/image3

例:

"Place the person from image1 into the scene of image2, in the style of image3"

image
file[]
必須

Reference images. For a single image, send the field once; for multiple images, repeat the same image field (e.g., -F [email protected] -F [email protected]) — upload order maps to image1 / image2 / ... in the prompt. Recommended ≤ 10MB each, formats png / jpg / webp.

quality
enum<string>

Quality tier (works in testing; channel behavior, not a commitment — go by the actual response). All six tiers on the 2.5 models (gpt-image-2.5-vip / gpt-image-2.5-sunburst-vip / gpt-image-2.5-flare-vip); gpt-image-2-vip stops at high and rejects xhigh / max. Same-named tiers are not equal: 2.5 high only equals gpt-image-2-vip medium, and 2.5 max equals its high. The flat $0.03 does not change with the tier, but latency rises with it.

利用可能なオプション:
auto,
low,
medium,
high,
xhigh,
max
例:

"high"

size
enum<string>

Output size. For editing, prefer auto (or omit the field) — the model preserves the aspect ratio of whichever reference image the prompt names as the target of the edit (not necessarily the first one in multi-image scenarios). For example, with the prompt "modify image2, change image2's outfit to match image1", the output ratio matches image2. If the prompt doesn't disambiguate, the model decides on its own. To force a different dimension, pick one of the 30 supported sizes; format: WIDTHxHEIGHT with lowercase ASCII x, e.g., 2048x1360, 3840x2160. Flat $0.03/image across all tiers.

利用可能なオプション:
auto,
1280x1280,
848x1280,
1280x848,
960x1280,
1280x960,
1024x1280,
1280x1024,
720x1280,
1280x720,
1280x544,
2048x2048,
1360x2048,
2048x1360,
1536x2048,
2048x1536,
1632x2048,
2048x1632,
1152x2048,
2048x1152,
2048x864,
2880x2880,
2336x3520,
3520x2336,
2480x3312,
3312x2480,
2560x3216,
3216x2560,
2160x3840,
3840x2160,
3840x1632
例:

"2048x1360"

レスポンス

Image successfully generated. Defaults to base64 in data[0].b64_json — url is not returned in the same response.

Image editing response. Returns base64 by default (data[0].b64_json); to get a url, switch to the image2_OSS group with response_format=url. data[0] returns either url or b64_json, never both.

data
object[]

Result array (this model returns 1 image per call)

created
integer

Unix timestamp (seconds)

usage
object

Token usage statistics