Skip to content

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

Add AIHubMix provider integration

harry0703f29a56e4cef4
diff --git a/README-en.md b/README-en.md
index 93d296bf..be5773e6 100644
--- a/README-en.md
+++ b/README-en.md
@@ -27,24 +27,30 @@ materials, video subtitles, and video background music before synthesizing a hig
</div>
+<p align="center">
+ <sub>
+ Thanks to <a href="https://aihubmix.com/?aff=CEve">AIHubMix</a> for sponsoring this project. AIHubMix deeply adapts to OpenAI, Claude, Gemini, DeepSeek, Zhipu, Qwen, and other leading models, providing one-stop access to GPT-5.5, deepseek-v4-flash, and 700+ models including free options with production-grade stability.
+ </sub>
+</p>
+
## Features 🎯
- [x] Complete **MVC architecture**, **clearly structured** code, easy to maintain, supports both `API`
- and `Web interface`
+ and `Web interface`
- [x] Supports **AI-generated** video copy, as well as **customized copy**
- [x] Supports various **high-definition video** sizes
- - [x] Portrait 9:16, `1080x1920`
- - [x] Landscape 16:9, `1920x1080`
+ - [x] Portrait 9:16, `1080x1920`
+ - [x] Landscape 16:9, `1920x1080`
- [x] Supports **batch video generation**, allowing the creation of multiple videos at once, then selecting the most
- satisfactory one
+ satisfactory one
- [x] Supports setting the **duration of video clips**, facilitating adjustments to material switching frequency
- [x] Supports video copy in both **Chinese** and **English**
- [x] Supports **multiple voice** synthesis, with **real-time preview** of effects
- [x] Supports **subtitle generation**, with adjustable `font`, `position`, `color`, `size`, and also
- supports `subtitle outlining`
+ supports `subtitle outlining`
- [x] Supports **background music**, either random or specified music files, with adjustable `background music volume`
- [x] Video material sources are **high-definition** and **royalty-free**, and you can also use your own **local materials**
-- [x] Supports integration with various models such as **OpenAI**, **Moonshot**, **Azure**, **gpt4free**, **one-api**, **Qwen**, **Google Gemini**, **Ollama**, **DeepSeek**, **MiniMax**, **ERNIE**, **Pollinations**, **ModelScope** and more
+- [x] Supports integration with various models such as **OpenAI**, **AIHubMix**, **Moonshot**, **Azure**, **gpt4free**, **one-api**, **Qwen**, **Google Gemini**, **Ollama**, **DeepSeek**, **MiniMax**, **ERNIE**, **Pollinations**, **ModelScope** and more
## Video Demos 📺
@@ -87,11 +93,11 @@ materials, video subtitles, and video background music before synthesizing a hig
- Recommended platforms: Windows 10+, macOS 11+, or a mainstream Linux distribution
- A GPU is not required, but it is recommended if you want faster local transcription, faster video processing, or smoother batch generation
-| Item | Minimum | Recommended | Optimal |
-| --- | --- | --- | --- |
-| CPU | 4 cores | 6 to 8 cores | 8+ cores |
-| RAM | 4 GB | 8 GB | 16+ GB |
-| GPU | Not required | 4+ GB VRAM | 8+ GB VRAM |
+| Item | Minimum | Recommended | Optimal |
+| ---- | ------------ | ------------ | ---------- |
+| CPU | 4 cores | 6 to 8 cores | 8+ cores |
+| RAM | 4 GB | 8 GB | 16+ GB |
+| GPU | Not required | 4+ GB VRAM | 8+ GB VRAM |
- If you mainly rely on cloud LLMs, cloud TTS, and online material sources, CPU and RAM matter more than GPU
- If you use `faster-whisper`, batch generation, or heavier local processing, a GPU will improve throughput noticeably
@@ -104,12 +110,12 @@ materials, video subtitles, and video background music before synthesizing a hig
- MacOS / Linux users: use `uv sync --frozen` for the primary local setup path
- If you want a more isolated runtime: use Docker deployment
-### Run in Google Colab
+### Run in Google Colab
+
Want to try MoneyPrinterTurbo without setting up a local environment? Run it directly in Google Colab!
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/harry0703/MoneyPrinterTurbo/blob/main/docs/MoneyPrinterTurbo.ipynb)
-
### Windows
The downloadable package is still the older `v1.2.6` bundled build. After downloading, run `update.bat` first to bring it up to the latest code.
@@ -139,6 +145,7 @@ git clone https://github.com/harry0703/MoneyPrinterTurbo.git
- Copy the `config.example.toml` file and rename it to `config.toml`
- Follow the instructions in the `config.toml` file to configure `pexels_api_keys` and `llm_provider`, and according to
the llm_provider's service provider, set up the corresponding API Key
+- To use the recommended multi-model provider, you can set `llm_provider` to `aihubmix` and enter the corresponding API key.
### Docker Deployment 🐳
@@ -187,6 +194,7 @@ pip install -r requirements.txt
```
Notes:
+
- `pyproject.toml` is now the primary dependency manifest.
- `uv.lock` pins the resolved environment, so `uv sync --frozen` is recommended by default.
- `requirements.txt` is kept only for legacy `pip`-based installation.
@@ -330,6 +338,7 @@ MoneyPrinterTurbo
## Background Music 🎵
Background music for videos is located in the project's `resource/songs` directory.
+
> The current project includes some default music from YouTube videos. If there are copyright issues, please delete
> them.
diff --git a/README.md b/README.md
index 3256f377..dcf3ec90 100644
--- a/README.md
+++ b/README.md
@@ -12,10 +12,17 @@
<div align="center">
<a href="https://trendshift.io/repositories/8731" target="_blank"><img src="https://trendshift.io/api/badge/repositories/8731" alt="harry0703%2FMoneyPrinterTurbo | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
</div>
+
<br>
只需提供一个视频 <b>主题</b> 或 <b>关键词</b> ,就可以全自动生成视频文案、视频素材、视频字幕、视频背景音乐,然后合成一个高清的短视频。
<br>
+<p align="center">
+ <sub>
+ 感谢 <a href="https://aihubmix.com/?aff=CEve">AIHubMix</a> 对本项目的赞助。AIHubMix 深度适配 OpenAI、Claude、Gemini、DeepSeek、智谱、千问等全球顶级最新模型,一站式快速接入 GPT-5.5、deepseek-v4-flash 等 700+ 模型(含多个免费模型),提供企业级生产稳定性保障。
+ </sub>
+</p>
+
<h4>Web界面</h4>
![](docs/webui.jpg)
@@ -31,8 +38,8 @@
- [x] 完整的 **MVC架构**,代码 **结构清晰**,易于维护,支持 `API` 和 `Web界面`
- [x] 支持视频文案 **AI自动生成**,也可以**自定义文案**
- [x] 支持多种 **高清视频** 尺寸
- - [x] 竖屏 9:16,`1080x1920`
- - [x] 横屏 16:9,`1920x1080`
+ - [x] 竖屏 9:16,`1080x1920`
+ - [x] 横屏 16:9,`1920x1080`
- [x] 支持 **批量视频生成**,可以一次生成多个视频,然后选择一个最满意的
- [x] 支持 **视频片段时长** 设置,方便调节素材切换频率
- [x] 支持 **中文** 和 **英文** 视频文案
@@ -40,8 +47,7 @@
- [x] 支持 **字幕生成**,可以调整 `字体`、`位置`、`颜色`、`大小`,同时支持`字幕描边`设置
- [x] 支持 **背景音乐**,随机或者指定音乐文件,可设置`背景音乐音量`
- [x] 视频素材来源 **高清**,而且 **无版权**,也可以使用自己的 **本地素材**
-- [x] 支持 **OpenAI**、**Moonshot**、**Azure**、**gpt4free**、**one-api**、**通义千问**、**Google Gemini**、**Ollama**、**DeepSeek**、**MiniMax**、 **文心一言**, **Pollinations**、**ModelScope** 等多种模型接入
- - 中国用户建议使用 **DeepSeek** 或 **Moonshot** 作为大模型提供商(国内可直接访问,不需要VPN。注册就送额度,基本够用)
+- [x] 支持 **OpenAI**、**AIHubMix**、**Moonshot**、**Azure**、**gpt4free**、**one-api**、**通义千问**、**Google Gemini**、**Ollama**、**DeepSeek**、**MiniMax**、 **文心一言**, **Pollinations**、**ModelScope** 等多种模型接入
## 视频演示 📺
@@ -86,16 +92,15 @@
- 建议系统:Windows 10 或 MacOS 11.0 以上,或主流 Linux 发行版
- GPU 不是必需项,但如果你希望本地转录、更快的视频处理或更顺畅的批量生成体验,建议使用带显存的独立显卡
-| 项目 | 最低配置 | 推荐配置 | 理想配置 |
-| --- | --- | --- | --- |
-| CPU | 4 核 | 6 到 8 核 | 8 核及以上 |
-| RAM | 4 GB | 8 GB | 16 GB 及以上 |
-| GPU | 非必须 | 4 GB 显存及以上 | 8 GB 显存及以上 |
+| 项目 | 最低配置 | 推荐配置 | 理想配置 |
+| ---- | -------- | --------------- | --------------- |
+| CPU | 4 核 | 6 到 8 核 | 8 核及以上 |
+| RAM | 4 GB | 8 GB | 16 GB 及以上 |
+| GPU | 非必须 | 4 GB 显存及以上 | 8 GB 显存及以上 |
- 如果你主要依赖云端 LLM、云端 TTS 和在线素材源,CPU 与内存比 GPU 更重要
- 如果你启用 `faster-whisper`、批量生成或更重的本地处理链路,GPU 会明显提升速度
-
## 快速开始 🚀
### 推荐使用方式
@@ -105,11 +110,11 @@
- 想要隔离运行环境:优先使用 Docker 部署
### 在 Google Colab 中运行
+
免去本地环境配置,点击直接在 Google Colab 中快速体验 MoneyPrinterTurbo
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/harry0703/MoneyPrinterTurbo/blob/main/docs/MoneyPrinterTurbo.ipynb)
-
### Windows一键启动包
下载一键启动包,解压直接使用(路径不要有 **中文**、**特殊字符**、**空格**)
@@ -140,6 +145,7 @@ git clone https://github.com/harry0703/MoneyPrinterTurbo.git
- 将 `config.example.toml` 文件复制一份,命名为 `config.toml`
- 按照 `config.toml` 文件中的说明,配置好 `pexels_api_keys` 和 `llm_provider`,并根据 llm_provider 对应的服务商,配置相关的
API Key
+- 如果希望使用推荐的大模型平台,也可以将 `llm_provider` 设置为 `aihubmix`,并填写对应的 API Key。
### Docker部署 🐳
@@ -194,6 +200,7 @@ pip install -r requirements.txt
```
说明:
+
- `pyproject.toml` 是主依赖定义文件
- `uv.lock` 是锁文件,建议默认执行 `uv sync --frozen`
- `requirements.txt` 仅保留给旧的 `pip` 安装方式兼容使用
@@ -201,15 +208,15 @@ pip install -r requirements.txt
#### ② 安装好 ImageMagick
- Windows:
- - 下载 https://imagemagick.org/script/download.php 选择Windows版本,切记一定要选择 **静态库** 版本,比如
- ImageMagick-7.1.1-32-Q16-x64-**static**.exe
- - 安装下载好的 ImageMagick,**注意不要修改安装路径**
- - 修改 `配置文件 config.toml` 中的 `imagemagick_path` 为你的 **实际安装路径**
+ - 下载 https://imagemagick.org/script/download.php 选择Windows版本,切记一定要选择 **静态库** 版本,比如
+ ImageMagick-7.1.1-32-Q16-x64-**static**.exe
+ - 安装下载好的 ImageMagick,**注意不要修改安装路径**
+ - 修改 `配置文件 config.toml` 中的 `imagemagick_path` 为你的 **实际安装路径**
- MacOS:
```shell
brew install imagemagick
- ````
+ ```
- Ubuntu
```shell
sudo apt-get install imagemagick
@@ -312,7 +319,7 @@ python main.py
最终的文件路径应该是这样: `.\MoneyPrinterTurbo\models\whisper-large-v3`
```
-MoneyPrinterTurbo
+MoneyPrinterTurbo
├─models
│ └─whisper-large-v3
│ config.json
@@ -325,6 +332,7 @@ MoneyPrinterTurbo
## 背景音乐 🎵
用于视频的背景音乐,位于项目的 `resource/songs` 目录下。
+
> 当前项目里面放了一些默认的音乐,来自于 YouTube 视频,如有侵权,请删除。
## 字幕字体 🅰
diff --git a/app/config/config.py b/app/config/config.py
index 779aafe9..4122f2ab 100644
--- a/app/config/config.py
+++ b/app/config/config.py
@@ -177,7 +177,8 @@ listen_port = _cfg.get("listen_port", 8080)
project_name = _cfg.get("project_name", "MoneyPrinterTurbo")
project_description = _cfg.get(
"project_description",
- "<a href='https://github.com/harry0703/MoneyPrinterTurbo'>https://github.com/harry0703/MoneyPrinterTurbo</a>",
+ "<a href='https://github.com/harry0703/MoneyPrinterTurbo'>https://github.com/harry0703/MoneyPrinterTurbo</a>"
+ "<br><small>Supported by <a href='https://aihubmix.com/?aff=CEve'>AIHubMix</a></small>",
)
project_version = _cfg.get("project_version", "1.2.9")
reload_debug = False
diff --git a/app/services/llm.py b/app/services/llm.py
index 9630eaaf..60a56657 100644
--- a/app/services/llm.py
+++ b/app/services/llm.py
@@ -127,6 +127,17 @@ def _generate_response(prompt: str) -> str:
base_url = config.app.get("openai_base_url", "")
if not base_url:
base_url = "https://api.openai.com/v1"
+ elif llm_provider == "aihubmix":
+ api_key = config.app.get("aihubmix_api_key")
+ model_name = config.app.get("aihubmix_model_name")
+ base_url = config.app.get("aihubmix_base_url", "")
+ # AIHubMix 兼容 OpenAI Chat Completions 协议。这里使用独立
+ # provider 保存合作方的默认网关和推荐模型,避免把推广链接、
+ # 默认模型等合作配置混进普通 OpenAI provider,影响现有用户。
+ if not base_url:
+ base_url = "https://aihubmix.com/v1"
+ if not model_name:
+ model_name = "gpt-5.4-mini"
elif llm_provider == "oneapi":
api_key = config.app.get("oneapi_api_key")
model_name = config.app.get("oneapi_model_name")
diff --git a/config.example.toml b/config.example.toml
index 59a37b3c..767ee272 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -31,6 +31,7 @@ pixabay_api_keys = []
# 支持的提供商 (Supported providers):
# openai
+# aihubmix (OpenAI-compatible AI model gateway)
# moonshot (月之暗面)
# azure
# qwen (通义千问)
@@ -74,6 +75,13 @@ openai_base_url = ""
# 如果使用兼容供应商,请填写该平台要求的模型 ID。
openai_model_name = "gpt-4o-mini"
+########## AIHubMix API Key
+# AIHubMix is OpenAI-compatible and can use one API key to access multiple models.
+# Visit https://aihubmix.com/?aff=CEve to register and get your API key.
+aihubmix_api_key = ""
+aihubmix_base_url = "https://aihubmix.com/v1"
+aihubmix_model_name = "gpt-5.4-mini"
+
########## Moonshot API Key
# Visit https://platform.moonshot.cn/console/api-keys to get your API key.
moonshot_api_key = ""
diff --git a/test/services/test_llm.py b/test/services/test_llm.py
index edf21a83..1332abff 100644
--- a/test/services/test_llm.py
+++ b/test/services/test_llm.py
@@ -181,6 +181,48 @@ class TestLiteLLMProvider(unittest.TestCase):
self.assertIn("api_key is not set", result)
self.assertNotIn("litellm", result.lower())
+ def test_aihubmix_provider_uses_openai_compatible_client(self):
+ """
+ AIHubMix 是 OpenAI-compatible 网关。这里用 fake OpenAI client
+ 验证独立 provider 会使用合作方默认地址和推荐模型,避免真实网络
+ 或私有 API Key 影响测试稳定性。
+ """
+ config.app["llm_provider"] = "aihubmix"
+ config.app["aihubmix_api_key"] = "aihubmix-key"
+ config.app["aihubmix_base_url"] = ""
+ config.app["aihubmix_model_name"] = ""
+
+ class FakeCompletions:
+ def create(self, **kwargs):
+ self.kwargs = kwargs
+ message = types.SimpleNamespace(content="hello\naihubmix")
+ choice = types.SimpleNamespace(message=message)
+ return types.SimpleNamespace(choices=[choice])
+
+ fake_completions = FakeCompletions()
+ fake_client = types.SimpleNamespace(
+ chat=types.SimpleNamespace(completions=fake_completions)
+ )
+
+ with (
+ patch.object(llm, "OpenAI", return_value=fake_client) as openai_client,
+ patch.object(llm, "ChatCompletion", types.SimpleNamespace),
+ ):
+ result = llm._generate_response("Say hello")
+
+ openai_client.assert_called_once_with(
+ api_key="aihubmix-key",
+ base_url="https://aihubmix.com/v1",
+ )
+ self.assertEqual(
+ fake_completions.kwargs,
+ {
+ "model": "gpt-5.4-mini",
+ "messages": [{"role": "user", "content": "Say hello"}],
+ },
+ )
+ self.assertEqual(result, "helloaihubmix")
+
def test_grok_provider_still_uses_existing_path(self):
config.app["llm_provider"] = "grok"
config.app["grok_api_key"] = ""
diff --git a/webui/Main.py b/webui/Main.py
index 48f7a447..e500d63a 100644
--- a/webui/Main.py
+++ b/webui/Main.py
@@ -243,38 +243,47 @@ if not config.app.get("hide_config", False):
with middle_config_panel:
st.write(tr("LLM Settings"))
- llm_providers = [
- "OpenAI",
- "Moonshot",
- "Azure",
- "Qwen",
- "DeepSeek",
- "ModelScope",
- "Gemini",
- "Grok",
- "Ollama",
- "G4f",
- "OneAPI",
- "Cloudflare",
- "ERNIE",
- "MiMo",
- "Pollinations",
- "LiteLLM",
+ # 下拉框需要展示“AIHubMix(推荐)”这类面向用户的文案,
+ # 但配置文件和后端逻辑必须继续使用稳定的小写 provider id。
+ # 因此这里显式维护 display label 和 provider id 的映射,避免
+ # UI 文案变化污染 `config.app["llm_provider"]`。
+ llm_provider_options = [
+ ("OpenAI", "openai"),
+ ("AIHubMix(推荐)", "aihubmix"),
+ ("Moonshot", "moonshot"),
+ ("Azure", "azure"),
+ ("Qwen", "qwen"),
+ ("DeepSeek", "deepseek"),
+ ("ModelScope", "modelscope"),
+ ("Gemini", "gemini"),
+ ("Grok", "grok"),
+ ("Ollama", "ollama"),
+ ("G4f", "g4f"),
+ ("OneAPI", "oneapi"),
+ ("Cloudflare", "cloudflare"),
+ ("ERNIE", "ernie"),
+ ("MiMo", "mimo"),
+ ("Pollinations", "pollinations"),
+ ("LiteLLM", "litellm"),
]
- saved_llm_provider = config.app.get("llm_provider", "OpenAI").lower()
+ llm_provider_labels = [label for label, _ in llm_provider_options]
+ llm_provider_values = {
+ label: provider_id for label, provider_id in llm_provider_options
+ }
+ saved_llm_provider = config.app.get("llm_provider", "openai").lower()
saved_llm_provider_index = 0
- for i, provider in enumerate(llm_providers):
- if provider.lower() == saved_llm_provider:
+ for i, (_, provider_id) in enumerate(llm_provider_options):
+ if provider_id == saved_llm_provider:
saved_llm_provider_index = i
break
- llm_provider = st.selectbox(
+ llm_provider_label = st.selectbox(
tr("LLM Provider"),
- options=llm_providers,
+ options=llm_provider_labels,
index=saved_llm_provider_index,
)
llm_helper = st.container()
- llm_provider = llm_provider.lower()
+ llm_provider = llm_provider_values[llm_provider_label]
config.app["llm_provider"] = llm_provider
llm_api_key = config.app.get(f"{llm_provider}_api_key", "")
@@ -317,6 +326,25 @@ if not config.app.get("hide_config", False):
- **Model Name**: 填写**有权限**的模型;如果使用兼容供应商,请填写该平台支持的模型 ID
"""
+ if llm_provider == "aihubmix":
+ if not llm_model_name:
+ llm_model_name = "gpt-5.4-mini"
+ if not llm_base_url:
+ llm_base_url = "https://aihubmix.com/v1"
+ with llm_helper:
+ tips = """
+ ##### AIHubMix 配置说明
+ - **注册链接**: [点击注册 AIHubMix](https://aihubmix.com/?aff=CEve)
+ - **Base Url**: 预填 https://aihubmix.com/v1
+ - **推荐模型**: 默认 gpt-5.4-mini,也可以填写 AIHubMix 支持的免费模型或其它模型 ID
+
+ 推荐理由:
+ - **模型全**: Claude、GPT、Gemini、Grok、DeepSeek、通义等 700+ 模型一站覆盖
+ - **稳定**: 无限并发,永远在线,集群部署于谷歌云,长期为众多知名应用提供高并发服务
+ - **能力完整**: 文本、图片生成、视频生成、TTS、STT、向量嵌入、Rerank,多模态场景全搞定
+ - **计费透明**: 按量付费,无会员无包月,免费模型可使用
+ """
+
if llm_provider == "moonshot":
if not llm_model_name:
llm_model_name = "moonshot-v1-8k"
@@ -470,9 +498,13 @@ if not config.app.get("hide_config", False):
"""
if tips and config.ui["language"] == "zh":
- st.warning(
- "中国用户建议使用 **DeepSeek** 或 **Moonshot** 作为大模型提供商\n- 国内可直接访问,不需要VPN \n- 注册就送额度,基本够用"
- )
+ # AIHubMix 自身就是 OpenAI-compatible 聚合平台;用户主动选择
+ # 该 provider 时,再显示 DeepSeek/Moonshot 的通用推荐会造成
+ # 信息干扰,也不利于保持合作入口的轻量、清晰。
+ if llm_provider != "aihubmix":
+ st.warning(
+ "中国用户建议使用 **DeepSeek** 或 **Moonshot** 作为大模型提供商\n- 国内可直接访问,不需要VPN \n- 注册就送额度,基本够用"
+ )
st.info(tips)
st_llm_api_key = st.text_input(