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

# MAGI-2 文生视频

> Sand AI MAGI-2 文生视频支持最长 8000 字提示词，单次生成 4-30 秒 1080p、25 fps 原生有声视频，提供六种画幅选择。

> [!NOTE]
>
> MAGI-2 输出原生 1080p、25 fps 音画同步视频（实际成片比 `duration` 长约 0.24 秒），出片耗时约 **13–20 分钟**。建议配置 `callback_url` 回调或轮询 `GET /v1/videos/status/{task_id}`。按请求的 `duration` 统一按秒计费，画幅与音频开关不影响单价。


## OpenAPI

````yaml api-reference/openapi/magi-2--magi-2-t2v.zh.yaml POST /v1/videos/generations
openapi: 3.1.0
info:
  title: MAGI-2 文生视频 API
  version: 1.0.0
  description: >-
    Sand AI MAGI-2 文生视频支持最长 8000 字提示词，单次生成 4-30 秒 1080p、25 fps 原生有声视频，提供六种画幅选择。在
    APIPod 中，公开模型 ID 为 magi-2-t2v，通过异步视频任务返回结果。
servers:
  - url: https://api.apipod.ai
    description: 生产环境
security: []
paths:
  /v1/videos/generations:
    post:
      tags:
        - MAGI-2 文生视频
      summary: 创建视频生成任务
      description: >-
        Sand AI MAGI-2 文生视频支持最长 8000 字提示词，单次生成 4-30 秒 1080p、25 fps 原生有声视频。公开模型
        ID 为 magi-2-t2v。
      operationId: create-magi-2-magi-2-t2v
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              title: MAGI-2 文生视频
              properties:
                model:
                  type: string
                  title: 模型 ID
                  description: APIPod 公开模型 ID。
                  const: magi-2-t2v
                prompt:
                  type: string
                  title: 提示词
                  description: 必填，描述希望生成的视频画面与声音，最多 8000 个字符。
                  minLength: 1
                  maxLength: 8000
                duration:
                  type: integer
                  title: 时长（秒）
                  description: 输出视频秒数，取值 4-30，默认 5。
                  minimum: 4
                  maximum: 30
                  default: 5
                resolution:
                  type: string
                  title: 分辨率
                  description: 输出分辨率，MAGI-2 仅支持 1080p（25 fps）。
                  enum:
                    - 1080p
                  default: 1080p
                aspect_ratio:
                  type: string
                  title: 画幅
                  description: 输出视频宽高比。
                  enum:
                    - '21:9'
                    - '16:9'
                    - '4:3'
                    - '1:1'
                    - '3:4'
                    - '9:16'
                  default: '16:9'
                generate_audio:
                  type: boolean
                  title: 生成音频
                  description: 是否随视频同步生成原生音频，默认 true。
                  default: true
                callback_url:
                  type: string
                  title: 回调地址
                  description: 可选，任务终态 Webhook 回调地址。
              required:
                - model
                - prompt
            example:
              model: magi-2-t2v
              prompt: 黄昏时分，一只纸船漂过雨水浸湿的城市街道，慢速跟拍，水洼反射霓虹灯光，伴随着轻柔的雨声
              duration: 5
              resolution: 1080p
              aspect_ratio: '16:9'
              generate_audio: true
      responses:
        '200':
          description: 任务已受理
          content:
            application/json:
              schema:
                type: object
                title: 任务提交响应
                properties:
                  code:
                    type: integer
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                        description: 生成任务 ID
                  message:
                    type: string
                required:
                  - code
                  - message
                  - data
              example:
                code: 200
                message: success
                data:
                  task_id: vid_task_01JEXAMPLE
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          label: cURL
          source: |-
            curl https://api.apipod.ai/v1/videos/generations \
              -H "Authorization: Bearer $APIPOD_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
              "model": "magi-2-t2v",
              "prompt": "黄昏时分，一只纸船漂过雨水浸湿的城市街道，慢速跟拍",
              "duration": 5,
              "resolution": "1080p",
              "aspect_ratio": "16:9",
              "generate_audio": true
            }'
        - lang: Python
          label: Python
          source: |-
            import os import requests
            response = requests.post(
                "https://api.apipod.ai/v1/videos/generations",
                headers={
                    "Authorization": f"Bearer {os.environ['APIPOD_API_KEY']}",
                    "Content-Type": "application/json",
                },
                json={
                    "model": "magi-2-t2v",
                    "prompt": "黄昏时分，一只纸船漂过雨水浸湿的城市街道，慢速跟拍",
                    "duration": 5,
                    "resolution": "1080p",
                    "aspect_ratio": "16:9",
                    "generate_audio": True,
                },
                timeout=60,
            ) response.raise_for_status() print(response.json())
        - lang: JavaScript
          label: Node.js
          source: >-
            const response = await
            fetch("https://api.apipod.ai/v1/videos/generations", {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.APIPOD_API_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                model: "magi-2-t2v",
                prompt: "黄昏时分，一只纸船漂过雨水浸湿的城市街道，慢速跟拍",
                duration: 5,
                resolution: "1080p",
                aspect_ratio: "16:9",
                generate_audio: true,
              }),
            });

            if (!response.ok) {
              throw new Error(`APIPod request failed: ${response.status} ${await response.text()}`);
            }

            console.log(await response.json());
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: APIPod API key
      description: 在 Authorization 请求头中以 Bearer Token 形式携带您的 APIPod API Key。

````

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