feat: add OpenAI-compatible prompt expander (MiniMax, OpenAI, etc.)#50
feat: add OpenAI-compatible prompt expander (MiniMax, OpenAI, etc.)#50octo-patch wants to merge 1 commit intoPhantom-video:mainPhantom-video/Phantom:mainfrom octo-patch:feature/add-openai-compatible-prompt-expanderocto-patch/Phantom:feature/add-openai-compatible-prompt-expanderCopy head branch name to clipboard
Conversation
Add a third prompt extension backend that works with any OpenAI-compatible API. By default it uses MiniMax (MiniMax-M2.7 model at https://api.minimax.io/v1), but the base URL and model can be overridden for other providers like OpenAI. - New OpenAICompatPromptExpander class in prompt_extend.py (text-only and image+text via base64, think-tag stripping, retries) - New --prompt_extend_method openai_compatible CLI option in generate.py - README section documenting MiniMax / OpenAI-compatible usage - 29 unit tests + 3 live integration tests Co-Authored-By: Octopus <liyuan851277048@icloud.com>
|
The point about an OpenAI-compatible prompt expander for video generation workflows is worth separating from generic provider support. In real workloads, the hard part is usually not sending one request; it is keeping cost, latency, and response shape predictable once users switch providers. I would track prompt expansion, video request, retry, and output status separately. In media workflows, the expensive part is often not the prompt expansion itself but failed or repeated generation attempts. I am working through similar issues while testing an OpenAI-compatible layer for official Chinese models, where normalized usage and fallback behavior matter a lot. Is prompt expansion mainly for quality improvement, provider fallback, or reducing failed video generations? |
Summary
Adds a third prompt extension backend (
OpenAICompatPromptExpander) that works with any OpenAI-compatible LLM API, complementing the existing DashScope and local Qwen backends.MiniMax-M2.7athttps://api.minimax.io/v1), but the base URL and model can be overridden for OpenAI, DeepSeek, or any other OpenAI-compatible providerextend) and image+text (extend_with_img) prompt extension via base64 encoding--prompt_extend_method openai_compatibleCLI option ingenerate.pyChanges
phantom_wan/utils/prompt_extend.pyOpenAICompatPromptExpanderclassgenerate.pyopenai_compatiblemethod + importREADME.mdtests/test_openai_compat_prompt_expander.pytests/test_openai_compat_integration.pyUsage
Test plan