Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(aihubmix): support configuring the base URL via AIHUBMIX_PROXY_URL (#16418)

YOYO-do6d572f1759c0
diff --git a/.env.example b/.env.example
index b5ca91edf7b..71b89d18348 100644
--- a/.env.example
+++ b/.env.example
@@ -187,6 +187,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# ## AiHubMix ###
# AIHUBMIX_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+# AIHUBMIX_PROXY_URL=https://your-aihubmix-endpoint.com
# ## BFL ###
diff --git a/Dockerfile b/Dockerfile
index 8916bd96673..92371587b93 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -225,7 +225,7 @@ ENV \
# Ai360
AI360_API_KEY="" AI360_MODEL_LIST="" \
# AiHubMix
- AIHUBMIX_API_KEY="" AIHUBMIX_MODEL_LIST="" \
+ AIHUBMIX_API_KEY="" AIHUBMIX_MODEL_LIST="" AIHUBMIX_PROXY_URL="" \
# Anthropic
ANTHROPIC_API_KEY="" ANTHROPIC_CLIENT_TIMEOUT="" ANTHROPIC_MODEL_LIST="" ANTHROPIC_PROXY_URL="" \
# Amazon Bedrock
diff --git a/docs/self-hosting/environment-variables/model-provider.mdx b/docs/self-hosting/environment-variables/model-provider.mdx
index 04d05e797d6..fcfbd49c3a4 100644
--- a/docs/self-hosting/environment-variables/model-provider.mdx
+++ b/docs/self-hosting/environment-variables/model-provider.mdx
@@ -827,6 +827,13 @@ NewAPI is a multi-provider model aggregation service that supports automatic mod
- Default: -
- Example: `sk-xxxxxx...xxxxxx`
+### `AIHUBMIX_PROXY_URL`
+
+- Type: Optional
+- Description: The base URL of the AiHubMix gateway. Point this at a mirror or backup endpoint; defaults to the official gateway when unset.
+- Default: `https://aihubmix.com`
+- Example: `https://your-aihubmix-endpoint.com`
+
### `AIHUBMIX_MODEL_LIST`
- Type: Optional
diff --git a/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx b/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx
index b136fd76a74..32772eb99a7 100644
--- a/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx
+++ b/docs/self-hosting/environment-variables/model-provider.zh-CN.mdx
@@ -828,6 +828,13 @@ LobeHub 在部署时提供了丰富的模型服务商相关的环境变量,你
- 默认值:-
- 示例:`sk-xxxxxx...xxxxxx`
+### `AIHUBMIX_PROXY_URL`
+
+- 类型:可选
+- 描述:AiHubMix 网关的基础地址,可指向镜像或备用端点;未设置时默认使用官方网关。
+- 默认值:`https://aihubmix.com`
+- 示例:`https://your-aihubmix-endpoint.com`
+
### `AIHUBMIX_MODEL_LIST`
- 类型:可选
diff --git a/packages/env/src/llm.ts b/packages/env/src/llm.ts
index b7b1e5aeb1b..2811ea08126 100644
--- a/packages/env/src/llm.ts
+++ b/packages/env/src/llm.ts
@@ -221,6 +221,7 @@ export const getLLMConfig = () => {
ENABLED_AIHUBMIX: z.boolean(),
AIHUBMIX_API_KEY: z.string().optional(),
+ AIHUBMIX_PROXY_URL: z.string().optional(),
ENABLED_NEWAPI: z.boolean(),
NEWAPI_API_KEY: z.string().optional(),
@@ -471,6 +472,7 @@ export const getLLMConfig = () => {
ENABLED_AIHUBMIX: !!process.env.AIHUBMIX_API_KEY,
AIHUBMIX_API_KEY: process.env.AIHUBMIX_API_KEY,
+ AIHUBMIX_PROXY_URL: process.env.AIHUBMIX_PROXY_URL,
ENABLED_NEWAPI: !!process.env.NEWAPI_API_KEY,
NEWAPI_API_KEY: process.env.NEWAPI_API_KEY,