Skip to content

Add MiniMax as alternative LLM provider for ChatOCR and DocTranslation#17879

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

Add MiniMax as alternative LLM provider for ChatOCR and DocTranslation#17879
octo-patch wants to merge 1 commit intoPaddlePaddle:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

Add MiniMax Cloud as an alternative LLM provider for the PP-ChatOCRv4 and PP-DocTranslation pipelines, alongside the existing Qianfan (ERNIE) support.

What's Changed

  • New llm_config.py module: Shared helper get_minimax_chat_bot_config() that builds a chat_bot_config dict for MiniMax's OpenAI-compatible API (MiniMax-M2.7, 204K context window)
  • CLI integration: Added --minimax_api_key argument to both pp_chatocrv4_doc and pp_doctranslation CLI subcommands
  • Environment variable support: API key can also be set via MINIMAX_API_KEY env var (more secure than CLI)
  • Priority handling: When both --minimax_api_key and --qianfan_api_key are provided, MiniMax takes precedence
  • Documentation: Updated both English and Chinese docs for PP-ChatOCRv4 and PP-DocTranslation with MiniMax usage examples (CLI and Python API)

Available MiniMax Models

Model Context Window
MiniMax-M2.7 (default) 204K tokens
MiniMax-M2.7-highspeed 204K tokens

Usage

CLI:

Python API:

Files Changed (8 files, ~346 additions)

File Change
paddleocr/_pipelines/llm_config.py New: MiniMax config helper
paddleocr/_pipelines/pp_chatocrv4_doc.py Add --minimax_api_key CLI arg
paddleocr/_pipelines/pp_doctranslation.py Add --minimax_api_key CLI arg
tests/pipelines/test_minimax_llm_config.py 10 unit + 2 integration tests
docs/.../PP-ChatOCRv4.en.md English docs update
docs/.../PP-ChatOCRv4.md Chinese docs update
docs/.../PP-DocTranslation.en.md English docs update
docs/.../PP-DocTranslation.md Chinese docs update

Test Plan

  • 10 unit tests pass (config structure, env var fallback, key precedence, error handling)
  • 2 integration tests pass (MiniMax M2.7 and M2.7-highspeed API smoke tests)
  • Existing pipeline tests unaffected (no changes to core pipeline logic)

Add MiniMax Cloud (MiniMax-M2.7, 204K context) as an alternative LLM
provider for the PP-ChatOCRv4 and PP-DocTranslation pipelines,
alongside the existing Qianfan (ERNIE) support.

Changes:
- Add llm_config.py with get_minimax_chat_bot_config() helper
- Add --minimax_api_key CLI argument to both pipeline executors
- MiniMax takes precedence when both keys are provided
- Support MINIMAX_API_KEY environment variable as secure alternative
- Update English and Chinese docs with MiniMax usage examples
- Add 10 unit tests and 2 integration tests

Co-Authored-By: Octopus <[email protected]>
@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Mar 30, 2026

Thanks for your contribution!

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 30, 2026

CLA assistant check
All committers have signed the CLA.

@luotao1
Copy link
Copy Markdown
Collaborator

luotao1 commented Apr 1, 2026

Please fix the CodeStyle.

@changdazhou
Copy link
Copy Markdown
Collaborator

Thanks for your contribution. Please update the method to provide general support for the OpenAI API, rather than only supporting MiniMax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants