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

# 创建视频任务

> 创建任务后立即返回任务对象，上游提交由平台侧异步完成，客户端通过查询接口获取进度与结果。

**路径：** `POST https://api.omniall.ai/v1/videos`

素材字段既可直接传入公开可访问的 URL，也可随创建请求以 `multipart/form-data` 上传文件。

鉴权：`Authorization: Bearer sk-...`



## OpenAPI

````yaml zh-CN/openapi/magi-video.yaml POST /v1/videos
openapi: 3.1.0
info:
  title: Omniall AI — MAGI-2 视频
  version: 1.0.0
  description: |-
    通过 OpenAI 兼容视频接口创建、查询并下载视频任务，支持文生视频、图生视频与多模态参考。

    **模型：** `magi-2`（以[模型广场](https://omniall.ai/pricing)为准）

    **鉴权方式：** `Authorization: Bearer sk-...`
servers:
  - url: https://api.omniall.ai
security: []
paths:
  /v1/videos:
    post:
      tags:
        - MAGI-2 视频
      summary: 创建视频任务
      description: |-
        创建任务后立即返回任务对象，上游提交由平台侧异步完成，客户端通过查询接口获取进度与结果。

        **路径：** `POST https://api.omniall.ai/v1/videos`

        素材字段既可直接传入公开可访问的 URL，也可随创建请求以 `multipart/form-data` 上传文件。

        鉴权：`Authorization: Bearer sk-...`
      operationId: magiCreateVideo
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
            example: Bearer sk-...
          description: 鉴权头，例如 `Bearer sk-...`。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - prompt
              description: MAGI-2 视频创建请求（`POST /v1/videos`）。
              properties:
                model:
                  type: string
                  description: 模型名称。示例中的 model 即当前模型的真实名称，可直接用于调用：`magi-2`。
                  example: magi-2
                prompt:
                  type: string
                  description: 文本提示词，支持中英文。
                  example: 以参考图为场景，镜头缓缓向前推进
                  minLength: 1
                  maxLength: 20000
                mode:
                  type: string
                  description: 不传则自动推断。
                  enum:
                    - i2v
                    - r2v
                    - t2v
                  example: t2v
                resolution:
                  type: string
                  description: 无法识别时默认 `1080p`。
                  enum:
                    - 1080p
                  default: 1080p
                  example: 1080p
                aspect_ratio:
                  type: string
                  description: 也可由 `size` 推断。
                  enum:
                    - '21:9'
                    - '16:9'
                    - '4:3'
                    - '1:1'
                    - '3:4'
                    - '9:16'
                  default: '16:9'
                  example: '16:9'
                size:
                  type: string
                  description: 可选；用于推断 `aspect_ratio`。
                duration:
                  type: integer
                  description: 也支持字段名 `seconds`。范围 4–30 秒。
                  minimum: 4
                  maximum: 30
                  default: 5
                  example: 5
                seconds:
                  description: '`duration` 的别名。建议传字符串（如 `"5"`）；网关也接受数字。范围 4–30。'
                  oneOf:
                    - type: string
                      pattern: ^(?:[4-9]|[12][0-9]|30)$
                      example: '5'
                    - type: integer
                      minimum: 4
                      maximum: 30
                      example: 5
                audio:
                  type: boolean
                  description: 输出是否包含音轨。
                  default: true
                  example: true
                reference_images:
                  type: array
                  maxItems: 10
                  items:
                    type: string
                  description: 参考图列表，最多 10 张。
                reference_videos:
                  type: array
                  maxItems: 5
                  items:
                    type: string
                  description: 参考视频，最多 5 段，总时长不超过 15 秒。
                reference_audios:
                  type: array
                  maxItems: 5
                  items:
                    type: string
                  description: 参考音频，最多 5 段。
            examples:
              文生视频:
                summary: 文生视频
                value:
                  model: magi-2
                  prompt: 以参考图为场景，镜头缓缓向前推进
                  duration: 5
                  resolution: 1080p
                  aspect_ratio: '16:9'
                  audio: true
              图生视频:
                summary: 图生视频
                value:
                  model: magi-2
                  prompt: 以参考图为场景，镜头缓缓向前推进
                  duration: 5
                  resolution: 1080p
                  aspect_ratio: '16:9'
                  reference_images:
                    - https://cdn.example.com/ref.png
              多模态参考:
                summary: 多模态参考
                value:
                  model: magi-2
                  prompt: 保持角色与场景氛围，镜头轻缓推进
                  duration: 5
                  resolution: 1080p
                  aspect_ratio: '16:9'
                  reference_images:
                    - https://cdn.example.com/a.png
                  reference_videos:
                    - https://cdn.example.com/clip.mp4
                  reference_audios:
                    - https://cdn.example.com/sfx.mp3
      responses:
        '200':
          description: 返回任务对象，含 id、status、progress 等字段。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 任务 ID
                  object:
                    type: string
                    example: video
                  model:
                    type: string
                  status:
                    type: string
                    description: 如 `queued` / `in_progress` / `completed` / `failed`
                  progress:
                    type: integer
                  created_at:
                    type: integer
                  seconds:
                    type: string
              example:
                id: task_abc123
                object: video
                model: magi-2
                status: queued
                progress: 0
                created_at: 1710000000
                seconds: '5'
        '202':
          description: 返回任务对象，含 id、status、progress 等字段（已受理）。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                  model:
                    type: string
                  status:
                    type: string
                  progress:
                    type: integer
                  created_at:
                    type: integer
              example:
                id: task_abc123
                object: video
                model: magi-2
                status: queued
                progress: 0
                created_at: 1710000000
        '400':
          description: 请求无效
        '401':
          description: 未授权

````

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