Skip to content

Commit 6108884

Browse files
committed
fix(openrouter): match the tilde-prefixed OpenRouter Kimi alias id
The OpenRouter catalogue identifier for the rolling Kimi alias is ~moonshotai/kimi-latest - the ~ prefix is part of the id and is what reaches applyOpenRouterMoonshotK3Profile as modelId. The previous bare moonshotai/kimi-latest entry never matched, so the alias case from issue Zoo-Code-Org#1316 was left unprofiled.
1 parent fb30c8d commit 6108884

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎src/api/providers/fetchers/__tests__/openrouter.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ describe("OpenRouter API", () => {
514514
expect(result.defaultTemperature).toBe(1)
515515
})
516516

517-
it("applies the Moonshot K3 profile for moonshotai/kimi-latest", () => {
517+
it("applies the Moonshot K3 profile for ~moonshotai/kimi-latest", () => {
518518
const mockModel = {
519519
name: "Kimi Latest",
520520
description: "Test model",
@@ -527,7 +527,7 @@ describe("OpenRouter API", () => {
527527
}
528528

529529
const result = parseOpenRouterModel({
530-
id: "moonshotai/kimi-latest",
530+
id: "~moonshotai/kimi-latest",
531531
model: mockModel,
532532
inputModality: ["text", "image"],
533533
outputModality: ["text"],
@@ -688,15 +688,15 @@ describe("OpenRouter API", () => {
688688
expect(stale.supportsReasoningEffort).toBe(true)
689689
})
690690

691-
it("applies the profile to moonshotai/kimi-latest", () => {
691+
it("applies the profile to ~moonshotai/kimi-latest", () => {
692692
const stale: ModelInfo = {
693693
maxTokens: 209716,
694694
contextWindow: 1000000,
695695
supportsPromptCache: true,
696696
supportsReasoningEffort: true,
697697
}
698698

699-
const result = applyOpenRouterMoonshotK3Profile("moonshotai/kimi-latest", stale)
699+
const result = applyOpenRouterMoonshotK3Profile("~moonshotai/kimi-latest", stale)
700700

701701
expect(result.maxTokens).toBe(32768)
702702
expect(result.supportsReasoningEffort).toEqual(["low", "high", "max"])

‎src/api/providers/fetchers/openrouter.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,14 @@ export async function getOpenRouterModelEndpoints(
200200
* module-scope literals become "static" mutants, and the Stryker/Vitest
201201
* runner combination used by the mutation-diff gate never activates them,
202202
* so they would report as surviving mutants (see .github/workflows/mutation-testing.yml).
203+
*
204+
* `~moonshotai/kimi-latest` is OpenRouter's rolling Kimi alias: the catalogue
205+
* identifier keeps its `~` prefix, and that exact string is what reaches this
206+
* function as `modelId`. Issue #1316 covers the alias in addition to the exact
207+
* `moonshotai/kimi-k3` id.
203208
*/
204209
export const applyOpenRouterMoonshotK3Profile = (modelId: string, modelInfo: ModelInfo): ModelInfo => {
205-
const moonshotK3Models = new Set<string>(["moonshotai/kimi-k3", "moonshotai/kimi-latest"])
210+
const moonshotK3Models = new Set<string>(["moonshotai/kimi-k3", "~moonshotai/kimi-latest"])
206211
if (!moonshotK3Models.has(modelId)) {
207212
return modelInfo
208213
}

0 commit comments

Comments
 (0)