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

# 图像操作

> 对已有任务里的图继续加工：放大、变化、重塑、重跑、扩图、平移、局部重绘、增强、做视频、延长视频。

| `action` | 能做什么 |
| - | - |
| `upscale` | 把一组图里的某一张放大到 2 倍分辨率，可选细微或创意两种风格。 |
| `variation` | 以一张图为基础生成四张变体，可选强烈或细微。 |
| `remix` | 用新的提示词重塑一张图，保留原图的结构。 |
| `reroll` | 用同一个提示词重新生成整组图，也可以改提示词再跑。 |
| `zoom` | 把一张图向外扩展，补出画面四周的内容。 |
| `pan` | 把一张图朝一个方向延展。 |
| `inpaint` | 只重画一张图里的指定区域。 |
| `enhance` | 从草图里挑一张，按完整质量重新生成。 |
| `video` | 把一张图变成 5 秒视频，可选 480p / 720p、运动幅度和视频数量。 |
| `video-extend` | 把一段视频再延长 4 秒，最多延长到 21 秒。 |

提交后返回新的任务 ID，查询方式与生成相同。新任务完成后也有自己的 `actions`，可以一直接下去。`actions` 里没有的操作会返回 `unsupported_action`。

> [!TIP]
>
> 也可以用统一任务接口 `POST /v1/task/submit` 提交：`model` 填 `midjourney-upscale`，参数放进 `input`，不用传 `action`。两种写法效果与计费完全一样。


## OpenAPI

````yaml cn/openapi/midjourney.json POST /midjourney/action
openapi: 3.1.0
info:
  title: Midjourney API
  version: 1.0.0
  description: Midjourney 接口
servers:
  - url: https://api.ephone.ai
security:
  - bearerAuth: []
