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

# Edit Image (Sync)

> 同步图片编辑，兼容 OpenAI POST /v1/images/edits。使用 multipart/form-data 上传源图（支持多张，字段名均为 image），成功响应后立即扣费。

<Note>
  This is a **synchronous** endpoint compatible with OpenAI `POST /v1/images/edits`. Upload the source image via `multipart/form-data`. On success, billing is applied immediately and the edited image is returned in `data` (`b64_json` or `url`).
</Note>

<Warning>
  Editing often takes **30–120 seconds**. Set client timeout to **≥ 180 seconds**. Each file (`image` / `mask`) must be **≤ 20MB**.
</Warning>


## OpenAPI

````yaml POST /api/open-api/v1/images/edits
openapi: 3.1.0
info:
  title: Jimmy AI OpenAPI
  description: API for Jimmy AI video generation services
  version: 1.0.0
servers:
  - url: https://www.jimmyai.cn
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/open-api/v1/images/edits:
    post:
      summary: Edit Image (Sync)
      description: >-
        Synchronous image edit, compatible with OpenAI POST /v1/images/edits.
        Upload source images via multipart/form-data (multiple files supported,
        all using field name `image`); billed on success.
      operationId: editOpenAIImage
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/OpenAIImageEditRequest'
      responses:
        '200':
          description: Edit successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIImageSyncResponse'
components:
  schemas:
    OpenAIImageEditRequest:
      type: object
      required:
        - image
        - prompt
      properties:
        image:
          type: array
          items:
            type: string
            format: binary
          description: >-
            Source image files (required, max 20MB each, up to 16 files;
            single-file upload also supported, field name `image`)
        model:
          type: string
          default: gpt-image-2
        prompt:
          type: string
          description: Edit prompt
        size:
          type: string
          default: 1024x1024
        'n':
          type: integer
          default: 1
        quality:
          type: string
          enum:
            - low
            - medium
            - high
            - auto
          default: low
        background:
          type: string
          enum:
            - transparent
            - opaque
            - auto
        output_format:
          type: string
          enum:
            - png
            - jpeg
            - webp
    OpenAIImageSyncResponse:
      type: object
      properties:
        code:
          type: integer
          example: 20000
        msg:
          type: string
          example: ok
        data:
          $ref: '#/components/schemas/OpenAIImageSyncResult'
    OpenAIImageSyncResult:
      type: object
      description: OpenAI-compatible image result
      properties:
        created:
          type: integer
          format: int64
        data:
          type: array
          items:
            $ref: '#/components/schemas/OpenAIImageResultItem'
        model:
          type: string
          example: gpt-image-2
        usage:
          $ref: '#/components/schemas/OpenAIImageUsage'
    OpenAIImageResultItem:
      type: object
      properties:
        b64_json:
          type: string
          description: Base64-encoded image (may be several MB)
        revised_prompt:
          type: string
    OpenAIImageUsage:
      type: object
      properties:
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        total_tokens:
          type: integer
        input_tokens_details:
          type: object
          properties:
            image_tokens:
              type: integer
            text_tokens:
              type: integer
        output_tokens_details:
          type: object
          properties:
            image_tokens:
              type: integer
            text_tokens:
              type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````