Skip to content

feat: add MiniMax provider support for prompt rewriting#11

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

feat: add MiniMax provider support for prompt rewriting#11
octo-patch wants to merge 1 commit intojd-opensource:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

This PR adds MiniMax as a supported provider for the prompt rewriting feature in JoyAI-Image.

Changes

  • src/infer_runtime/settings.py: Auto-detects MiniMax models (any model whose name starts with minimax, case-insensitive) and configures MINIMAX_API_KEY and the MiniMax OpenAI-compatible base URL (https://api.minimax.io/v1) automatically.
  • src/infer_runtime/prompt_rewrite.py: Fixes temperature handling for MiniMax — MiniMax requires temperature in (0.0, 1.0] and rejects 0.0, so MiniMax models now default to 1.0.
  • inference.py: Updated --rewrite-model help text to document MiniMax support.
  • tests/test_minimax_support.py: Unit tests (20) + integration tests (2, skipped without MINIMAX_API_KEY).

Usage

# Set your MiniMax API key
export MINIMAX_API_KEY=your-minimax-api-key

# Use MiniMax for prompt rewriting
python inference.py \
  --ckpt-root /path/to/ckpts \
  --prompt "Turn the plate blue" \
  --image test_images/test_1.jpg \
  --rewrite-prompt \
  --rewrite-model MiniMax-M2.7

When --rewrite-model is set to a MiniMax model (e.g. MiniMax-M2.7 or MiniMax-M2.7-highspeed), the settings layer automatically:

  1. Reads MINIMAX_API_KEY from the environment
  2. Sets the base URL to https://api.minimax.io/v1 (unless OPENAI_BASE_URL is already set)

Supported Models

Model Description
MiniMax-M2.7 Default — peak performance
MiniMax-M2.7-highspeed Faster, same performance

API Reference

- Auto-configure MINIMAX_API_KEY and base URL (https://api.minimax.io/v1)
  when a MiniMax model is selected via --rewrite-model
- Fix temperature for MiniMax models (must be in (0.0, 1.0], not 0.0)
- Add MINIMAX_API_KEY environment variable support
- Add unit tests and integration tests for MiniMax provider
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