# Edit image (image-to-image)

Generate a new image from one or more reference images + a text prompt.
Uses OpenAI-standard `multipart/form-data` with binary uploads. Multiple
references go in via repeated `image[]` fields; a single reference can
also use the `image` field.

Billing matches `/v1/images/generations`: settles on upstream
`usage.input_tokens` / `output_tokens` (reference images are billed as
image input).

## POST /v1/images/edits

> Edit image (image-to-image)

Generate a new image from one or more reference images + a text prompt.
Uses OpenAI-standard `multipart/form-data` with binary uploads. Multiple
references go in via repeated `image[]` fields; a single reference can
also use the `image` field.

Billing matches `/v1/images/generations`: settles on upstream
`usage.input_tokens` / `output_tokens` (reference images are billed as
image input).

### Authentication

`Authorization: Bearer tr-xxx`

### Request Body

Content-Type: `multipart/form-data`

- **model** `string` **(required)**  
  
- **prompt** `string` **(required)**  
  Text description (max 32K characters)
- **image** `string` **(required)**  
  Reference image (PNG/JPEG/WebP, ≤4MB each). Use `image[]` for multiple.
- **size** `string`  
  
- **quality** ``low` | `medium` | `high` | `auto`` (default: `auto`)  
  
- **n** `integer` (default: `1`)  
  
- **response_format** ``url` | `b64_json``  
  Return style. Supported on Seedream (including 5.0 Pro).
- **output_format** ``png` | `jpeg``  
  Output file format. Seedream 5.0 Pro/Lite (including the 5.0 alias) support png/jpeg. Seedream 4.5/4.0 have fixed JPEG output and reject this parameter; omit it.

### Response

- **created** `integer`  
  Creation time (Unix timestamp in seconds)
- **data** `object[]`  
  List of generated images
- **data[].url** `string`  
  Image access URL
- **data[].b64_json** `string`  
  Base64 image payload when `response_format=b64_json`
- **usage** `object`  
  Token usage (returned by token-billed models such as `gpt-image-2`)
- **usage.input_tokens** `integer`  
  Input tokens (text + reference images)
- **usage.output_tokens** `integer`  
  Output tokens (generated image)
- **usage.total_tokens** `integer`  
  

### Error Codes

- `400`: 
- `401`: 
- `402`: 
- `429`: 
- `502`:
