Skip to content

Edit Image

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

Edit one or more uploaded images through SandBase's synchronous OpenAI Images-compatible multipart endpoint.

Request body

ImageEditParams
stringmodelrequired

One of gpt-image-2, gpt-image-2.5-flare, or gpt-image-2.5-sunburst.

stringpromptrequired

Text description of the requested edit.

file | file[]imagerequired

One or more source image files. Repeat the multipart field for multiple images.

Optional<file>mask

Optional mask image for inpainting.

Optional<integer>n

Number of edited images to return when supported.

Optional<string>size

Output dimensions supported by the model.

Optional<string>quality

Output quality supported by the model.

Optional<string>background

Output background setting.

Optional<string>input_fidelity

How closely supported models should preserve source-image details.

Optional<string>output_format

Output encoding such as png, webp, or jpeg.

Optional<integer>output_compression

Output compression level from 0 to 100.

Optional<string>user

Provider-compatible end-user identifier.

Multipart uploads

Send model, prompt, and image as multipart/form-data. Repeating the image field preserves multiple source files.

Synchronous only

stream=true, mode=stream, and mode=async are rejected.

Errors

400

Invalid multipart body, unsupported model, streaming mode, or provider request.

401

Missing or invalid API key.

402

Organization or API Key spending limit reached.

403

API key scope does not authorize this endpoint.

404

The routed image-edit model is unavailable.

429

Rate limit exceeded.

500

Request persistence or response processing failed.

502

The provider returned an invalid native response.

503

No provider route succeeded.

Supported models ​

These OpenAI image models use the native Images API on this endpoint and on /v1/images/generations. Send the public model name in model:

modelBest for
gpt-image-2.5-flareFast, high-quality generation and editing for everyday creative work
gpt-image-2.5-sunburstWork where visual fidelity and precision matter most
gpt-image-2The previous GPT Image generation

Requests are synchronous and return image data in data as b64_json or a URL. This endpoint is separate from the general asynchronous /v1/run model endpoint; each model's page in the model catalog documents that contract and its pricing.

Provide model, prompt, and at least one image file. Repeat the image field to compose or edit multiple source images:

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"