How to Configure ViMax to Use the MiniMax API as a Chat Model Provider

Set model_provider: minimax in your pipeline configuration's chat_model.init_args section and supply your API key via the MINIMAX_API_KEY environment variable or the api_key parameter; ViMax automatically resolves the endpoint, default model, and temperature constraints.

ViMax is an open-source video generation framework that abstracts Large Language Model (LLM) backends through a provider preset system. When integrating the MiniMax API for chat-based video scripting workflows, the framework handles endpoint resolution, authentication injection, and parameter validation automatically via the built-in minimax preset.

Understanding the Provider Preset System

ViMax centralizes provider-specific logic in utils/provider_presets.py. This module defines a PROVIDER_PRESETS dictionary that maps provider names to configuration templates. When you specify model_provider: minimax in your YAML configuration, the framework invokes resolve_chat_model_config() to inject MiniMax-specific defaults before instantiating the chat client.

The preset automatically handles four critical configuration aspects:

  • Base URL injection: Sets base_url = "https://api.minimax.io/v1" for OpenAI-compatible communication
  • Authentication resolution: Reads the MINIMAX_API_KEY environment variable if api_key is not explicitly provided
  • Default model selection: Falls back to "MiniMax-M2.7" when no model is specified
  • Parameter validation: Clamps temperature values to MiniMax's supported range of [0.0, 1.0]

Configuration Methods

Minimal YAML Configuration

Create or modify any pipeline configuration file (such as configs/script2video_minimax.yaml or configs/idea2video_minimax.yaml) to include the minimap provider:

chat_model:
  init_args:
    model_provider: minimax
    model: MiniMax-M2.7
    api_key: <YOUR_MINIMAX_API_KEY>

When model_provider is set to minimax, ViMax automatically populates the base_url field. You can omit the model parameter to use the default MiniMax-M2.7 configuration.

Environment-Based Authentication

For security best practices, store your API key in an environment variable rather than committing it to version control:

export MINIMAX_API_KEY=sk-your-key-here

Then reference the provider without the api_key field:

chat_model:
  init_args:
    model_provider: minimax
    model: MiniMax-M2.5-highspeed

During initialization, resolve_chat_model_config() detects the missing api_key and injects the value from the MINIMAX_API_KEY environment variable.

Programmatic Configuration

For dynamic pipelines or testing scenarios, import the resolution utility directly from utils/provider_presets.py:

from utils.provider_presets import resolve_chat_model_config

user_args = {
    "model_provider": "minimax",
    "model": "MiniMax-M2.7-highspeed",
    # api_key omitted - fetched from MINIMAX_API_KEY env var

}

resolved = resolve_chat_model_config(user_args)

# resolved contains:

# {

#   "model_provider": "openai",

#   "base_url": "https://api.minimax.io/v1",

#   "api_key": "...",

#   "model": "MiniMax-M2.7-highspeed"

# }

Note that after resolution, the model_provider field is rewritten to "openai" so that the underlying LangChain client can communicate with MiniMax's OpenAI-compatible API.

Available Models and Constraints

MiniMax supports four distinct model variants through the ViMax preset:

  • MiniMax-M2.7 (default)
  • MiniMax-M2.7-highspeed
  • MiniMax-M2.5
  • MiniMax-M2.5-highspeed

Temperature Clamping

MiniMax only accepts temperature values in the range [0.0, 1.0]. If your configuration specifies a value outside this range, resolve_chat_model_config() automatically clamps it to the nearest valid boundary and logs a warning:

args = {
    "model_provider": "minimax",
    "temperature": 1.5,  # Exceeds maximum

}
resolved = resolve_chat_model_config(args)
print(resolved["temperature"])  # Output: 1.0

Configuration Resolution Flow

When you configure ViMax to use the MiniMax API, the framework executes this resolution pipeline inside utils/provider_presets.py:

  1. Preset Detection: The function checks if model_provider matches a key in PROVIDER_PRESETS
  2. URL Assignment: Injects https://api.minimax.io/v1 as base_url if not user-specified
  3. Credential Injection: Pulls from MINIMAX_API_KEY environment variable when api_key is absent
  4. Default Application: Applies MiniMax-M2.7 as the default model if unspecified
  5. Range Validation: Clamps temperature values to [0.0, 1.0]
  6. Provider Rewrite: Changes model_provider to openai for LangChain compatibility

The resulting configuration dictionary is then passed to the chat model factory, which constructs an OpenAI-compatible client pointing at MiniMax's endpoint.

Summary

  • Set model_provider: minimax in your chat_model.init_args configuration to trigger the MiniMax preset
  • Provide authentication via the MINIMAX_API_KEY environment variable or the api_key parameter
  • Choose from four available models: MiniMax-M2.7, MiniMax-M2.7-highspeed, MiniMax-M2.5, or MiniMax-M2.5-highspeed
  • Temperature values are automatically clamped to the [0.0, 1.0] range supported by MiniMax
  • The framework rewrites the provider to openai internally while maintaining the MiniMax endpoint configuration

Frequently Asked Questions

Where does ViMax store the MiniMax API endpoint configuration?

The endpoint URL https://api.minimax.io/v1 is defined in the PROVIDER_PRESETS dictionary within utils/provider_presets.py. This value is automatically injected into your configuration when you set model_provider: minimax, eliminating the need to manually specify the base_url parameter.

Can I use a custom base URL with the MiniMax provider?

Yes. If you explicitly provide a base_url in your init_args, ViMax preserves your custom value instead of injecting the default MiniMax endpoint. However, the MiniMax preset is specifically designed for the official api.minimax.io endpoint, so custom URLs may not benefit from preset-specific validations like temperature clamping.

Why does the resolved configuration show model_provider: openai?

ViMax rewrites the provider to openai after applying MiniMax-specific presets because MiniMax exposes an OpenAI-compatible API. This allows the framework to use standard LangChain OpenAI client libraries while still routing requests to MiniMax's servers via the injected base_url and authentication headers.

What happens if I don't specify a model in the configuration?

If you omit the model parameter, resolve_chat_model_config() automatically applies the default value "MiniMax-M2.7" as defined in the provider preset. You can override this default by specifying any of the supported MiniMax model variants in your YAML configuration or programmatic arguments.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →