Skip to content

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

feat(llm): add VolcEngine provider support

harry070348b08719c969
diff --git a/README.md b/README.md
index 41aa7a08..76460ee1 100644
--- a/README.md
+++ b/README.md
@@ -41,11 +41,11 @@
<tr>
<td align="center" width="160">
- <a href="https://www.volcengine.com/activity/codingplan?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo"><img src="docs/sponsors/volcengine-logo.svg" alt="火山引擎" height="32"></a><br>
- <a href="https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo"><strong>方舟 Agent Plan</strong></a>
+ <a href="https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo"><img src="docs/sponsors/volcengine-logo.svg" alt="火山引擎" height="32"></a><br>
+ <a href="https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo"><strong>火山引擎</strong></a>
</td>
<td align="left">
- <sub>感谢 <a href="https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo">方舟 Agent Plan</a> 对本项目的赞助。模型自由,工具不限,最新支持 MiniMax-M3 与 GLM-5.1,受邀下单叠加 9.5 折!集合主流优秀国产编程模型,多生态兼容,无缝融入您的工具链,依托字节资源保障和工程能力,更大容量,更快、更稳、更丝滑!</sub>
+ <sub>感谢 <a href="https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo">火山引擎</a> 赞助了本项目!方舟 Agent Plan 模型订阅套餐集成了包含 Doubao-Seed、Doubao-Seedance、Doubao-Seedream 等在内的字节跳动自研 SOTA 级模型,覆盖文本、代码、图像、视频等多模态任务。最新支持 MiniMax-M3、DeepSeek-V4 系列、GLM-5.2、Doubao-Seed-2.0 系列、Kimi-K2.7 等模型,工具不限。超全模态模型与 Harness 升级一步到位,深度支持 Agent 框架与 AI 编程工具。一次订阅,可以为不同任务切换合适的 AI 引擎。方舟 Agent Plan 限时 2.5 折订阅,<a href="https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo">点击链接抢购</a>,名额有限,先到先得。</sub>
</td>
</tr>
<tr>
diff --git a/app/services/llm.py b/app/services/llm.py
index 642b361f..8c5cfb40 100644
--- a/app/services/llm.py
+++ b/app/services/llm.py
@@ -280,6 +280,17 @@ def _generate_response(prompt: str) -> str:
base_url = "https://api.xiaomimimo.com/v1"
if not model_name:
model_name = "mimo-v2.5-pro"
+ elif llm_provider == "volcengine":
+ api_key = config.app.get("volcengine_api_key")
+ model_name = config.app.get("volcengine_model_name")
+ base_url = config.app.get("volcengine_base_url", "")
+ # 火山引擎方舟提供 OpenAI-compatible Chat Completions 接口。
+ # 独立 provider 可以让用户直接选择 VolcEngine,而不用把 Ark
+ # 的 key/base_url 混到通用 OpenAI 配置里,后续维护也更清晰。
+ if not base_url:
+ base_url = "https://ark.cn-beijing.volces.com/api/v3"
+ if not model_name:
+ model_name = "doubao-seed-2-1-turbo-260628"
elif llm_provider == "deepseek":
api_key = config.app.get("deepseek_api_key")
model_name = config.app.get("deepseek_model_name")
diff --git a/config.example.toml b/config.example.toml
index 8dacf4a1..305fe22d 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -88,6 +88,7 @@ twelvelabs_rerank_terms = false
# cloudflare
# minimax
# evolink (OpenAI-compatible multi-model AI gateway)
+# volcengine (VolcEngine Ark OpenAI-compatible API)
# mimo (Xiaomi MiMo)
# ernie (文心一言)
# modelscope (魔搭社区)
@@ -214,6 +215,14 @@ evolink_api_key = ""
evolink_base_url = "https://direct.evolink.ai/v1"
evolink_model_name = "gpt-5.5"
+########## VolcEngine Ark API Key
+# VolcEngine Ark provides an OpenAI-compatible Chat Completions API.
+# Create an API key in the VolcEngine Ark console and use a model ID that is
+# enabled for your account.
+volcengine_api_key = ""
+volcengine_base_url = "https://ark.cn-beijing.volces.com/api/v3"
+volcengine_model_name = "doubao-seed-2-1-turbo-260628"
+
########## Xiaomi MiMo API Key
# Xiaomi MiMo API is OpenAI-compatible.
# Visit https://platform.xiaomimimo.com/docs/zh-CN/quick-start/first-api-call to get more details.
diff --git a/test/services/test_llm.py b/test/services/test_llm.py
index 576545b9..03a23d95 100644
--- a/test/services/test_llm.py
+++ b/test/services/test_llm.py
@@ -491,6 +491,48 @@ class TestLiteLLMProvider(unittest.TestCase):
)
self.assertEqual(result, "helloevolink")
+ def test_volcengine_provider_uses_openai_compatible_client(self):
+ """
+ VolcEngine Ark 暴露 OpenAI-compatible Chat Completions。
+ 这里用 fake OpenAI client 覆盖 provider 默认地址和默认模型,
+ 避免真实网络或私有 API key 影响测试稳定性。
+ """
+ config.app["llm_provider"] = "volcengine"
+ config.app["volcengine_api_key"] = "volcengine-key"
+ config.app["volcengine_base_url"] = ""
+ config.app["volcengine_model_name"] = ""
+
+ class FakeCompletions:
+ def create(self, **kwargs):
+ self.kwargs = kwargs
+ message = types.SimpleNamespace(content="hello\nvolcengine")
+ 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="volcengine-key",
+ base_url="https://ark.cn-beijing.volces.com/api/v3",
+ )
+ self.assertEqual(
+ fake_completions.kwargs,
+ {
+ "model": "doubao-seed-2-1-turbo-260628",
+ "messages": [{"role": "user", "content": "Say hello"}],
+ },
+ )
+ self.assertEqual(result, "hellovolcengine")
+
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 7ee99610..02a221f1 100644
--- a/webui/Main.py
+++ b/webui/Main.py
@@ -353,6 +353,7 @@ if not config.app.get("hide_config", False):
(aihubmix_label, "aihubmix"),
("AIML API", "aimlapi"),
("EvoLink", "evolink"),
+ ("VolcEngine", "volcengine"),
("Moonshot", "moonshot"),
("Azure", "azure"),
("Qwen", "qwen"),
@@ -485,6 +486,20 @@ if not config.app.get("hide_config", False):
- **Model Name**: 默认 gpt-5.5,也可以填写 EvoLink 支持的其它模型 ID
"""
+ if llm_provider == "volcengine":
+ if not llm_model_name:
+ llm_model_name = "doubao-seed-2-1-turbo-260628"
+ if not llm_base_url:
+ llm_base_url = "https://ark.cn-beijing.volces.com/api/v3"
+ with llm_helper:
+ tips = """
+ ##### VolcEngine Ark 配置说明
+ - **注册链接**: [点击注册 火山引擎](https://www.volcengine.com/activity/ai618?utm_campaign=hw&utm_content=hw&utm_medium=devrel_tool_web&utm_source=OWO&utm_term=MoneyPrinterTurbo)
+ - **API Key**: 在火山引擎方舟控制台创建 API Key
+ - **Base Url**: 默认 https://ark.cn-beijing.volces.com/api/v3
+ - **Model Name**: 填写 Ark 控制台已开通的模型 ID,例如 doubao-seed-2-1-turbo-260628
+ """
+
if llm_provider == "moonshot":
if not llm_model_name:
llm_model_name = "moonshot-v1-8k"