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

# Midjourney V7 区域重绘

<Note>
  Midjourney 内置内容审核机制。如果生成的部分图像触发了审核过滤，该次请求已消耗的积分将无法退还，请留意提示词的内容合规性。
</Note>


## OpenAPI

````yaml cn/api-manual/image-series/midjourney/mj-v7-inpaint.json POST /v1/images/generations
openapi: 3.1.0
info:
  title: mj-v7-inpaint 接口
  version: 1.0.0
  description: |-
    - 指定图片中的特定区域进行重新生成，其余部分保持不变
    - 支持两种蒙版方式：多边形坐标 或 黑白蒙版图片
    - 异步处理模式，使用返回的任务ID [进行查询](/cn/api-manual/task-management/get-task-detail)
servers:
  - url: https://api.evolink.ai
security: []
paths:
  /v1/images/generations:
    post:
      summary: Midjourney V7 区域重绘
      operationId: mjV7Inpaint
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MjV7InpaintRequest'
            examples:
              polygon_mask:
                summary: 多边形坐标重绘
                value:
                  model: mj-v7-inpaint
                  prompt: 添加一棵樱花树
                  model_params:
                    task_id: task-unified-xxx
                    image_number: 0
                    mask:
                      areas:
                        - width: 200
                          height: 200
                          points:
                            - 50
                            - 50
                            - 50
                            - 250
                            - 250
                            - 250
                            - 250
                            - 50
              image_mask:
                summary: 蒙版图片重绘
                value:
                  model: mj-v7-inpaint
                  model_params:
                    task_id: task-unified-xxx
                    image_number: 0
                    mask:
                      url: https://example.com/mask.png
      responses:
        '200':
          description: 任务创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationResponse'
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未认证
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: 配额不足
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: 无权限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    MjV7InpaintRequest:
      type: object
      required:
        - model
        - model_params
      properties:
        model:
          type: string
          enum:
            - mj-v7-inpaint
          default: mj-v7-inpaint
          description: 模型名称
        prompt:
          type: string
          description: 描述重绘区域期望生成的内容
          example: 添加一棵樱花树
        model_params:
          type: object
          required:
            - task_id
            - mask
          description: 模型参数
          properties:
            task_id:
              type: string
              description: 源任务 ID
              example: task-unified-xxx
            image_number:
              type: integer
              enum:
                - 0
                - 1
                - 2
                - 3
              default: 0
              description: 选择第几张图（0-3）
            mask:
              type: object
              description: 重绘区域定义，支持两种方式
              oneOf:
                - type: object
                  description: 多边形坐标方式
                  required:
                    - areas
                  properties:
                    areas:
                      type: array
                      description: 多边形坐标方式，支持多个重绘区域
                      items:
                        type: object
                        properties:
                          width:
                            type: integer
                            description: 多边形包围盒宽度
                          height:
                            type: integer
                            description: 多边形包围盒高度
                          points:
                            type: array
                            items:
                              type: integer
                            description: 扁平化坐标对 [x1,y1,x2,y2,...] 形成闭合多边形
                - type: object
                  description: 黑白蒙版图片URL，白色区域=重绘区域，黑色区域=保留区域
                  required:
                    - url
                  properties:
                    url:
                      type: string
                      format: uri
                      description: 黑白蒙版图片URL，白色区域=重绘区域，黑色区域=保留区域
            speed:
              type: string
              enum:
                - fast
                - turbo
              default: fast
              description: |-
                速度模式（仅当传入 prompt 时生效）

                **费用说明：** turbo 模式费用更高
        callback_url:
          type: string
          format: uri
          description: 任务完成后的回调地址
    ImageGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          description: 任务创建时间戳
          example: 1757165031
        id:
          type: string
          description: 任务ID
          example: task-unified-1757165031-mjv7
        model:
          type: string
          description: 实际使用的模型名称
        object:
          type: string
          enum:
            - image.generation.task
          description: 任务的具体类型
        progress:
          type: integer
          description: 任务进度百分比 (0-100)
          minimum: 0
          maximum: 100
          example: 0
        status:
          type: string
          description: 任务状态
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        task_info:
          $ref: '#/components/schemas/TaskInfo'
        type:
          type: string
          enum:
            - text
            - image
            - audio
            - video
          example: image
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            type:
              type: string
    TaskInfo:
      type: object
      properties:
        can_cancel:
          type: boolean
          description: 任务是否可以取消
          example: true
        estimated_time:
          type: integer
          description: 预估完成时间（秒）
          minimum: 0
          example: 45
    Usage:
      type: object
      properties:
        billing_rule:
          type: string
          enum:
            - per_call
            - per_token
            - per_second
          example: per_call
        credits_reserved:
          type: number
          description: 预估消耗积分数
          minimum: 0
          example: 1.8
        user_group:
          type: string
          example: default
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##所有接口均需要使用Bearer Token进行认证##

        **获取 API Key ：**

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取您的 API Key

        **使用时在请求头中添加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````