Skip to content

feat: add MiniMax Cloud API as alternative prompt enhancement provider - #96

Open
octo-patch wants to merge 1 commit into
Tencent-Hunyuan:mainfrom
octo-patch:feature/add-minimax-provider
Open

feat: add MiniMax Cloud API as alternative prompt enhancement provider#96
octo-patch wants to merge 1 commit into
Tencent-Hunyuan:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch

Copy link
Copy Markdown

Summary

  • Add MiniMax Cloud API as an alternative LLM provider for prompt enhancement (PE) in HunyuanImage-3.0, alongside the existing DeepSeek/Tencent Cloud integration
  • Introduce --llm-provider CLI flag (deepseek/minimax) and --sys-prompt-type flag (universal/text_rendering) for flexible prompt rewriting configuration
  • MiniMax uses an OpenAI-compatible API at https://api.minimax.io/v1 with models like MiniMax-M2.7 (1M context window) — users only need pip install openai and a MINIMAX_API_KEY

Changes

File Description
PE/minimax_client.py New MiniMaxClient class with OpenAI-compat API, temperature clamping (0,1], think-tag stripping, retry logic
run_image_gen.py Multi-provider dispatch via --llm-provider flag, new --sys-prompt-type arg (fixes missing arg reference)
README.md MiniMax installation step, usage example, CLI arguments table
tests/test_minimax_provider.py 31 unit tests + 3 integration tests

Motivation

The current PE module only supports DeepSeek via Tencent Cloud's LKEAP SDK, which requires Tencent Cloud credentials. Adding MiniMax as an alternative:

  • Provides a simpler setup path (standard OpenAI SDK + API key)
  • Gives users choice of LLM backend for prompt enhancement
  • MiniMax-M2.7 offers a 1M token context window suitable for complex prompt engineering

Test plan

  • 31 unit tests covering: think-tag stripping, client init, recaption, arg parsing, provider dispatch, system prompt compatibility
  • 3 integration tests with real MiniMax API (universal prompt, text rendering, M2.5 model)
  • All 34 tests passing
  • Manual test: python3 run_image_gen.py --prompt 'test' --rewrite 1 --llm-provider minimax (requires GPU for full image generation)

Usage

# With MiniMax PE
export MINIMAX_API_KEY="your_key"
python3 run_image_gen.py \
    --model-id ./HunyuanImage-3 \
    --prompt "A brown and white dog running on grass" \
    --rewrite 1 \
    --llm-provider minimax

Add MiniMax as an alternative LLM provider for prompt enhancement (PE)
alongside the existing DeepSeek integration. MiniMax offers an OpenAI-
compatible API with models like MiniMax-M2.7 (1M context) that can be
used for prompt recaptioning in HunyuanImage-3.0 image generation.

Changes:
- Add PE/minimax_client.py: MiniMaxClient with OpenAI-compat API,
  temperature clamping (0,1], think-tag stripping, retry logic
- Modify run_image_gen.py: --llm-provider flag (deepseek/minimax),
  --sys-prompt-type flag for selecting prompt style
- Update README.md: MiniMax installation, usage examples, CLI args
- Add tests/test_minimax_provider.py: 31 unit + 3 integration tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant