feat: add tiered model pricing support (#67605)

Adds tiered model pricing support for cost tracking, keeps configured pricing ahead of cached catalog values, and includes latest Moonshot Kimi K2.6/K2.5 cost estimates.\n\nThanks @sliverp.
This commit is contained in:
Sliverp
2026-04-21 10:02:57 +08:00
committed by GitHub
parent 8d747d20b8
commit b938e6398b
18 changed files with 1351 additions and 118 deletions

View File

@@ -19,6 +19,18 @@ describe("moonshot provider catalog", () => {
"kimi-k2-thinking-turbo",
"kimi-k2-turbo",
]);
expect(provider.models.find((model) => model.id === "kimi-k2.6")?.cost).toEqual({
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
});
expect(provider.models.find((model) => model.id === "kimi-k2.5")?.cost).toEqual({
input: 0.6,
output: 3,
cacheRead: 0.1,
cacheWrite: 0,
});
});
it("opts native Moonshot baseUrls into streaming usage only inside the extension", () => {

View File

@@ -15,6 +15,18 @@ const MOONSHOT_DEFAULT_COST = {
cacheRead: 0,
cacheWrite: 0,
};
const MOONSHOT_K2_6_COST = {
input: 0.95,
output: 4,
cacheRead: 0.16,
cacheWrite: 0,
};
const MOONSHOT_K2_5_COST = {
input: 0.6,
output: 3,
cacheRead: 0.1,
cacheWrite: 0,
};
const MOONSHOT_MODEL_CATALOG = [
{
@@ -22,7 +34,7 @@ const MOONSHOT_MODEL_CATALOG = [
name: "Kimi K2.6",
reasoning: false,
input: ["text", "image"],
cost: MOONSHOT_DEFAULT_COST,
cost: MOONSHOT_K2_6_COST,
contextWindow: MOONSHOT_DEFAULT_CONTEXT_WINDOW,
maxTokens: MOONSHOT_DEFAULT_MAX_TOKENS,
},
@@ -31,7 +43,7 @@ const MOONSHOT_MODEL_CATALOG = [
name: "Kimi K2.5",
reasoning: false,
input: ["text", "image"],
cost: MOONSHOT_DEFAULT_COST,
cost: MOONSHOT_K2_5_COST,
contextWindow: MOONSHOT_DEFAULT_CONTEXT_WINDOW,
maxTokens: MOONSHOT_DEFAULT_MAX_TOKENS,
},