From b02c9517f6d9abfc0cf51f3b03fa3d30bd31e073 Mon Sep 17 00:00:00 2001 From: Junyan Chin Date: Fri, 19 Jun 2026 18:39:58 +0800 Subject: [PATCH] feat(modelmgr): split Moonshot/Kimi into Global and China presets (#2264) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding a Kimi/Moonshot provider failed model scanning out of the box for CN-region API keys: the single preset defaulted its base URL to the global endpoint `https://api.moonshot.ai/v1`, but CN-issued keys are only valid against `https://api.moonshot.cn/v1`, so scanning returned `401 Invalid Authentication`. Flipping the default would just move the breakage to international keys, since the base_url field is plain free-text and either region is equally common. Instead, offer two clearly labelled presets, mirroring how the Lark adapter exposes feishu.cn vs larksuite.com: - `moonshot-chat-completions` -> "Moonshot / Kimi (Global · api.moonshot.ai)" - `moonshot-cn-chat-completions` -> "Moonshot / Kimi (China · api.moonshot.cn)" The existing component name is kept unchanged so provider rows already in the DB keep resolving; only its display label is clarified. Both presets keep base_url as a free-text field, so users behind a proxy / one-api gateway can still enter a custom endpoint. Both carry the same `kimi` search aliases so either shows up when searching. Fixes #2232 --- .../modelmgr/requesters/moonshotchatcmpl.yaml | 4 +-- .../requesters/moonshotcnchatcmpl.yaml | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/langbot/pkg/provider/modelmgr/requesters/moonshotcnchatcmpl.yaml diff --git a/src/langbot/pkg/provider/modelmgr/requesters/moonshotchatcmpl.yaml b/src/langbot/pkg/provider/modelmgr/requesters/moonshotchatcmpl.yaml index 50413f3b8..cffc2f060 100644 --- a/src/langbot/pkg/provider/modelmgr/requesters/moonshotchatcmpl.yaml +++ b/src/langbot/pkg/provider/modelmgr/requesters/moonshotchatcmpl.yaml @@ -3,8 +3,8 @@ kind: LLMAPIRequester metadata: name: moonshot-chat-completions label: - en_US: Moonshot - zh_Hans: 月之暗面 + en_US: Moonshot / Kimi (Global · api.moonshot.ai) + zh_Hans: 月之暗面 / Kimi(国际站 · api.moonshot.ai) icon: moonshot.png spec: litellm_provider: openai diff --git a/src/langbot/pkg/provider/modelmgr/requesters/moonshotcnchatcmpl.yaml b/src/langbot/pkg/provider/modelmgr/requesters/moonshotcnchatcmpl.yaml new file mode 100644 index 000000000..90316a1e8 --- /dev/null +++ b/src/langbot/pkg/provider/modelmgr/requesters/moonshotcnchatcmpl.yaml @@ -0,0 +1,33 @@ +apiVersion: v1 +kind: LLMAPIRequester +metadata: + name: moonshot-cn-chat-completions + label: + en_US: Moonshot / Kimi (China · api.moonshot.cn) + zh_Hans: 月之暗面 / Kimi(国内站 · api.moonshot.cn) + icon: moonshot.png +spec: + litellm_provider: openai + config: + - name: base_url + label: + en_US: Base URL + zh_Hans: 基础 URL + type: string + required: true + default: https://api.moonshot.cn/v1 + - name: timeout + label: + en_US: Timeout + zh_Hans: 超时时间 + type: integer + required: true + default: 120 + alias: "moonshot Moonshot 月之暗面 月暗 kimi Kimi 月之 暗面 moonshot-v1 k2 cn 国内 国内站" + support_type: + - llm + provider_category: manufacturer +execution: + python: + path: ./moonshotchatcmpl.py + attr: MoonshotChatCompletions