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

# 编辑图像

> OpenAI 兼容的图片编辑接口。支持 JSON 请求，也支持 `multipart/form-data` 上传图片文件。



## OpenAPI

````yaml /openapi/relay.json post /v1/images/edits
openapi: 3.0.1
info:
  title: AIOHub API
  description: AIOHub 公开 API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security:
  - BearerAuth: []
tags:
  - name: 获取模型列表
  - name: OpenAI Chat
  - name: OpenAI Responses
  - name: 图片生成
  - name: OpenAI 图像
  - name: 视频生成
  - name: Claude Messages
  - name: Gemini API
  - name: OpenAI Embeddings
  - name: 文本补全
  - name: OpenAI 音频
  - name: Realtime API
paths:
  /v1/images/edits:
    post:
      tags:
        - OpenAI 图像
      summary: 编辑图像
      description: OpenAI 兼容的图片编辑接口。支持 JSON 请求，也支持 `multipart/form-data` 上传图片文件。
      operationId: editImage
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageEditRequest'
            example:
              model: gpt-image-2
              image: https://example.com/source.png
              prompt: Keep the composition and change the mug color to matte black
              size: 1024x1024
              'n': 1
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ImageEditRequest'
      responses:
        '200':
          description: 成功生成图像
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    ImageEditRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          example: gpt-image-2
        image:
          type: string
          description: 待编辑图片。JSON 请求可传 URL/Base64；`multipart/form-data` 请求可上传文件。
        mask:
          type: string
          format: binary
        prompt:
          type: string
        quality:
          type: string
        'n':
          type: integer
        size:
          type: string
        response_format:
          type: string
        stream:
          type: boolean
        background:
          description: 背景设置，取决于所选模型是否支持。
        output_format:
          description: 输出格式，取决于所选模型是否支持。
        partial_images:
          description: 部分图片返回设置，取决于所选模型是否支持。
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
        data:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
              b64_json:
                type: string
              revised_prompt:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````