gpt-imagegpt-image-2
gpt-image-2 · Edit
Image / GPT / gpt-image-2 / Edit
POST
/v1/images/editsRequest parameters
Authorization
Add an Authorization header whose value is Bearer followed by your API key.
Authorization: Bearer ****************
Body parametersmultipart/form-datarequired
modelstringRequired
Model ID, fixed to `gpt-image-2`
promptstringRequired
Edit instruction, e.g. change the background to a snowy night
imagefileRequired
Image(s) to edit; can be sent multiple times (`image` or `image[]`)
maskfileOptional
Mask image marking the area to modify
nintegerOptional
Number of images, default `1`
sizestringOptional
Resolution, e.g. `1024x1024`
response_formatstringOptional
Return format. `url` only applies to models that support it (e.g. DALL-E); OpenAI gpt-image always returns `b64_json` and ignores this field.
Example
{ "model": "gpt-image-2", "prompt": "change the background to a snowy night", "image": "dog.png", "size": "1024x1024"}Request code samples
curl https://api.starmodel.ai/v1/images/edits \ -H "Authorization: Bearer $API_KEY" \ -F "model=gpt-image-2" \ -F "prompt=change the background to a snowy night" \ -F "image=@dog.png" \ -F "size=1024x1024"Response
200 · Success
createdintegerOptional
Creation timestamp (seconds)
dataarray[object]Required
Generated images
Example
{ "created": 1730000000, "data": [ { "b64_json": "<base64>" } ]}
