> ## 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.

# 画像編集を作成

> multipart/form-data で参照画像をアップロードし、編集結果を生成します。

`/v1/images/edits` は `multipart/form-data` を受け取り、参照画像をファイルとしてアップロードします。参照画像がすでに URL または Data URL の場合は、[画像生成を作成](/jp/api-reference/images/gpt-image-2/generation)で `image_urls` を指定し、非同期フローを使用する方法がより安定しているため推奨します。

## リクエスト URL

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

少なくとも 1 つの `image` ファイルをアップロードしてください。

## 1 枚の画像を使用する例

```bash theme={null}
curl "https://dimilinks.com/v1/images/edits" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=主体を維持したまま、画像をレトロなフィルム写真風に変更する" \
  -F "size=16:9" \
  -F "resolution=2k" \
  -F "image=@/path/to/reference.png"
```

## 複数の画像を使用する例

参照画像は最大 9 枚までアップロードできます。

```bash theme={null}
curl "https://dimilinks.com/v1/images/edits" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -F "model=gpt-image-2" \
  -F "prompt=2 枚の参照画像のスタイルを融合し、EC サイトの商品メイン画像を生成する" \
  -F "size=1:1" \
  -F "resolution=4k" \
  -F "image[]=@/path/to/ref-1.png" \
  -F "image[]=@/path/to/ref-2.png"
```

## ファイルフィールド

| フィールド               | 説明                       |
| ------------------- | ------------------------ |
| `image`             | 単一ファイル。推奨。               |
| `image[]`           | 複数ファイル。最大 9 個。           |
| `images`            | 複数ファイル用の互換フィールド。         |
| `images[]`          | 複数ファイル用の互換フィールド。         |
| `image_1`、`image_2` | 番号付きフィールドとの互換用。          |
| `mask`              | 任意。現在は参照画像としてまとめて処理されます。 |

## レスポンス

成功すると、生成 API と同じ構造が返ります。

```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

````