fix(ai): correct Kimi K3 Moonshot pricing
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed Kimi K3 pricing metadata for Moonshot AI and Moonshot AI China.
|
||||||
- Fixed Kimi Coding K3 thinking-level metadata to expose only the supported `max` level ([#6737](https://github.com/earendil-works/pi/issues/6737)).
|
- Fixed Kimi Coding K3 thinking-level metadata to expose only the supported `max` level ([#6737](https://github.com/earendil-works/pi/issues/6737)).
|
||||||
- Fixed catalog generation restoring xAI models removed in 0.80.9 ([#6736](https://github.com/earendil-works/pi/issues/6736)).
|
- Fixed catalog generation restoring xAI models removed in 0.80.9 ([#6736](https://github.com/earendil-works/pi/issues/6736)).
|
||||||
|
|
||||||
|
|||||||
@@ -235,6 +235,12 @@ const KIMI_K3_THINKING_LEVEL_MAP = {
|
|||||||
max: "max",
|
max: "max",
|
||||||
} as const;
|
} as const;
|
||||||
const KIMI_K3_MAX_TOKENS = 131072;
|
const KIMI_K3_MAX_TOKENS = 131072;
|
||||||
|
const KIMI_K3_COST = {
|
||||||
|
input: 3,
|
||||||
|
output: 15,
|
||||||
|
cacheRead: 0.3,
|
||||||
|
cacheWrite: 0,
|
||||||
|
} as const;
|
||||||
const OPENROUTER_KIMI_K3_MODEL_IDS = new Set(["moonshotai/kimi-k3", "~moonshotai/kimi-latest"]);
|
const OPENROUTER_KIMI_K3_MODEL_IDS = new Set(["moonshotai/kimi-k3", "~moonshotai/kimi-latest"]);
|
||||||
|
|
||||||
const ANT_LING_RING_THINKING_LEVEL_MAP = {
|
const ANT_LING_RING_THINKING_LEVEL_MAP = {
|
||||||
@@ -1701,10 +1707,10 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
|||||||
...(isKimiK3 ? { thinkingLevelMap: KIMI_K3_THINKING_LEVEL_MAP } : {}),
|
...(isKimiK3 ? { thinkingLevelMap: KIMI_K3_THINKING_LEVEL_MAP } : {}),
|
||||||
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
||||||
cost: {
|
cost: {
|
||||||
input: m.cost?.input || 0,
|
input: m.cost?.input || (isKimiK3 ? KIMI_K3_COST.input : 0),
|
||||||
output: m.cost?.output || 0,
|
output: m.cost?.output || (isKimiK3 ? KIMI_K3_COST.output : 0),
|
||||||
cacheRead: m.cost?.cache_read || 0,
|
cacheRead: m.cost?.cache_read || (isKimiK3 ? KIMI_K3_COST.cacheRead : 0),
|
||||||
cacheWrite: m.cost?.cache_write || 0,
|
cacheWrite: m.cost?.cache_write || (isKimiK3 ? KIMI_K3_COST.cacheWrite : 0),
|
||||||
},
|
},
|
||||||
contextWindow: m.limit?.context || 4096,
|
contextWindow: m.limit?.context || 4096,
|
||||||
maxTokens: m.limit?.output || 4096,
|
maxTokens: m.limit?.output || 4096,
|
||||||
|
|||||||
@@ -179,9 +179,9 @@ export const MOONSHOTAI_CN_MODELS = {
|
|||||||
thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
|
thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
|
||||||
input: ["text", "image"],
|
input: ["text", "image"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0,
|
input: 3,
|
||||||
output: 0,
|
output: 15,
|
||||||
cacheRead: 0,
|
cacheRead: 0.3,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 1048576,
|
contextWindow: 1048576,
|
||||||
|
|||||||
@@ -179,9 +179,9 @@ export const MOONSHOTAI_MODELS = {
|
|||||||
thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
|
thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
|
||||||
input: ["text", "image"],
|
input: ["text", "image"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0,
|
input: 3,
|
||||||
output: 0,
|
output: 15,
|
||||||
cacheRead: 0,
|
cacheRead: 0.3,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 1048576,
|
contextWindow: 1048576,
|
||||||
|
|||||||
@@ -44,6 +44,18 @@ describe("builtin providers", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("uses official Kimi K3 pricing for Moonshot providers", () => {
|
||||||
|
const models = builtinModels();
|
||||||
|
for (const provider of ["moonshotai", "moonshotai-cn"]) {
|
||||||
|
expect(models.getModel(provider, "kimi-k3")?.cost).toEqual({
|
||||||
|
input: 3,
|
||||||
|
output: 15,
|
||||||
|
cacheRead: 0.3,
|
||||||
|
cacheWrite: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it("resolves anthropic auth from env with OAuth token precedence", async () => {
|
it("resolves anthropic auth from env with OAuth token precedence", async () => {
|
||||||
const models = createModels({
|
const models = createModels({
|
||||||
authContext: fakeAuthContext({ ANTHROPIC_API_KEY: "key", ANTHROPIC_OAUTH_TOKEN: "oauth-token" }),
|
authContext: fakeAuthContext({ ANTHROPIC_API_KEY: "key", ANTHROPIC_OAUTH_TOKEN: "oauth-token" }),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed inherited Kimi K3 pricing metadata for Moonshot AI and Moonshot AI China.
|
||||||
- Fixed inherited catalog generation restoring xAI models removed in 0.80.9 ([#6736](https://github.com/earendil-works/pi/issues/6736)).
|
- Fixed inherited catalog generation restoring xAI models removed in 0.80.9 ([#6736](https://github.com/earendil-works/pi/issues/6736)).
|
||||||
|
|
||||||
## [0.80.9] - 2026-07-16
|
## [0.80.9] - 2026-07-16
|
||||||
|
|||||||
Reference in New Issue
Block a user