コンテンツにスキップ
オープンキャスタリーコンソール

画像

gpt-image-2 API

このページに表示されている正確なモデル ID を使用して、Modelflare を通じて gpt-image-2 を呼び出します。

正確なモデル ID gpt-image-2 を使用します。モデル フィールドはこのページと正確に一致する必要があります。

コインランドリーの洗濯機から明るい弧を描いて上向きに流れ出る色ガラス玉。

サンプル出力gpt-image-2POST /v1/images/generations

パラメータ: size=1536x1024n=1

プロンプト: A 24-hour laundromat at three in the morning, a whole wall of front-loaders turning. A young man in a silver metallic bomber jacket has just tipped a jar of coloured glass marbles into the nearest drum. The marbles are pouring upward out of the open door instead of sinking, already arcing across the room in a bright teal and amber bridge that rings against the ceiling lights. Cold cyan tubes overhead, a hard warm amber glow thrown out of the drum itself. Straight-on symmetrical camera, wide, hyper-real detail in the glass, film grain, no text.

このサンプルを作成したリクエスト
{
"model": "gpt-image-2",
"prompt": "A 24-hour laundromat at three in the morning, a whole wall of front-loaders turning. A young man in a silver metallic bomber jacket has just tipped a jar of coloured glass marbles into the nearest drum. The marbles are pouring upward out of the open door instead of sinking, already arcing across the room in a bright teal and amber bridge that rings against the ceiling lights. Cold cyan tubes overhead, a hard warm amber glow thrown out of the drum itself. Straight-on symmetrical camera, wide, hyper-real detail in the glass, film grain, no text.",
"n": 1,
"size": "1536x1024"
}

https://modelflare.dev/v1 で Modelflare API キーを使用します。ゲートウェイのエントリ ポイントは POST /v1/images/generations です。

HTTP
Authorization: Bearer YOUR_MODELFLARE_API_KEY
ターミナルウィンドウbash
curl https://modelflare.dev/v1/images/generations \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A white cat runs through a neon-lit street in the rain",
"size": "1024x1024", "n": 1
}'

OpenAI 互換の画像モデルは prompt、n、size、および quality を使用します。公式ページに文書化されている場合にのみ編集を使用してください。

GPT Image は OpenAI 互換の画像 API を使用します。生成には JSON を使用します。編集とマスクガイド付き編集はマルチパートを使用します。 GPT Image 2 は、Base64 画像データを data[].b64_json で返します。

フィールド 必須 注意事項
model はい gpt-image-2
prompt はい 生成または編集命令
size いいえ auto またはカスタム WIDTHxHEIGHT
quality いいえ low / medium / high / auto;デフォルトauto
background いいえ auto / opaque / transparent;透明な背景には PNG または WebP 出力が必要です
output_format いいえ png / jpeg / webp
output_compression いいえ JPEG/WebP の場合は 0 ~ 100、デフォルトは 100。 PNG の場合は無視されます
moderation いいえ auto / low;デフォルト auto
n いいえ 1 ~ 10 出力。デフォルト 1

カスタム サイズでは、両方のエッジが 16 の倍数、アスペクト比が 1:3 ~ 3:1、最大エッジが 3,840 ピクセル、合計ピクセルが 655,360 ~ 8,294,400 である必要があります。編集では最大 16 個のソース画像を受け入れ、各ソースとマスクは 50 MB 未満です。 DALL・E-only response_formatは送信しないでください。

GPT Image 2 つの編集では、マルチパート image/image[] で /v1/images/edits を使用します。最大 16 個の入力画像が受け入れられ、マスクは最初の画像の形式と寸法に一致する必要があります。

ターミナルウィンドウbash
curl https://modelflare.dev/v1/images/edits \
-H "Authorization: Bearer YOUR_MODELFLARE_API_KEY" \
-F "model=gpt-image-2" \
-F "image[]=@/path/to/product.png" \
-F "mask=@/path/to/mask.png" \
-F "prompt=保持主体不变,将背景替换为暖色摄影棚渐变" \
-F "size=1536x1024" \
-F "quality=high" \
-F "output_format=png" \
-F "n=1"

無効なモデル パラメーターは、リクエスト ID を含む 4xx を返します。選択したモデル コントラクトによって定義された応答フィールドとエラー メッセージを使用します。

このページでは、Modelflare モデルの生成と編集呼び出しについて説明します。検索またはマップのエンリッチメント、音声管理、および要素ライブラリ管理は、このパブリック モデル呼び出しサーフェスの外部にあるリソース API であり、必須のリクエスト フィールドではありません。

このモデルはトークンベースの課金を使用します。現在の顧客価格、参考定価、完全な仕様については、モデル価格ページを参照してください。

メディア契約 · v1

契約ID: media.gpt-image-2.v1アダプター: image.openai.edit.v1@v1指紋: 28b44e2700854f28e2c7b40f6117990dbe3673ec06855b4fc90f34a785b761fa

公式ソース: OpenAI

契約パラメータ

インテントフィールドコントロールオプション
sizeselectauto / 1024x1024 / 1536x1024 / 1024x1536
qualityselectauto / low / medium / high
nnumber—

サポートされる機能

  • allowed_values · size · auto, 1024x1024, 1536x1024, 1024x1536
  • allowed_values · quality · auto, low, medium, high
  • max_assets · reference_asset_ids · 16

構造化リクエストの例

text

インテント

{
  "n": 1,
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "quality": "auto",
  "size": "auto"
}

プロバイダーリクエスト

{
  "model": "gpt-image-2",
  "n": 1,
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "quality": "auto",
  "size": "auto"
}

reference

インテント

{
  "n": 1,
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "quality": "auto",
  "size": "auto"
}

プロバイダーリクエスト

{
  "images": [
    "https://example.com/reference.png"
  ],
  "model": "gpt-image-2",
  "n": 1,
  "prompt": "A red paper kite over a quiet harbour at dusk.",
  "quality": "auto",
  "size": "auto"
}