paths:
  /midjourney/action:
    post:
      summary: 图像操作
      description: >-
        对已有任务里的图继续加工：放大、变化、重塑、重跑、扩图、平移、局部重绘、增强、做视频、延长视频。`action` 的取值就是查询结果
        `actions` 里列的那些，在下方「Body」里切换标签页，查看每种的参数。
      operationId: midjourney_action
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - upscale
                      default: upscale
                      description: 固定填 `upscale`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: >-
                        **图片序号**：选第几张图，从 1 开始（四宫格是 1–4，V8 草图最多 24
                        张）。父任务只有一张图时可以不传。
                    type:
                      type: string
                      enum:
                        - subtle
                        - creative
                      default: subtle
                      description: '**放大方式**：subtle 细微（默认）/ creative 创意。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                  title: upscale · 放大
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - variation
                      default: variation
                      description: 固定填 `variation`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: >-
                        **图片序号**：选第几张图，从 1 开始（四宫格是 1–4，V8 草图最多 24
                        张）。父任务只有一张图时可以不传。
                    strength:
                      type: string
                      enum:
                        - strong
                        - subtle
                      default: strong
                      description: '**变化强度**：strong 强烈（默认）/ subtle 细微。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                  title: variation · 变化
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - remix
                      default: remix
                      description: 固定填 `remix`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: >-
                        **图片序号**：选第几张图，从 1 开始（四宫格是 1–4，V8 草图最多 24
                        张）。父任务只有一张图时可以不传。
                    prompt:
                      type: string
                      maxLength: 6000
                      description: '**提示词**：新的提示词，必填。'
                    strength:
                      type: string
                      enum:
                        - strong
                        - subtle
                      default: strong
                      description: '**变化强度**：strong 强烈（默认）/ subtle 细微。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                    - prompt
                  title: remix · 重塑
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - reroll
                      default: reroll
                      description: 固定填 `reroll`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    prompt:
                      type: string
                      maxLength: 6000
                      description: '**提示词**：可选：改写后的提示词，不传沿用原提示词。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                  title: reroll · 重跑
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - zoom
                      default: zoom
                      description: 固定填 `zoom`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: >-
                        **图片序号**：选第几张图，从 1 开始（四宫格是 1–4，V8 草图最多 24
                        张）。父任务只有一张图时可以不传。
                    zoom:
                      type: number
                      default: 2
                      minimum: 1
                      maximum: 2
                      description: '**缩小倍数**：1.0 到 2.0，默认 2.0。'
                    prompt:
                      type: string
                      maxLength: 6000
                      description: '**提示词**：可选：描述扩出的部分，可带 --ar。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                  title: zoom · 扩图
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - pan
                      default: pan
                      description: 固定填 `pan`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: >-
                        **图片序号**：选第几张图，从 1 开始（四宫格是 1–4，V8 草图最多 24
                        张）。父任务只有一张图时可以不传。
                    direction:
                      type: string
                      enum:
                        - up
                        - down
                        - left
                        - right
                      description: '**方向**：up 上 / down 下 / left 左 / right 右。'
                    prompt:
                      type: string
                      maxLength: 6000
                      description: '**提示词**：可选：描述延展出的部分。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                    - direction
                  title: pan · 平移
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - inpaint
                      default: inpaint
                      description: 固定填 `inpaint`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: >-
                        **图片序号**：选第几张图，从 1 开始（四宫格是 1–4，V8 草图最多 24
                        张）。父任务只有一张图时可以不传。
                    mask:
                      type: string
                      description: >-
                        **遮罩**：白色 = 重画、黑色 = 保持。图片 URL（公网可访问）或 base64 data
                        URI，单张不超过 20 MB。
                    prompt:
                      type: string
                      maxLength: 6000
                      description: '**提示词**：可选：这块区域要画成什么。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                    - mask
                  title: inpaint · 局部重绘
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - enhance
                      default: enhance
                      description: 固定填 `enhance`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: '**图片序号**：选第几张草图，从 1 开始（一组四张是 1–4，草图批次最多 24）。'
                    speed:
                      type: string
                      enum:
                        - relax
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：慢速（relax）价格最低、排队较久；极速（turbo）最快、2 倍价格。也可以在提示词里写
                        --relax / --fast / --turbo，请求参数优先；都不写为快速。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                    - index
                  title: enhance · 增强
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - video
                      default: video
                      description: 固定填 `video`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: >-
                        **图片序号**：选第几张图，从 1 开始（四宫格是 1–4，V8 草图最多 24
                        张）。父任务只有一张图时可以不传。
                    prompt:
                      type: string
                      maxLength: 6000
                      description: '**提示词**：可选：描述画面怎么动。不写时自动按画面生成运动。'
                    resolution:
                      type: string
                      enum:
                        - 480p
                        - 720p
                      default: 480p
                      description: '**分辨率**：480p（默认）或 720p（3.2 倍价格）。'
                    motion:
                      type: string
                      enum:
                        - low
                        - high
                      default: low
                      description: '**运动幅度**：low 低运动（默认，适合静态场景）/ high 高运动（大幅镜头运动）。'
                    batch_size:
                      type: integer
                      enum:
                        - 1
                        - 2
                        - 4
                      default: 1
                      description: '**视频数量**：一次生成几个视频：1（默认）、2 或 4，价格按数量计。'
                    end_image:
                      type: string
                      description: >-
                        **尾帧**：可选：视频最后一帧的图。图片 URL（公网可访问）或 base64 data URI，单张不超过
                        20 MB。
                    loop:
                      type: boolean
                      default: false
                      description: '**循环**：生成首尾相同的循环视频，不能和尾帧同时用。'
                    speed:
                      type: string
                      enum:
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：视频只支持快速（fast）与极速（turbo）。也可以在提示词里写 --fast /
                        --turbo，请求参数优先。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                  title: video · 做视频
                - type: object
                  properties:
                    action:
                      type: string
                      enum:
                        - video-extend
                      default: video-extend
                      description: 固定填 `video-extend`。
                    task_id:
                      type: string
                      description: '**任务 ID**：要继续加工的任务（提交时返回的 task_id），必须是已成功的任务。'
                    index:
                      type: integer
                      minimum: 1
                      maximum: 24
                      description: '**图片序号**：选第几个视频，从 1 开始。原任务只有一个视频时可以不传。'
                    prompt:
                      type: string
                      maxLength: 6000
                      description: '**提示词**：可选：描述接下来的动作。'
                    motion:
                      type: string
                      enum:
                        - low
                        - high
                      default: low
                      description: '**运动幅度**：low 低运动（默认，适合静态场景）/ high 高运动（大幅镜头运动）。'
                    speed:
                      type: string
                      enum:
                        - fast
                        - turbo
                      default: fast
                      description: >-
                        **速度**：视频只支持快速（fast）与极速（turbo）。也可以在提示词里写 --fast /
                        --turbo，请求参数优先。
                    notify_hook:
                      type: string
                      format: uri
                      description: >-
                        **推送地址**：任务结束后，把和查询结果相同的内容 POST 到这个地址（公网可以访问的 http /
                        https 地址）。不传就自己查询。
                  required:
                    - action
                    - task_id
                  title: video-extend · 延长视频
            examples:
              upscale:
                summary: upscale · 放大
                value:
                  action: upscale
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 2
                  type: subtle
              variation:
                summary: variation · 变化
                value:
                  action: variation
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 1
                  strength: strong
              remix:
                summary: remix · 重塑
                value:
                  action: remix
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 3
                  prompt: a paper boat on a calm lake --ar 1:1 --v 7
              reroll:
                summary: reroll · 重跑
                value:
                  action: reroll
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
              zoom:
                summary: zoom · 扩图
                value:
                  action: zoom
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 1
                  zoom: 1.5
              pan:
                summary: pan · 平移
                value:
                  action: pan
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 1
                  direction: right
              inpaint:
                summary: inpaint · 局部重绘
                value:
                  action: inpaint
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 1
                  mask: data:image/png;base64,iVBORw0...
                  prompt: a red sailboat
              enhance:
                summary: enhance · 增强
                value:
                  action: enhance
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 2
              video:
                summary: video · 做视频
                value:
                  action: video
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 1
                  motion: low
                  batch_size: 1
              video-extend:
                summary: video-extend · 延长视频
                value:
                  action: video-extend
                  task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                  index: 1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
              example:
                task_id: mj-7a2d3c1f0b9e4d8a8c6b5a4f3e2d1c0b
                action: upscale
                status: submitted
                created_at: 1792000000
        '400':
          description: invalid_request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: invalid_request
                  message: index must be between 1 and 4
        '401':
          description: unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: unauthorized
                  message: Invalid API key
        '402':
          description: insufficient_quota
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: insufficient_quota
                  message: Insufficient balance
        '404':
          description: task_not_found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: task_not_found
                  message: Task not found
        '409':
          description: task_not_finished
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: task_not_finished
                  message: The task has not succeeded yet
        '429':
          description: queue_full
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: queue_full
                  message: Queue is full, please try again later
        '500':
          description: upstream_error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: upstream_error
                  message: The service is temporarily unavailable, please retry
components:
  schemas:
    SubmitResponse:
      type: object
      properties:
        task_id:
          type: string
          description: 任务 ID。
        action:
          type: string
          description: 动作名，例如 `imagine`、`upscale`。
        status:
          type: string
          description: 任务状态，取值见上表。
          enum:
            - submitted
            - in_progress
            - success
            - failure
        created_at:
          type: integer
          description: 创建时间（Unix 秒）。
      required:
        - task_id
        - action
        - status
        - created_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: '在请求头 `Authorization: Bearer YOUR_API_KEY` 里带上 API Key。'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.