Content पर जाएं

Image edit करें

client.images.edit(params)
POST/v1/images/edits

SandBase के synchronous OpenAI Images-compatible multipart endpoint से एक या अधिक upload की गई images edit करें।

Request body

ImageEditParams
stringmodelज़रूरी

gpt-image-2, gpt-image-2.5-flare या gpt-image-2.5-sunburst में से एक।

stringpromptज़रूरी

अनुरोधित edit का text विवरण।

file | file[]imageज़रूरी

एक या अधिक source image files। कई images के लिए multipart field दोहराएँ।

वैकल्पिक<file>mask

inpainting के लिए वैकल्पिक mask image।

वैकल्पिक<integer>n

समर्थित होने पर लौटाई जाने वाली edited images की संख्या।

वैकल्पिक<string>size

Model द्वारा समर्थित output dimensions।

वैकल्पिक<string>quality

Model द्वारा समर्थित output quality।

वैकल्पिक<string>background

Output background setting।

वैकल्पिक<string>input_fidelity

समर्थित models को source image के details कितनी बारीकी से बनाए रखने चाहिए।

वैकल्पिक<string>output_format

Output encoding, जैसे png, webp या jpeg।

वैकल्पिक<integer>output_compression

0 से 100 तक output compression level।

वैकल्पिक<string>user

Provider-compatible end-user identifier।

Multipart uploads

model, prompt और image को multipart/form-data के रूप में भेजें। image field दोहराने से कई source files बनी रहती हैं।

केवल synchronous

stream=true, mode=stream और mode=async अस्वीकार किए जाते हैं।

त्रुटियाँ

400

अमान्य multipart body, असमर्थित model, streaming mode या provider request।

401

API key मौजूद नहीं है या अमान्य है।

402

Organization या API Key की spending limit पूरी हो गई है।

403

API key scope इस endpoint की अनुमति नहीं देता।

404

Routed image-edit model उपलब्ध नहीं है।

429

Rate limit पार हो गई।

500

Request persistence या response processing विफल रही।

502

Provider ने अमान्य native response लौटाया।

503

कोई भी provider route सफल नहीं हुआ।

समर्थित models ​

ये OpenAI image models इस endpoint पर और /v1/images/generations पर native Images API का उपयोग करते हैं। model में public model name भेजें:

modelकिसके लिए सबसे अच्छा
gpt-image-2.5-flareरोज़मर्रा के creative काम के लिए तेज़, उच्च-गुणवत्ता वाला generation और editing
gpt-image-2.5-sunburstऐसा काम जहाँ visual fidelity और precision सबसे ज़्यादा मायने रखते हैं
gpt-image-2पिछली GPT Image generation

Requests synchronous होते हैं और image data को data में b64_json या URL के रूप में लौटाते हैं। यह endpoint सामान्य asynchronous /v1/run model endpoint से अलग है; model catalog में हर model का page उस contract और उसकी pricing का विवरण देता है।

model, prompt और कम से कम एक image file दें। कई source images को compose या edit करने के लिए image field दोहराएँ:

bash
curl https://api.sandbase.ai/v1/images/edits \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -F "model=gpt-image-2.5-flare" \
  -F "prompt=Turn this product photo into a warm editorial scene" \
  -F "image=@product.png" \
  -F "quality=high"