Skip to main content
POST
/
v1
/
images
/
edits
Edit an image
curl --request POST \
  --url https://api.deepshi.ai/v1/images/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form model=nano-banana-2 \
  --form 'prompt=remove the person on the left' \
  --form 'image[]=<string>' \
  --form 'image=<string>' \
  --form n=1 \
  --form response_format=b64_json \
  --form stream=false \
  --form seed=123 \
  --form width=123 \
  --form height=123 \
  --form aspect_ratio=16:9 \
  --form resolution=2K \
  --form image_size=auto_2K \
  --form 0.image[].items='@example-file' \
  --form 0.image.items='@example-file' \
  --form 1.image.items='@example-file' \
  --form 1.image[].items='@example-file'
{
  "created": 123,
  "model": "<string>",
  "size": "<string>",
  "data": [
    {
      "index": 123,
      "b64_json": "<string>",
      "url": "<string>",
      "revised_prompt": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "cached_read_tokens": 123,
      "image_tokens": 123
    },
    "completion_tokens": 123,
    "completion_tokens_details": {
      "reasoning_tokens": 123,
      "image_tokens": 123
    },
    "total_tokens": 123,
    "cost": {
      "total_cost": 0.000135
    }
  }
}

Authorizations

Authorization
string
header
required

Your Deepshi API key, sent as Authorization: Bearer <key>.

Body

multipart/form-data

Image edit request, sent as multipart/form-data. model, prompt, and at least one input image are required. Send the image files under either image[] or image — both are accepted.

model
string
required

The image model id to use. See GET /v1/models.

Example:

"nano-banana-2"

prompt
string
required

Instruction describing the edit to perform.

Example:

"remove the person on the left"

image[]
file[]
required

One or more input images to edit, each sent as a separate image[] part. How many reference images a model accepts varies from 1 up to 14. See the edit block in GET /v1/models.

image
file[]

Same as image[], under the field name the OpenAI SDKs use when you pass a single file. Send images under either this or image[].

n
integer
default:1

Number of images to generate (1–4).

Required range: 1 <= x <= 4
response_format
enum<string>
default:b64_json

How images are returned. url returns an inline base64 data: URI, not a hosted link.

Available options:
b64_json,
url
output_format
enum<string>

Encoding of the returned image. Not all models honor every format.

Available options:
png,
jpeg,
webp
stream
boolean
default:false

Stream the result as Server-Sent Events. Use it for slow, high-resolution generations that would otherwise time out.

seed
integer

Seed for reproducible output. Omit for a random seed.

width
integer

Model-specific. Output width in pixels, for pixel-dimension models (e.g. flux-2-pro).

height
integer

Model-specific. Output height in pixels, for pixel-dimension models.

aspect_ratio
string

Model-specific. Aspect ratio for aspect-ratio and resolution-tier models.

Example:

"16:9"

resolution
string

Model-specific. Resolution tier for resolution-tier models (e.g. nano-banana-2, nano-banana-pro, grok-imagine-quality). Determines the billed price for those models.

Example:

"2K"

quality
enum<string>

Model-specific. Quality tier for the GPT Image models (gpt-image-1.5, gpt-image-2). Higher tiers cost more, and the price depends on the image size and quality you pick. Omit to use the model's default tier.

Available options:
low,
medium,
high
image_size
string

Model-specific. Named output size for preset-size models (e.g. seedream-4.5).

Example:

"auto_2K"

Response

The edited image(s). When stream: true, the response is a Server-Sent Events stream (text/event-stream): periodic keepalive comments followed by a terminal image_generation.completed event carrying the final image (see the ImageStreamEvent schema).

created
integer<int64>

Unix timestamp when the request was created.

model
string

The image model id you requested.

size
string

The actual output dimensions, as WIDTHxHEIGHT.

data
object[]

The generated image(s).

usage
object

Token usage and the billed cost for the request.