圖片
gpt-image-2 API
透過 Modelflare 使用本頁顯示的確切型號 ID 呼叫 gpt-image-2。
使用準確的型號 ID gpt-image-2。模型欄位必須與此頁面完全相符。

參數: 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"}身份驗證與端點
Section titled “身份驗證與端點”將 Modelflare API 金鑰與 https://modelflare.dev/v1 結合使用。網關入口點是POST /v1/images/generations。
Authorization: Bearer YOUR_MODELFLARE_API_KEYcurl 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 傳回 data[].b64_json 中的 Base64 影像資料。
| 場 | 必填 | 註釋 |
|---|---|---|
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 |
回應與輸入限制
Section titled “回應與輸入限制”自訂尺寸要求兩邊均為 16 的倍數、長寬比為 1:3 到 3:1、最大邊為 3,840 像素、總像素為 655,360–8,294,400。編輯最多接受 16 個來源影像,每個來源影像和遮罩小於 50 MB;不要傳送 DALL·E-only response_format。
GPT Image 2 次編輯使用 /v1/images/edits 和多部分 image/image[];最多接受 16 個輸入影像,且遮罩必須與第一個影像的格式和尺寸相符。
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"錯誤與失敗的任務
Section titled “錯誤與失敗的任務”無效的模型參數傳回帶有請求ID的4xx;使用所選模型合約定義的回應欄位和錯誤訊息。
此頁面涵蓋 Modelflare 模型產生和編輯呼叫。搜尋或地圖豐富、語音管理和元素庫管理是此公共模型呼叫表面之外的資源 API,並且不是必需的請求欄位。
此模型使用基於令牌的計費。請參閱 型號定價頁面 ,以了解當前客戶價格、參考標價和完整規格。
媒體合約 · v1
官方來源: OpenAI
合約參數
| 意圖字段 | 控制項 | 選項 |
|---|---|---|
size | select | auto / 1024x1024 / 1536x1024 / 1024x1536 |
quality | select | auto / low / medium / high |
n | number | — |
支援的功能
allowed_values·size· auto, 1024x1024, 1536x1024, 1024x1536allowed_values·quality· auto, low, medium, highmax_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"
}