> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dimilinks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create image edit

> Upload reference images with multipart/form-data and generate edited results.

`/v1/images/edits` accepts `multipart/form-data` and uploads reference images as files. If your references are already URLs or Data URLs, we recommend using [Create image generation](/en/api-reference/images/gpt-image-2/generation) with `image_urls` for a more reliable asynchronous workflow.

## Request URL

```http theme={null}
POST https://dimilinks.com/v1/images/edits
Content-Type: multipart/form-data
Authorization: Bearer <DIMILINKS_API_KEY>
```

Upload at least one `image` file.

## Single-image example

```bash theme={null}
curl "https://dimilinks.com/v1/images/edits" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Restyle the image as vintage film while preserving the main subject" \
  -F "size=16:9" \
  -F "resolution=2k" \
  -F "image=@/path/to/reference.png"
```

## Multiple-image example

Upload up to nine reference images.

```bash theme={null}
curl "https://dimilinks.com/v1/images/edits" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=Blend the styles of both reference images to create a primary ecommerce product image" \
  -F "size=1:1" \
  -F "resolution=4k" \
  -F "image[]=@/path/to/ref-1.png" \
  -F "image[]=@/path/to/ref-2.png"
```

## File fields

| Field                | Description                                               |
| -------------------- | --------------------------------------------------------- |
| `image`              | Single file; recommended.                                 |
| `image[]`            | Multiple files, up to nine.                               |
| `images`             | Compatibility field for multiple files.                   |
| `images[]`           | Compatibility field for multiple files.                   |
| `image_1`, `image_2` | Compatibility fields with numbered names.                 |
| `mask`               | Optional. Currently processed as another reference image. |

## Response

On success, the endpoint returns the same structure as the generation endpoint:

```json theme={null}
{
  "created": 1777080000,
  "task_id": "img_xxx",
  "data": [
    {
      "url": "/p/img/img_xxx/0?exp=1777166400000&sig=...",
      "file_id": "file_xxx"
    }
  ]
}
```


## OpenAPI

````yaml POST /images/edits
openapi: 3.1.0
info:
  title: DimiLinks API
  description: >-
    DimiLinks unified API for chat (OpenAI-compatible and Anthropic native),
    image generation/editing, and video generation.
  version: 1.1.0
servers:
  - url: https://dimilinks.com/v1
    description: OpenAI 兼容入口：chat completions / images / videos / models / tasks
security:
  - bearerAuth: []
tags:
  - name: Models
  - name: Chat
  - name: Images
  - name: Videos
  - name: Tasks
paths:
  /images/edits:
    post:
      tags:
        - Images
      summary: Create image edit
      operationId: createImageEdit
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ImageEditRequest'
      responses:
        '200':
          description: Image edit result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    ImageEditRequest:
      type: object
      properties:
        model:
          type: string
          default: gpt-image-2
        prompt:
          type: string
        size:
          type: string
        resolution:
          type: string
        image:
          type: string
          format: binary
        image[]:
          type: array
          items:
            type: string
            format: binary
          maxItems: 9
        mask:
          type: string
          format: binary
      required:
        - prompt
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
          example: 1777080000
        task_id:
          type: string
          example: img_xxx
        data:
          type: array
          items:
            $ref: '#/components/schemas/ImageData'
    ImageData:
      type: object
      properties:
        url:
          type: string
          example: /p/img/img_xxx/0?exp=1777166400000&sig=...
        file_id:
          type: string
          example: file_xxx
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    ErrorObject:
      type: object
      properties:
        message:
          type: string
        type:
          type: string
          example: invalid_request_error
        code:
          oneOf:
            - type: string
            - type: integer
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````