## 🚀快速入门
### 🖥️ **环境**
```
OS: Linux, Windows
```
### 📥 **克隆并安装**
我们使用 uv 来管理环境。关于 uv 的安装,请参考 https://docs.astral.sh/uv/getting-started/installation/。
```
git clone https://github.com/HKUDS/ViMax.git
cd ViMax
uv sync
```
### 🎯 **使用**
main_idea2video.py 用于将您的想法转换为视频。
您需要在 configs/idea2video.yaml 文件中配置模型和 API 密钥信息,包括三个部分——聊天模型、图像生成器和视频生成器,如下所示
```
chat_model:
init_args:
model: google/gemini-2.5-flash-lite-preview-09-2025
model_provider: openai
api_key:
base_url: https://openrouter.ai/api/v1
image_generator:
class_path: tools.ImageGeneratorNanobananaGoogleAPI
init_args:
api_key:
video_generator:
class_path: tools.VideoGeneratorVeoGoogleAPI
init_args:
api_key:
working_dir: .working_dir/idea2video
```
然后,在 main_idea2video.py 中提供一个简单而有深度的想法以及相应的创作要求。
```
idea = \
"""
If a cat and a dog are best friends, what would happen when they meet a new cat?
"""
user_requirement = \
"""
For children, do not exceed 3 scenes.
"""
style = "Cartoon"
```
#### 使用 MiniMax 作为 Chat Model 提供商
[MiniMax](https://www.minimaxi.com/) 模型可用作备选的聊天模型提供商。MiniMax 提供与 OpenAI 兼容的 API 访问,支持的模型包括 **MiniMax-M2.7**(1M 上下文窗口)和 **MiniMax-M2.5**(204K 上下文)。
只需在配置中设置 `model_provider: minimax`,base URL 将自动解析:
```
chat_model:
init_args:
model: MiniMax-M2.7
model_provider: minimax
api_key:
```
或者将 API 密钥导出为环境变量,并将 `api_key` 留空:
```
export MINIMAX_API_KEY=
```
有关完整示例,请参阅 `configs/idea2video_minimax.yaml` 和 `configs/script2video_minimax.yaml`。
| 模型 | 上下文 | 备注 |
|---|---|---|
| MiniMax-M2.7 | 1M tokens | 最新版本,推荐使用 |
| MiniMax-M2.7-highspeed | 1M tokens | 快速变体 |
| MiniMax-M2.5 | 204K tokens | 稳定版本 |
| MiniMax-M2.5-highspeed | 204K tokens | 快速变体 |
main_script2video.py 用于根据特定脚本生成视频。
您同样需要在 configs/script2video.yaml 文件中设置 API 配置。然后,在 main_script2video.py 中提供场景脚本和相应的创作要求,如下所示。
```
script = \
"""
EXT. SCHOOL GYM - DAY
A group of students are practicing basketball in the gym. The gym is large and open, with a basketball hoop at one end and a large crowd of spectators at the other end. John (18, male, tall, athletic) is the star player, and he is practicing his dribble and shot. Jane (17, female, short, athletic) is the assistant coach, and she is helping John with his practice. The other students are watching the practice and cheering for John.
John: (dribbling the ball) I'm going to score a basket!
Jane: (smiling) Good job, John!
John: (shooting the ball) Yes!
...
"""
user_requirement = \
"""
Fast-paced with no more than 20 shots.
"""
style = "Animate Style"
```
**🌟 如果这个项目对您有帮助,请给我们点一个 Star!**