Skip to content

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

feat(llm): add Cheaper Inference provider (#1401)

aiapienthusiastf2d44d62721a
diff --git a/app/models/llm_provider.py b/app/models/llm_provider.py
index d1cde8f4..a61a8f4b 100644
--- a/app/models/llm_provider.py
+++ b/app/models/llm_provider.py
@@ -412,6 +412,14 @@ LLM_PROVIDER_REGISTRY = (
default_base_url="https://fluxionai.space/v1",
model_docs_url="https://fluxionai.space/model-plaza",
),
+ LLMProviderSpec(
+ "cheaperinference",
+ "Cheaper Inference",
+ api_key_url="https://cheaperinference.com/signup",
+ default_model="gpt-5.4-mini",
+ default_base_url="https://api.cheaperinference.com/v1",
+ model_docs_url="https://cheaperinference.com/#models",
+ ),
# 本地部署与通用网关
LLMProviderSpec(
"ollama",
diff --git a/config.example.toml b/config.example.toml
index 80166ad7..66a771ee 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -265,6 +265,13 @@ fluxionai_api_key = ""
fluxionai_base_url = ""
fluxionai_model_name = ""
+# Cheaper Inference, an OpenAI-compatible multi-model gateway.
+# API key: https://cheaperinference.com/signup
+# Model list: https://cheaperinference.com/#models
+cheaperinference_api_key = ""
+cheaperinference_base_url = ""
+cheaperinference_model_name = ""
+
# OpenAI or another OpenAI Chat Completions-compatible provider.
# API key: https://platform.openai.com/api-keys
openai_api_key = ""
diff --git a/test/services/test_llm.py b/test/services/test_llm.py
index 49bb56fd..2ed73aef 100644
--- a/test/services/test_llm.py
+++ b/test/services/test_llm.py
@@ -320,6 +320,22 @@ class TestLiteLLMProvider(unittest.TestCase):
self.assertEqual(api_route.default_base_url, "https://www.api-route.com/v1")
self.assertEqual(api_route.adapter, "openai_compatible")
self.assertTrue(api_route.requires_api_key)
+ cheaperinference = get_llm_provider("cheaperinference")
+ self.assertEqual(cheaperinference.default_model, "gpt-5.4-mini")
+ self.assertEqual(
+ cheaperinference.default_base_url,
+ "https://api.cheaperinference.com/v1",
+ )
+ self.assertEqual(cheaperinference.adapter, "openai_compatible")
+ self.assertTrue(cheaperinference.requires_api_key)
+ self.assertEqual(
+ cheaperinference.api_key_url,
+ "https://cheaperinference.com/signup",
+ )
+ self.assertEqual(
+ cheaperinference.model_docs_url,
+ "https://cheaperinference.com/#models",
+ )
pollinations = get_llm_provider("pollinations")
self.assertEqual(pollinations.default_model, "openai-fast")
self.assertEqual(
@@ -378,6 +394,7 @@ class TestLiteLLMProvider(unittest.TestCase):
"openrouter",
"api_route",
"fluxionai",
+ "cheaperinference",
"ollama",
"claude_code",
"oneapi",
diff --git a/test/services/test_webui_i18n.py b/test/services/test_webui_i18n.py
index a130602d..3fa9c974 100644
--- a/test/services/test_webui_i18n.py
+++ b/test/services/test_webui_i18n.py
@@ -49,6 +49,7 @@ ENGLISH_FALLBACK_KEYS = frozenset(
"llm_provider_label.openrouter",
"llm_provider_label.api_route",
"llm_provider_label.fluxionai",
+ "llm_provider_label.cheaperinference",
"llm_provider_label.shengsuanyun",
"LoomLoom Poll Retry Pending",
"LoomLoom Poll Retry Warning",
diff --git a/webui/i18n/en.json b/webui/i18n/en.json
index 11a2d345..d807fcc0 100644
--- a/webui/i18n/en.json
+++ b/webui/i18n/en.json
@@ -234,6 +234,8 @@
"llm_provider_label.api_route": "API Route",
"llm_provider_label.fluxionai": "Fluxion AI",
"llm_provider_tips.fluxionai": "##### Fluxion AI Configuration\n- **API Key**: Sign up through the [referral link]({api_key_url}) and create a key for an **OpenAI API group** in the console\n- **Base Url**: Defaults to `{default_base_url}`. If your group uses another endpoint, enter its OpenAI-compatible API base URL (including `/v1`), not the full `/chat/completions` path\n- **Model Name**: Defaults to `{default_model}`. Available models depend on your group; check the [model plaza]({model_docs_url})\n\nUsed to generate video scripts and stock-footage search terms. Native Anthropic and Gemini API groups are not supported by this entry.",
+ "llm_provider_label.cheaperinference": "Cheaper Inference",
+ "llm_provider_tips.cheaperinference": "##### Cheaper Inference Configuration\n- **API Key**: Sign up and create an API key at [Cheaper Inference]({api_key_url})\n- **Base Url**: Defaults to `{default_base_url}`\n- **Model Name**: Defaults to `{default_model}`; see the [model list]({model_docs_url}) for all model IDs\n\nCheaper Inference is an OpenAI-compatible gateway to models from many labs. Each model costs 15–60% less than the list price of its lab.",
"API Key": "API Key",
"Base Url": "Base Url",
"Account ID": "Account ID",
diff --git a/webui/i18n/zh.json b/webui/i18n/zh.json
index a2d3ef8f..a0daffea 100644
--- a/webui/i18n/zh.json
+++ b/webui/i18n/zh.json
@@ -234,6 +234,8 @@
"llm_provider_label.api_route": "API Route",
"llm_provider_label.fluxionai": "Fluxion AI",
"llm_provider_tips.fluxionai": "##### Fluxion AI 配置说明\n- **API Key**:通过[专属链接]({api_key_url})注册,在控制台创建 **OpenAI 接口分组**的密钥\n- **Base Url**:默认 `{default_base_url}`;如分组提供其他地址,请填写对应的 OpenAI 兼容 API 地址(包含 `/v1`),不要填写完整的 `/chat/completions` 路径\n- **Model Name**:默认 `{default_model}`;可用模型随分组不同而变化,请在[模型广场]({model_docs_url})查看\n\n用于生成视频文案和素材搜索关键词。Anthropic 或 Gemini 原生接口分组不适用于此入口。",
+ "llm_provider_label.cheaperinference": "Cheaper Inference",
+ "llm_provider_tips.cheaperinference": "##### Cheaper Inference 配置说明\n- **API Key**: 在 [Cheaper Inference 官网]({api_key_url}) 注册并创建 API Key\n- **Base Url**: 默认 `{default_base_url}`\n- **Model Name**: 默认 `{default_model}`;可在 [模型列表]({model_docs_url}) 查看所有模型 ID\n\nCheaper Inference 是兼容 OpenAI 接口的多模型网关。每个模型的价格比其厂商官方价格低 15–60%。",
"API Key": "API Key",
"Base Url": "Base Url",
"Account ID": "Account ID",