Skip to main content
Glama

generate_video

Generate videos from text prompts using Sora AI, saving them to a specified .mp4 path with options for portrait or landscape orientation and model selection.

Instructions

使用 Sora 模型生成视频并保存到指定路径(异步任务模式)。

通过 api.tu-zi.com 官方格式接口调用 Sora 视频生成模型。 采用任务提交 → 轮询状态 → 下载视频的异步流程。

⚠️ 重要提示:

  • 视频生成时间较长,通常需要 2-10 分钟,请耐心等待

  • 建议提示词详细且具体,包含场景、动作、风格等元素

  • 支持中文和英文提示词

  • 采用异步轮询机制,每 10 秒检查一次任务状态

Args: prompt: 视频生成提示词,描述越详细越好 output_path: 输出视频文件路径(.mp4) orientation: 视频方向,'portrait'(竖屏)或 'landscape'(横屏) model: Sora 模型名称,默认 'sora-2'(最新版本) ctx: MCP 上下文,用于日志记录

Returns: 包含生成结果的字典: - status: "ok" 或 "error" - output_path: 保存的视频文件路径(绝对路径) - file_size_bytes: 文件大小(字节) - prompt: 使用的提示词 - orientation: 视频方向 - model: 使用的模型名称 - task_id: 任务 ID - video_url: 视频下载 URL - size: 视频尺寸规格(如 "small") - seconds: 视频时长(秒) - created_at: 创建时间戳 - message: 错误信息(失败时)

Examples: >>> # 生成竖屏视频(使用默认 sora-2 模型) >>> result = await generate_video( ... prompt="一只可爱的橘猫在阳光下缓慢行走", ... output_path="videos/cat_walking.mp4" ... )

>>> # 生成横屏视频(使用默认 sora-2)
>>> result = await generate_video(
...     prompt="科幻城市夜景,霓虹灯闪烁,赛博朋克风格",
...     output_path="videos/cyberpunk_city.mp4",
...     orientation="landscape"
... )

>>> # 使用 sora-2-pro 模型生成高质量视频
>>> result = await generate_video(
...     prompt="电影级别的森林晨雾场景,阳光穿透树叶,细腻光影变化",
...     output_path="videos/forest_cinematic.mp4",
...     model="sora-2-pro",
...     orientation="landscape"
... )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNo【可选】Sora 模型名称,默认 'sora-2'(标准版本)。可选值:• 'sora-2':标准版本,平衡质量与速度,推荐日常使用;• 'sora-2-pro':专业版本,质量最高,细节最丰富,但生成时间较长。建议:大多数情况使用默认的 'sora-2';追求极致质量和细节选择 'sora-2-pro'。示例:model='sora-2-pro' 用于高质量商业视频、电影级别制作sora-2
promptYes【必填】视频生成提示词。使用自然语言详细描述您想要生成的视频内容。描述越详细越好,建议包含:场景、动作、光线、氛围、镜头运动等元素。支持中文和英文提示词。示例:'一只可爱的橘猫在阳光洒满的木地板上缓慢行走,镜头跟随,温暖色调'、'科幻城市夜景,霓虹灯闪烁,飞行汽车穿梭其间,赛博朋克风格,镜头缓慢上升'、'海浪拍打着沙滩,夕阳西下,金色的光线洒在水面上,平静祥和的氛围'、'一杯咖啡冒着热气,特写镜头,背景虚化,温馨的咖啡馆环境'。
orientationNo【可选】视频方向,默认 'portrait'(竖屏)。可选值:'portrait'(竖屏,9:16)、'landscape'(横屏,16:9)。示例:orientation='landscape' 适合宽屏内容、横版视频portrait
output_pathYes【必填】输出视频文件保存路径。支持绝对路径和相对路径。文件扩展名应为 .mp4。目录会自动创建,无需手动创建父目录。示例:'/Users/username/videos/output.mp4'、'output/video.mp4'、'~/Desktop/video.mp4'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Install Server

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description clearly discloses the async behavior, expected duration (2-10 minutes), polling interval (10 seconds), and the fact that the directory is auto-created. Since no annotations are provided, the description carries the behavioral disclosure burden and does so well.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with headers, warnings, Args, Returns, and Examples. It is somewhat long but each section earns its place, and the critical warning is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is complete for an async video-generation tool: it covers the workflow, time expectations, parameter semantics, return values, and examples. With no annotations or sibling tools, it fully compensates for missing context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema already has 100% coverage with detailed descriptions. The description's Args section is largely redundant with the schema. However, it adds context about prompt detail level and async behavior that complements the schema. Baseline 3 is appropriate since schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states the verb (generate), resource (video using Sora model), and delivery mechanism (save to specified path via async task). It clearly distinguishes the tool's purpose and is not tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when and how to use the tool, including the async flow, polling mechanism, timing expectations, and prompt-quality guidance. It does not explicitly describe when not to use it or name alternatives (there are no sibling tools), but it provides sufficient usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/airsulG/sora-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server