ViMax Production Deployment: Required Environment Variables and Configuration Settings
To deploy ViMax in production, you must configure API credentials for chat, image, and video generation services in YAML configuration files, export MINIMAX_API_KEY when using the MiniMax provider, and define rate limits and working directories for stable multi-agent orchestration.
ViMax is a multi-agent video generation framework developed by HKUDS that orchestrates external LLM, image generation, and video generation services. Proper configuration of environmental variables and YAML settings ensures secure credential management and reliable operation in production environments.
Core Configuration Components
ViMax requires three primary service configurations defined in configs/idea2video.yaml or configs/script2video.yaml:
- Chat model: Requires
model_provider(e.g.,openaiorminimax),model,api_key, andbase_urlunderchat_model.init_args - Image generator: Requires
api_keyunderimage_generator.init_args(class path such astools.ImageGeneratorNanobananaGoogleAPI) - Video generator: Requires
api_keyundervideo_generator.init_args(class path such astools.VideoGeneratorVeoGoogleAPI)
Additionally, you must specify a working_dir path for temporary assets and final output storage.
Environment Variable Integration
ViMax supports environment-based credential injection specifically for the MiniMax provider. In utils/provider_presets.py, the preset defines:
PROVIDER_PRESETS["minimax"]["env_key"] = "MINIMAX_API_KEY"
When model_provider: minimax is configured, the resolve_chat_model_config function (lines 35–88 in utils/provider_presets.py) automatically reads MINIMAX_API_KEY from the environment if api_key is omitted in the YAML file.
Export the variable before starting the service:
export MINIMAX_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
Production YAML Configuration Structure
A production-ready configuration file (e.g., configs/idea2video.yaml) contains structured initialization arguments for each service component.
Chat Model Settings
The chat model configuration specifies the LLM backend and authentication:
chat_model:
init_args:
model: google/gemini-2.5-flash-lite-preview-09-2025
model_provider: openai
api_key: <YOUR_API_KEY>
base_url: https://openrouter.ai/api/v1
max_requests_per_minute: 500
max_requests_per_day: 2000
Replace <YOUR_API_KEY> with your actual API credentials or leave empty for MiniMax environment variable resolution.
Image and Video Generator Settings
Configure media generation tools with class paths and authentication:
image_generator:
class_path: tools.ImageGeneratorNanobananaGoogleAPI
init_args:
api_key: <YOUR_API_KEY>
max_requests_per_minute: 10
max_requests_per_day: 500
video_generator:
class_path: tools.VideoGeneratorVeoGoogleAPI
init_args:
api_key: <YOUR_API_KEY>
max_requests_per_minute: 2
max_requests_per_day: 10
Rate Limiting and Working Directory
Control external API usage and define asset storage:
working_dir: .working_dir/idea2video
Set max_requests_per_minute and max_requests_per_day to match your external provider quotas, or use null to disable throttling.
MiniMax Provider Configuration
When deploying with MiniMax, the resolve_chat_model_config function transforms the configuration automatically:
- Sets
model_providerto"openai"for LangChain compatibility - Injects
base_url: https://api.minimax.io/v1 - Pulls
MINIMAX_API_KEYfrom the environment ifapi_keyis empty - Applies default model
MiniMax-M2.7and clamps temperature values
Example MiniMax configuration:
chat_model:
init_args:
model: MiniMax-M2.7
model_provider: minimax
api_key: # Omitted; uses MINIMAX_API_KEY environment variable
Runtime Configuration Examples
Loading and Overriding Configuration in Python
Override API keys programmatically when integrating with secret managers:
import yaml
import os
from utils.provider_presets import resolve_chat_model_config
with open("configs/idea2video.yaml") as f:
cfg = yaml.safe_load(f)
# Override from environment or secret manager
cfg["chat_model"]["init_args"]["api_key"] = os.getenv("OPENAI_API_KEY")
chat_args = resolve_chat_model_config(cfg["chat_model"]["init_args"])
Starting the Production Pipeline
Execute the pipeline with your configured YAML:
uv run python main_idea2video.py
The pipeline loader in pipelines/idea2video_pipeline.py validates the configuration and initializes the backend via tools/render_backend.py.
Summary
- Configuration files: Edit
configs/idea2video.yamlorconfigs/script2video.yamlto define chat, image, and video service credentials - MiniMax deployment: Export
MINIMAX_API_KEYenvironment variable instead of hardcoding credentials in YAML files - Rate limiting: Set
max_requests_per_minuteandmax_requests_per_dayto prevent quota exhaustion - Working directory: Specify a persistent
working_dirpath for intermediate assets and final outputs - Environment resolution: The
resolve_chat_model_configfunction inutils/provider_presets.pyhandles MiniMax-specific transformations and credential injection
Frequently Asked Questions
What environment variables does ViMax require?
ViMax strictly requires the MINIMAX_API_KEY environment variable only when using the MiniMax chat model provider without hardcoding the API key in the YAML configuration. All other service credentials (OpenAI, Google, etc.) must be configured directly in the configs/idea2video.yaml file via the api_key fields.
How does ViMax handle MiniMax API authentication?
When model_provider: minimax is set in the configuration, the resolve_chat_model_config function in utils/provider_presets.py automatically reads the MINIMAX_API_KEY environment variable if the api_key field is empty. It also injects the correct base URL (https://api.minimax.io/v1) and converts the provider type to "openai" for LangChain compatibility.
Where do I configure rate limits for external APIs?
Rate limits are configured in the YAML configuration files (configs/idea2video.yaml or configs/script2video.yaml) under each service section. Use the keys max_requests_per_minute and max_requests_per_day at the same level as init_args for the chat model, image generator, and video generator components.
Can I override configuration settings programmatically?
Yes. You can load the YAML configuration using Python's yaml module, modify the dictionary values (such as injecting API keys from a secret manager), and then pass the modified configuration to resolve_chat_model_config before initializing the pipeline in pipelines/idea2video_pipeline.py.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →