feat(modelmgr): split Moonshot/Kimi into Global and China presets (#2264)

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
This commit is contained in:
Junyan Chin
2026-06-19 18:39:58 +08:00
committed by GitHub
parent 511b5a7bf4
commit b02c9517f6
2 changed files with 35 additions and 2 deletions
@@ -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
@@ -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