Skip to content

Commit e9d91de

Browse files
committed
fix(moonshot): accept moonshotai/<model> as direct-API alias
Users copying a Kimi model id from OpenRouter (which lists models as moonshotai/kimi-k2.6) and dropping the openrouter/ prefix to hit the direct API saw 'Unknown model: moonshotai/kimi-k2.6'. The direct provider was registered only as moonshot, so only moonshot/kimi-k2.6 resolved. The OpenRouter org slug, Moonshot AI's own branding, and the existing moonshot manifest's modelPricing.providers.moonshot.openRouter entry all use the moonshotai form — only the direct-API name disagreed. The OpenAI plugin already shipped the manifest pattern for this exact shape (azure-openai-responses → openai), and there's a planner test that pins it down. Reuse the same modelCatalog.aliases mechanism in the moonshot manifest: "modelCatalog": { "aliases": { "moonshotai": { "provider": "moonshot" } }, ... } This keeps moonshot as the canonical id (no rename, no breaking change for operators whose configs already say moonshot/...). The catalog planner now resolves moonshotai/<model> through moonshot's existing models list, baseUrl, api class, discovery, pricing, and auth choices unchanged. providers, providerEndpoints, providerRequest, providerAuthEnvVars, and providerAuthChoices stay keyed on moonshot — no duplication, no provider-id divergence. Test: new planner case in src/model-catalog/manifest-planner.test.ts mirrors the existing azure-openai-responses test — asserts that with providerFilter: 'moonshotai' the planner returns rows with ref 'moonshotai/<model>' and the moonshot catalog's api/baseUrl/discovery values. The existing moonshot plugin-registration contract test continues to pass against the modified manifest (canonical providerIds: ['moonshot'] unchanged). Closes #73876
1 parent 25f0b5d commit e9d91de

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

extensions/moonshot/openclaw.plugin.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
}
3434
},
3535
"modelCatalog": {
36+
"aliases": {
37+
"moonshotai": {
38+
"provider": "moonshot"
39+
}
40+
},
3641
"providers": {
3742
"moonshot": {
3843
"baseUrl": "https://api.moonshot.ai/v1",

src/model-catalog/manifest-planner.test.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,63 @@ describe("manifest model catalog planner", () => {
143143
]);
144144
});
145145

146+
// Regression for https://github.com/openclaw/openclaw/issues/73876.
147+
// The user-facing complaint is that copying a model id from OpenRouter
148+
// (which uses "moonshotai/kimi-k2.6" as the org slug) and dropping the
149+
// "openrouter/" prefix to hit the direct API failed with "Unknown
150+
// model: moonshotai/kimi-k2.6". The OpenAI plugin already shipped the
151+
// alias pattern (azure-openai-responses → openai); applying it to the
152+
// moonshot manifest lets the org-slug name resolve to moonshot's
153+
// existing catalog without renaming the canonical provider id (which
154+
// would break operators whose configs already say "moonshot/...").
155+
it("plans moonshotai alias rows from the moonshot provider catalog", () => {
156+
const plan = planManifestModelCatalogRows({
157+
providerFilter: "moonshotai",
158+
registry: {
159+
plugins: [
160+
{
161+
id: "moonshot",
162+
providers: ["moonshot"],
163+
modelCatalog: {
164+
aliases: {
165+
moonshotai: {
166+
provider: "moonshot",
167+
},
168+
},
169+
discovery: {
170+
moonshot: "static",
171+
},
172+
providers: {
173+
moonshot: {
174+
api: "openai-completions",
175+
baseUrl: "https://api.moonshot.ai/v1",
176+
models: [{ id: "kimi-k2.6", name: "Kimi K2.6" }],
177+
},
178+
},
179+
},
180+
},
181+
],
182+
},
183+
});
184+
185+
expect(plan.entries).toEqual([
186+
expect.objectContaining({
187+
pluginId: "moonshot",
188+
provider: "moonshotai",
189+
discovery: "static",
190+
}),
191+
]);
192+
expect(plan.rows).toEqual([
193+
expect.objectContaining({
194+
provider: "moonshotai",
195+
id: "kimi-k2.6",
196+
ref: "moonshotai/kimi-k2.6",
197+
api: "openai-completions",
198+
baseUrl: "https://api.moonshot.ai/v1",
199+
}),
200+
]);
201+
});
202+
146203
it("keeps alias provider rows out of unfiltered broad planning", () => {
147204
const plan = planManifestModelCatalogRows({
148205
registry: {

0 commit comments

Comments
 (0)