Fix Kimi and Xiaomi model metadata

Closes #5075, closes #5078. Refs #5087.
This commit is contained in:
Mario Zechner
2026-05-28 22:19:15 +02:00
parent 7e70886652
commit 97ef317389
7 changed files with 88 additions and 56 deletions

View File

@@ -995,6 +995,51 @@ describe("openai-completions tool_choice", () => {
expect(messages[0]).not.toHaveProperty("reasoning");
});
it("sends thinking none for OpenCode Go Kimi K2.6 when thinking is off", async () => {
const model = getModel("opencode-go", "kimi-k2.6")!;
let payload: unknown;
await streamSimple(
model,
{
messages: [{ role: "user", content: "Hi", timestamp: Date.now() }],
},
{
apiKey: "test",
onPayload: (params: unknown) => {
payload = params;
},
},
).result();
const params = (payload ?? mockState.lastParams) as { thinking?: string; reasoning_effort?: string };
expect(params.thinking).toBe("none");
expect(params.reasoning_effort).toBeUndefined();
});
it("sends thinking effort for OpenCode Go Kimi K2.6 when thinking is enabled", async () => {
const model = getModel("opencode-go", "kimi-k2.6")!;
let payload: unknown;
await streamSimple(
model,
{
messages: [{ role: "user", content: "Hi", timestamp: Date.now() }],
},
{
apiKey: "test",
reasoning: "high",
onPayload: (params: unknown) => {
payload = params;
},
},
).result();
const params = (payload ?? mockState.lastParams) as { thinking?: string; reasoning_effort?: string };
expect(params.thinking).toBe("high");
expect(params.reasoning_effort).toBeUndefined();
});
it("does not double-count reasoning tokens in completion usage", async () => {
mockState.chunks = [
{

View File

@@ -0,0 +1,15 @@
import { describe, expect, it } from "vitest";
import { getModel, getModels } from "../src/models.ts";
describe("Xiaomi MiMo models", () => {
it("keeps mimo-v2-flash on the API billing provider", () => {
expect(getModel("xiaomi", "mimo-v2-flash")).toBeDefined();
});
it.each(["xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"] as const)(
"omits mimo-v2-flash from %s",
(provider) => {
expect(getModels(provider).some((model) => model.id === "mimo-v2-flash")).toBe(false);
},
);
});