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

# openai compat edits

> edits a image

## Maven

```xml theme={null}
<dependency>
    <groupId>com.openai</groupId>
    <artifactId>openai-java</artifactId>
    <version>x.x.x</version>
</dependency>
```

## Normal Request Example

<Tabs>
  <Tab title="Java">
    ```java theme={null}
    @Test
    void imageEditTest() {
        OpenAIClient client = OpenAIOkHttpClient.builder()
                .apiKey(apiKey) // Your apiKey
                .baseUrl("https://ai.pmock.com/api/ai/openai/v1")
                .build();

        ImageEditParams params = ImageEditParams.builder()
                .image(Path.of("D:\\20260226142856_235_166.png")) // Your image
                .prompt("change the color to green")
                .responseFormat(ImageEditParams.ResponseFormat.B64_JSON)
                .build();
        ImagesResponse imagesResponse = client.images().edit(params);
        System.out.println(imagesResponse.data());
    }
    ```
  </Tab>
</Tabs>


## OpenAPI

````yaml post /ai/openai/v1/images/edits
openapi: 3.1.0
info:
  title: OpenAPI definition
  version: v0
servers:
  - url: https://ai.pmock.com/api
    description: Generated server url
security: []
tags:
  - name: 开放-百度视频生成
    description: 开放-百度视频生成
  - name: 开放-Grok开放接口
    description: 开放-Grok开放接口
  - name: 开放-Gemini开放接口
    description: 开放-Gemini开放接口
  - name: 开放-AI对话开放接口
    description: 开放-AI对话开放接口
  - name: 开放-Sora2开放接口
    description: 开放-Sora2开放接口
  - name: 开放-模型列表接口
    description: 开放-模型列表接口
  - name: 开放-OpenAi开放接口
    description: 开放-OpenAi开放接口
  - name: 开放-业务相关接口
    description: 开放-业务相关接口
  - name: 开放-任务开放接口
    description: 开放-任务开放接口
paths:
  /ai/openai/v1/images/edits:
    post:
      tags:
        - 开放-OpenAi开放接口
      summary: openai compat edits
      description: edits a image
      operationId: openAiCompatImageEdits
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/OpenAiCompatImageEditDTO'
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: object
components:
  schemas:
    OpenAiCompatImageEditDTO:
      type: object
      properties:
        image:
          type: array
          description: images
          items:
            type: string
            format: binary
          minItems: 1
        prompt:
          type: string
          description: prompt
          minLength: 1
        background:
          type: string
          description: background transparency
          enum:
            - transparent
            - opaque
            - auto
          title: 'transparent : transparent; opaque : opaque; auto : auto'
        inputFidelity:
          type: string
          description: >-
            Input image fidelity (newly added in gpt-image-2, only effective for
            editing scenes); Generate can be ignored)
          enum:
            - high
            - low
          title: 'high : high; low : low'
        mark:
          type: string
          format: binary
          description: mark
        model:
          type: string
          default: gpt-image-2
          description: model
          enum:
            - gpt-image-2
        moderation:
          type: string
          description: Audit intensity
          enum:
            - auto
            - low
          title: 'auto : auto; low : low'
        'n':
          type: integer
          format: int32
          description: 'n'
        outputCompression:
          type: integer
          format: int32
          description: JPEG/WebP compression level 0-100
        outputFormat:
          type: string
          description: Output file format
          enum:
            - png
            - jpeg
            - webp
          title: 'png : png; jpeg : jpeg; webp : webp'
        responseFormat:
          type: string
          default: b64_json
          description: >-
            Response format (compatible with DALL · E; The gpt image series
            always returns b64_json)
          enum:
            - url
            - b64_json
          title: 'url : url; b64_json : b64_json'
        partialImages:
          type: integer
          format: int64
          description: partialImages
        quality:
          type: string
          description: quality
          enum:
            - auto
            - low
            - medium
            - high
            - standard
          title: >-
            auto : auto; low : low; medium : medium; high : high; standard :
            standard
        size:
          type: string
          default: 1024x1024
          description: >-
            image size, ① Single side ≤ 3840 px; ② Both width and height are
            multiples of 16;③ Long side : short side ≤ 3:1; ④ Total pixels ∈
            [655,360, 8,294,400]. Requests that do not meet the constraints or
            are not supported by the channel for custom sizes will be rejected
          enum:
            - auto
            - 1024x1024
            - 1024x1536
            - 1536x1024
            - 2048x2048
            - 2048x1152
            - 3840x2160
            - 2160x3840
        user:
          type: string
          description: user
      required:
        - image
        - model
        - prompt
        - quality

````