fix(ai): show implied Kimi Coding subscription costs

This commit is contained in:
Armin Ronacher
2026-07-17 10:00:40 +02:00
parent 58575888f5
commit 8881e17625
7 changed files with 70 additions and 21 deletions
+15
View File
@@ -56,6 +56,21 @@ describe("builtin providers", () => {
}
});
it("uses API-equivalent implied pricing for Kimi Coding subscription models", () => {
const models = builtinModels();
const expectedCosts = {
k2p7: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
k3: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 0 },
"kimi-for-coding": { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
"kimi-for-coding-highspeed": { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 },
"kimi-k2-thinking": { input: 0.6, output: 2.5, cacheRead: 0.15, cacheWrite: 0 },
};
for (const [modelId, cost] of Object.entries(expectedCosts)) {
expect(models.getModel("kimi-coding", modelId)?.cost).toEqual(cost);
}
});
it("resolves anthropic auth from env with OAuth token precedence", async () => {
const models = createModels({
authContext: fakeAuthContext({ ANTHROPIC_API_KEY: "key", ANTHROPIC_OAUTH_TOKEN: "oauth-token" }),