From 66cd21e6eccdba245c4b99a2c5e1fd3b2f791995 Mon Sep 17 00:00:00 2001 From: Zhiwei Li Date: Sat, 14 Feb 2026 20:21:34 +1100 Subject: [PATCH 1/2] feat: add SiliconFlow provider support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add SiliconFlow (硅基流动) as an OpenAI-compatible gateway provider. SiliconFlow hosts multiple models (Qwen, DeepSeek, etc.) via an OpenAI-compatible API at https://api.siliconflow.cn/v1. Changes: - Add ProviderSpec for siliconflow in providers/registry.py - Add siliconflow field to ProvidersConfig in config/schema.py Co-authored-by: Cursor --- nanobot/config/schema.py | 1 + nanobot/providers/registry.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/nanobot/config/schema.py b/nanobot/config/schema.py index 60bbc69..6140a65 100644 --- a/nanobot/config/schema.py +++ b/nanobot/config/schema.py @@ -192,6 +192,7 @@ class ProvidersConfig(BaseModel): moonshot: ProviderConfig = Field(default_factory=ProviderConfig) minimax: ProviderConfig = Field(default_factory=ProviderConfig) aihubmix: ProviderConfig = Field(default_factory=ProviderConfig) # AiHubMix API gateway + siliconflow: ProviderConfig = Field(default_factory=ProviderConfig) # 硅基流动 API gateway class GatewayConfig(BaseModel): diff --git a/nanobot/providers/registry.py b/nanobot/providers/registry.py index b9071a0..bf00e31 100644 --- a/nanobot/providers/registry.py +++ b/nanobot/providers/registry.py @@ -117,6 +117,27 @@ PROVIDERS: tuple[ProviderSpec, ...] = ( model_overrides=(), ), + # SiliconFlow (硅基流动): OpenAI-compatible gateway hosting multiple models. + # strip_model_prefix=False: SiliconFlow model names include org prefix + # (e.g. "Qwen/Qwen2.5-14B-Instruct", "deepseek-ai/DeepSeek-V3") + # which is part of the model ID and must NOT be stripped. + ProviderSpec( + name="siliconflow", + keywords=("siliconflow",), + env_key="OPENAI_API_KEY", # OpenAI-compatible + display_name="SiliconFlow", + litellm_prefix="openai", # → openai/{model} + skip_prefixes=(), + env_extras=(), + is_gateway=True, + is_local=False, + detect_by_key_prefix="", + detect_by_base_keyword="siliconflow", + default_api_base="https://api.siliconflow.cn/v1", + strip_model_prefix=False, + model_overrides=(), + ), + # === Standard providers (matched by model-name keywords) =============== # Anthropic: LiteLLM recognizes "claude-*" natively, no prefix needed. From 80a5a8c983de351b62060b9d1bc3d40d1a122228 Mon Sep 17 00:00:00 2001 From: Re-bin Date: Wed, 18 Feb 2026 03:52:53 +0000 Subject: [PATCH 2/2] feat: add siliconflow provider support --- README.md | 1 + nanobot/providers/registry.py | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 03789de..dfe799a 100644 --- a/README.md +++ b/README.md @@ -583,6 +583,7 @@ Config file: `~/.nanobot/config.json` | `gemini` | LLM (Gemini direct) | [aistudio.google.com](https://aistudio.google.com) | | `minimax` | LLM (MiniMax direct) | [platform.minimax.io](https://platform.minimax.io) | | `aihubmix` | LLM (API gateway, access to all models) | [aihubmix.com](https://aihubmix.com) | +| `siliconflow` | LLM (SiliconFlow/硅基流动, API gateway) | [siliconflow.cn](https://siliconflow.cn) | | `dashscope` | LLM (Qwen) | [dashscope.console.aliyun.com](https://dashscope.console.aliyun.com) | | `moonshot` | LLM (Moonshot/Kimi) | [platform.moonshot.cn](https://platform.moonshot.cn) | | `zhipu` | LLM (Zhipu GLM) | [open.bigmodel.cn](https://open.bigmodel.cn) | diff --git a/nanobot/providers/registry.py b/nanobot/providers/registry.py index d267069..49b735c 100644 --- a/nanobot/providers/registry.py +++ b/nanobot/providers/registry.py @@ -119,16 +119,13 @@ PROVIDERS: tuple[ProviderSpec, ...] = ( model_overrides=(), ), - # SiliconFlow (硅基流动): OpenAI-compatible gateway hosting multiple models. - # strip_model_prefix=False: SiliconFlow model names include org prefix - # (e.g. "Qwen/Qwen2.5-14B-Instruct", "deepseek-ai/DeepSeek-V3") - # which is part of the model ID and must NOT be stripped. + # SiliconFlow (硅基流动): OpenAI-compatible gateway, model names keep org prefix ProviderSpec( name="siliconflow", keywords=("siliconflow",), - env_key="OPENAI_API_KEY", # OpenAI-compatible + env_key="OPENAI_API_KEY", display_name="SiliconFlow", - litellm_prefix="openai", # → openai/{model} + litellm_prefix="openai", skip_prefixes=(), env_extras=(), is_gateway=True,