> ## 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.

# 图生视频

> 把一张图变成 5 秒视频，可选 480p / 720p、运动幅度和视频数量。

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

提交后返回任务 ID，用 [查询结果](https://docs.rixapi.com/docs/cn/api-reference/midjourney/task.md) 取图，或者提交时带上 `notify_hook` 等推送。完成后结果里的 `actions` 列出还能接着做的加工，调 [图像操作](https://docs.rixapi.com/docs/cn/api-reference/midjourney/action.md) 继续。

这个接口用你自己的图做首帧。要用某个任务里的图做视频、或者延长视频，调 [图像操作](https://docs.rixapi.com/docs/cn/api-reference/midjourney/action.md)，`action` 填 `video` 或 `video-extend`。


## OpenAPI

````yaml cn/openapi/midjourney.json POST /midjourney/video
openapi: 3.1.0
info:
  title: Midjourney API
  version: 1.0.0
  description: Midjourney 接口
servers:
  - url: https://api.ephone.ai
security:
  - bearerAuth: []
paths:
  /midjourney/video:
    post:
      summary: 图生视频
      description: 把一张图变成 5 秒视频，可选 480p / 720p、运动幅度和视频数量。
      operationId: midjourney_video
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                image:
                  type: string
                  description: '**首帧**：图片 URL（公网可访问）或 base64 data URI，单张不超过 20 MB。'
                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:
                - image
            example:
              image: https://example.com/first-frame.png
              motion: low
              batch_size: 1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
              example:
                task_id: mj-6f1c2b0e9a7d4e2fb1c3d5e7f9a1b2c3
                action: video
                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
        '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.