利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
feat: add APIMart integration
harry0703ab1c79020283
diff --git a/README-en.md b/README-en.mdindex 9fdb55c0..d6fd6a44 100644--- a/README-en.md+++ b/README-en.md@@ -60,6 +60,14 @@ Thanks to [Kimi](https://platform.kimi.ai?track_id=track-f6b0a640d35c41deb03b247Thanks to <a href="https://www.ccsub.net/register?ref=VCVDAWWY">CCSub</a> for sponsoring this project! CCSub is a stable, affordable AI API relay platform — your drop-in replacement for a Claude.ai subscription. One API key gives you access to Claude Opus 4.8, Sonnet, Haiku, GPT-5, and Gemini at roughly 30% of direct API cost, with no VPN required from anywhere in the world. Compatible with Claude Code, Codex, Cursor, Cline, Continue, Windsurf, and all major AI coding tools. Register at <a href="https://www.ccsub.net/register?ref=VCVDAWWY">www.ccsub.net</a> and get $5 free credit on sign-up.</td></tr>+ <tr>+ <td align="center" width="120">+ <a href="https://go.apimart.ai/gh-moneyprinterturbo"><img src="docs/sponsors/apimart-logo.png" alt="APIMart" width="100"></a>+ </td>+ <td align="left">+ Thanks to <a href="https://go.apimart.ai/gh-moneyprinterturbo">APIMart</a> for sponsoring this project! APIMart is a low-cost API platform for AI image & video generation — <strong>GPT-Image-2 from $0.006/image, 160+ images per dollar</strong>. <strong>One async API covers both image and video—switch models without changing code.</strong> Submit a task, get an ID, and fetch results via polling or callback. Batch tens of thousands of images without timeouts. Pay-as-you-go with no monthly fee — <a href="https://go.apimart.ai/gh-moneyprinterturbo">sign up here</a> to get started.+ </td>+ </tr><tr><td align="center" width="120"><a href="https://infistar.cc/register?aff=6T4EYXP2&ref_source=link"><img src="docs/sponsors/infistar-logo.svg" alt="Infistar.ai" height="56"></a><br>diff --git a/README-ja.md b/README-ja.mdindex a316e1ff..4095e05c 100644--- a/README-ja.md+++ b/README-ja.md@@ -60,6 +60,14 @@本プロジェクトをスポンサードしてくださっている <a href="https://www.ccsub.net/register?ref=VCVDAWWY">CCSub</a> に感謝します! CCSub は安定的で手頃な AI API 中継プラットフォームであり、Claude.ai のサブスクリプションをそのまま置き換えられます。API キー 1 つで Claude Opus 4.8、Sonnet、Haiku、GPT-5、Gemini を直接 API のおよそ 30% のコストで利用でき、世界中どこからでも VPN は不要です。Claude Code、Codex、Cursor、Cline、Continue、Windsurf をはじめとする主要な AI コーディングツールに対応しています。<a href="https://www.ccsub.net/register?ref=VCVDAWWY">www.ccsub.net</a> から登録すると、初回登録時に 5 ドル分の無料クレジットがもらえます。</td></tr>+ <tr>+ <td align="center" width="120">+ <a href="https://go.apimart.ai/gh-moneyprinterturbo"><img src="docs/sponsors/apimart-logo.png" alt="APIMart" width="100"></a>+ </td>+ <td align="left">+ 本プロジェクトをスポンサードしてくださっている <a href="https://go.apimart.ai/gh-moneyprinterturbo">APIMart</a> に感謝します! APIMart は、AI 画像・動画生成に特化した低価格 API プラットフォームです。<strong>GPT-Image-2 は 1 枚あたり 0.006 米ドルから利用でき、1 米ドルで 160 枚以上の画像を生成できます</strong>。<strong>画像と動画を 1 つの非同期 API で扱い、コードを変更せずにモデルを切り替えられます</strong>。タスクを送信して ID を受け取った後、ポーリングまたはコールバックで結果を取得でき、数万枚規模のバッチ処理にも対応します。月額料金のない従量課金制で、<a href="https://go.apimart.ai/gh-moneyprinterturbo">こちらの登録リンク</a>からすぐに利用を開始できます。+ </td>+ </tr><tr><td align="center" width="120"><a href="https://infistar.cc/register?aff=6T4EYXP2&ref_source=link"><img src="docs/sponsors/infistar-logo.svg" alt="Infistar.ai" height="56"></a><br>diff --git a/README.md b/README.mdindex 58a6e73c..d85db588 100644--- a/README.md+++ b/README.md@@ -60,6 +60,14 @@感谢 <a href="https://www.ccsub.net/register?ref=VCVDAWWY">CCSub</a> 赞助本项目!<strong>CCSub 是稳定、实惠的 AI API 中转平台,是 Claude Code 官方订阅的超强平替。</strong>一个 API Key 即可调用 Claude Opus 4.8、Sonnet 4.6、Haiku 4.5、GPT-5、Gemini 等模型,价格约为官方直连的 1/3,全球直连无需梯子。兼容 Claude Code、Codex、Cursor、Cline、Continue、Windsurf 等所有主流 AI 编程工具。前往 <a href="https://www.ccsub.net/register?ref=VCVDAWWY">www.ccsub.net</a> 注册即送 $5 体验额度。</td></tr>+ <tr>+ <td align="center" width="120">+ <a href="https://go.apimart.ai/gh-moneyprinterturbo"><img src="docs/sponsors/apimart-logo.png" alt="APIMart" width="100"></a>+ </td>+ <td align="left">+ 感谢 <a href="https://go.apimart.ai/gh-moneyprinterturbo">APIMart</a> 赞助了本项目!APIMart 是专注 AI 图片/视频生成的低价 API 平台,<strong>GPT-Image-2 低至 $0.006/张,1 美元可出图 160+ 张</strong>。<strong>图片、视频一套异步 API 通吃,换模型不改代码</strong>;提交任务拿 ID,通过轮询或回调获取结果,支持万张级批量生成。按量付费、无月费,通过<a href="https://go.apimart.ai/gh-moneyprinterturbo">此注册链接</a>注册即可开用。+ </td>+ </tr><tr><td align="center" width="120"><a href="https://infistar.cc/register?aff=6T4EYXP2&ref_source=link"><img src="docs/sponsors/infistar-logo.svg" alt="Infistar.ai 无限星河" height="56"></a><br>diff --git a/app/models/llm_provider.py b/app/models/llm_provider.pyindex 7b6fe263..9a42f049 100644--- a/app/models/llm_provider.py+++ b/app/models/llm_provider.py@@ -318,6 +318,16 @@ LLM_PROVIDER_REGISTRY = (default_model="deepseek/deepseek-v4-flash",default_base_url="https://router.shengsuanyun.com/api/v1",),+ # APIMart 同时提供 `/api/v1` 业务接口和 `/v1` OpenAI 兼容接口。+ # 当前 LLM 服务层依赖 OpenAI SDK 直接读取 choices,因此必须使用不带+ # code/data 外层包装的 `/v1` 入口,不能照搬异步业务接口的地址。+ LLMProviderSpec(+ "apimart",+ "APIMart",+ api_key_url="https://go.apimart.ai/gh-moneyprinterturbo",+ default_model="gpt-5.6-terra",+ default_base_url="https://api.apimart.ai/v1",+ ),LLMProviderSpec("cloudflare","Cloudflare AI Gateway",diff --git a/config.example.toml b/config.example.tomlindex 9afb6519..4f96b5b3 100644--- a/config.example.toml+++ b/config.example.toml@@ -140,6 +140,13 @@ shengsuanyun_api_key = ""shengsuanyun_base_url = ""shengsuanyun_model_name = ""+# APIMart, OpenAI-compatible multi-model API.+# Sign up: https://go.apimart.ai/gh-moneyprinterturbo+# API docs: https://docs.apimart.ai/cn+apimart_api_key = ""+apimart_base_url = ""+apimart_model_name = ""+# OpenAI or another OpenAI Chat Completions-compatible provider.# API key: https://platform.openai.com/api-keysopenai_api_key = ""diff --git a/docs/sponsors/0029-logo.jpg b/docs/sponsors/0029-logo.jpgdeleted file mode 100644index c9058fa7..00000000Binary files a/docs/sponsors/0029-logo.jpg and /dev/null differdiff --git a/docs/sponsors/apimart-logo.png b/docs/sponsors/apimart-logo.pngnew file mode 100644index 00000000..a88d4506Binary files /dev/null and b/docs/sponsors/apimart-logo.png differdiff --git a/docs/sponsors/compshare-logo.png b/docs/sponsors/compshare-logo.pngdeleted file mode 100644index 1717e114..00000000Binary files a/docs/sponsors/compshare-logo.png and /dev/null differdiff --git a/docs/sponsors/ergou-api-logo.png b/docs/sponsors/ergou-api-logo.pngdeleted file mode 100644index 2f64c9e7..00000000Binary files a/docs/sponsors/ergou-api-logo.png and /dev/null differdiff --git a/test/services/test_llm.py b/test/services/test_llm.pyindex 283af0ad..f0d49d78 100644--- a/test/services/test_llm.py+++ b/test/services/test_llm.py@@ -326,6 +326,7 @@ class TestLiteLLMProvider(unittest.TestCase):"minimax","mimo","shengsuanyun",+ "apimart","cloudflare","modelscope","aihubmix",@@ -355,6 +356,13 @@ class TestLiteLLMProvider(unittest.TestCase):shengsuanyun.default_model,"deepseek/deepseek-v4-flash",)+ apimart = get_llm_provider("apimart")+ self.assertEqual(+ apimart.api_key_url,+ "https://go.apimart.ai/gh-moneyprinterturbo",+ )+ self.assertEqual(apimart.default_model, "gpt-5.6-terra")+ self.assertEqual(apimart.default_base_url, "https://api.apimart.ai/v1")def test_provider_registry_uses_conventional_locale_and_config_keys(self):"""统一命名规则可避免 WebUI 为每个 Provider 增加硬编码映射。"""@@ -1069,6 +1077,48 @@ class TestLiteLLMProvider(unittest.TestCase):self.assertIn("returned empty choices", result)self.assertNotIn("NoneType", result)+ def test_apimart_provider_uses_unwrapped_openai_compatible_endpoint(self):+ """+ APIMart 文档同时展示 `/api/v1` 和 `/v1` 两组入口。前者的示例响应+ 带有 code/data 外层包装,OpenAI SDK 无法直接从顶层读取 choices;+ LLM Provider 必须使用标准 `/v1` 地址,才能复用现有响应解析链路。+ """+ config.app["llm_provider"] = "apimart"+ config.app["apimart_api_key"] = "apimart-key"+ config.app["apimart_base_url"] = ""+ config.app["apimart_model_name"] = ""++ class FakeCompletions:+ def create(self, **kwargs):+ self.kwargs = kwargs+ message = types.SimpleNamespace(content="hello\napimart")+ 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="apimart-key",+ base_url="https://api.apimart.ai/v1",+ )+ self.assertEqual(+ fake_completions.kwargs,+ {+ "model": "gpt-5.6-terra",+ "messages": [{"role": "user", "content": "Say hello"}],+ },+ )+ self.assertEqual(result, "hello\napimart")+def test_aihubmix_provider_uses_openai_compatible_client(self):"""AIHubMix 是 OpenAI-compatible 网关。这里用 fake OpenAI clientdiff --git a/test/services/test_webui_i18n.py b/test/services/test_webui_i18n.pyindex 7aa08dda..56d26cdb 100644--- a/test/services/test_webui_i18n.py+++ b/test/services/test_webui_i18n.py@@ -18,8 +18,8 @@ PROVIDER_TIPS_PREFIXES = (LLM_PROVIDER_TIPS_PREFIX,TTS_PROVIDER_TIPS_PREFIX,)-# Shengsuan Cloud 目前只提供中英文界面。这些特殊文案和 Provider 长说明在-# 次要 locale 中统一回退英文,避免复制后长期不同步;普通界面文案仍必须完整翻译。+# 合作 Provider 的品牌名和长说明只维护中英文。次要 locale 统一回退英文,+# 避免把完全相同的品牌名复制十份,也避免长说明后续只更新部分语言。ENGLISH_FALLBACK_KEYS = frozenset({"AI Video Quote Required",@@ -38,6 +38,7 @@ ENGLISH_FALLBACK_KEYS = frozenset("llm_provider_endpoint.moonshot.global","llm_provider_authentication_error.moonshot","Local LLM Script Generation",+ "llm_provider_label.apimart","llm_provider_label.shengsuanyun","LoomLoom Poll Retry Pending","LoomLoom Poll Retry Warning",diff --git a/webui/i18n/en.json b/webui/i18n/en.jsonindex 1fa462b1..cce3f7c3 100644--- a/webui/i18n/en.json+++ b/webui/i18n/en.json@@ -204,6 +204,7 @@"Recommended": "Recommended","llm_provider_label.moonshot": "Kimi / Moonshot AI (Recommended)","llm_provider_label.shengsuanyun": "Shengsuan Cloud",+ "llm_provider_label.apimart": "APIMart","API Key": "API Key","Base Url": "Base Url","Account ID": "Account ID",@@ -354,6 +355,7 @@"llm_provider_tips.openai": "##### OpenAI Configuration\n- **API Key**: create one on the [OpenAI Platform]({api_key_url})\n- **Base Url**: defaults to `{default_base_url}`; enter another endpoint when using a compatible service\n- **Model Name**: defaults to `{default_model}`; you can also enter another model ID available to your account\n> Accessing the official service may require a network proxy in some regions","llm_provider_tips.anthropic": "##### Anthropic Claude Configuration\n- **API Key**: create one in the [Claude Console]({api_key_url})\n- **Base Url**: defaults to `{default_base_url}`, the OpenAI-compatible endpoint provided by Anthropic\n- **Model Name**: defaults to `{default_model}`; you can also enter another Claude model ID available to your account","llm_provider_tips.shengsuanyun": "##### Shengsuan Cloud Configuration\n- **API Key**: register and create one through the [Shengsuan Cloud API Key page]({api_key_url}); new MoneyPrinterTurbo users can receive a CNY 10 token voucher\n- **Base Url**: defaults to `{default_base_url}`\n- **Model Name**: defaults to `{default_model}`; [view the model list](https://global.modelmesh.info/model)\n\nWhen selected, LoomLoom script and video generation automatically reuse this API Key.",+ "llm_provider_tips.apimart": "##### APIMart Configuration\n- **API Key**: register through the [MoneyPrinterTurbo referral link]({api_key_url}) and create a key in the console\n- **Base Url**: defaults to `{default_base_url}`, using the OpenAI-compatible `/v1` endpoint\n- **Model Name**: defaults to `{default_model}`; [view the model list](https://apimart.ai/model?type=chat)\n\nAPIMart can generate video scripts and extract stock-footage search keywords. Its image and video generation APIs are not yet connected to the current material pipeline.","llm_provider_tips.aihubmix": "##### AIHubMix Configuration\n- **API Key**: create one in the [AIHubMix console]({api_key_url})\n- **Base Url**: defaults to `{default_base_url}`\n- **Model Name**: defaults to `{default_model}`; you can also enter another supported model ID","llm_provider_tips.aimlapi": "##### AIML API Configuration\n- **API Key**: create one at [AIML API]({api_key_url})\n- **Base Url**: defaults to `{default_base_url}`\n- **Model Name**: defaults to `{default_model}`; you can also enter another supported model ID","llm_provider_tips.evolink": "##### EvoLink Configuration\n- **API Key**: create one on [EvoLink]({api_key_url})\n- **Base Url**: defaults to `{default_base_url}`\n- **Model Name**: defaults to `{default_model}`; you can also enter another supported model ID",diff --git a/webui/i18n/zh.json b/webui/i18n/zh.jsonindex 0c20bda5..b98e0b86 100644--- a/webui/i18n/zh.json+++ b/webui/i18n/zh.json@@ -204,6 +204,7 @@"Recommended": "推荐","llm_provider_label.moonshot": "Kimi / Moonshot AI(推荐)","llm_provider_label.shengsuanyun": "胜算云",+ "llm_provider_label.apimart": "APIMart","API Key": "API Key","Base Url": "Base Url","Account ID": "Account ID",@@ -354,6 +355,7 @@"llm_provider_tips.openai": "##### OpenAI 配置说明\n- **API Key**: 在 [OpenAI Platform]({api_key_url}) 创建\n- **Base Url**: 默认 `{default_base_url}`;使用兼容服务时可填写对应地址\n- **Model Name**: 默认 `{default_model}`;也可以填写当前账号支持的其它模型 ID\n> 部分地区访问官方服务时可能需要配置网络代理","llm_provider_tips.anthropic": "##### Anthropic Claude 配置说明\n- **API Key**: 在 [Claude Console]({api_key_url}) 创建\n- **Base Url**: 默认 `{default_base_url}`,即 Anthropic 提供的 OpenAI 兼容端点\n- **Model Name**: 默认 `{default_model}`;也可以填写当前账号支持的其它 Claude 模型 ID","llm_provider_tips.shengsuanyun": "##### 胜算云配置说明\n- **API Key**: 通过 [胜算云 API Key 获取入口]({api_key_url}) 注册并创建;MoneyPrinterTurbo 新用户可领取 10 元 Token 券\n- **Base Url**: 默认 `{default_base_url}`\n- **Model Name**: 默认 `{default_model}`;[查看模型列表](https://global.modelmesh.info/model)\n\n选择胜算云后,文案和视频设置中的 LoomLoom 功能会自动复用此 API Key。",+ "llm_provider_tips.apimart": "##### APIMart 配置说明\n- **API Key**: 通过 [MoneyPrinterTurbo 专属注册链接]({api_key_url}) 注册并在控制台创建\n- **Base Url**: 默认 `{default_base_url}`,使用 OpenAI 兼容的 `/v1` 接口\n- **Model Name**: 默认 `{default_model}`;[查看模型列表](https://apimart.ai/zh/model?type=chat)\n\nAPIMart 可用于生成视频文案和提炼素材搜索关键词;图片、视频生成接口暂未接入当前素材链路。","llm_provider_tips.aihubmix": "##### AIHubMix 配置说明\n- **API Key**: 在 [AIHubMix 控制台]({api_key_url}) 创建\n- **Base Url**: 默认 `{default_base_url}`\n- **Model Name**: 默认 `{default_model}`;也可以填写平台支持的其它模型 ID","llm_provider_tips.aimlapi": "##### AIML API 配置说明\n- **API Key**: 在 [AIML API]({api_key_url}) 创建\n- **Base Url**: 默认 `{default_base_url}`\n- **Model Name**: 默认 `{default_model}`;也可以填写平台支持的其它模型 ID","llm_provider_tips.evolink": "##### EvoLink 配置说明\n- **API Key**: 在 [EvoLink]({api_key_url}) 创建\n- **Base Url**: 默认 `{default_base_url}`\n- **Model Name**: 默认 `{default_model}`;也可以填写平台支持的其它模型 ID",