fix(ai): show implied Kimi Coding subscription costs
This commit is contained in:
@@ -241,6 +241,15 @@ const KIMI_K3_COST = {
|
||||
cacheRead: 0.3,
|
||||
cacheWrite: 0,
|
||||
} as const;
|
||||
// Kimi Coding is subscription-backed, so models.dev reports zero cost. Use the
|
||||
// equivalent Moonshot API rates to estimate the value of subscription usage.
|
||||
const KIMI_CODING_IMPLIED_COSTS: Record<string, Model<Api>["cost"]> = {
|
||||
k2p7: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
|
||||
k3: KIMI_K3_COST,
|
||||
"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 },
|
||||
};
|
||||
const OPENROUTER_KIMI_K3_MODEL_IDS = new Set(["moonshotai/kimi-k3", "~moonshotai/kimi-latest"]);
|
||||
|
||||
const ANT_LING_RING_THINKING_LEVEL_MAP = {
|
||||
@@ -1642,6 +1651,7 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
||||
const normalizedName = kimiAliases.has(modelId) ? "Kimi For Coding" : m.name || normalizedId;
|
||||
const isKimiK3 = normalizedId === "k3";
|
||||
const allowEmptySignature = isKimiK3 || normalizedId === "kimi-for-coding";
|
||||
const impliedCost = KIMI_CODING_IMPLIED_COSTS[normalizedId];
|
||||
|
||||
models.push({
|
||||
id: normalizedId,
|
||||
@@ -1659,10 +1669,10 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
|
||||
...(isKimiK3 ? { thinkingLevelMap: KIMI_K3_THINKING_LEVEL_MAP } : {}),
|
||||
input: m.modalities?.input?.includes("image") ? ["text", "image"] : ["text"],
|
||||
cost: {
|
||||
input: m.cost?.input || 0,
|
||||
output: m.cost?.output || 0,
|
||||
cacheRead: m.cost?.cache_read || 0,
|
||||
cacheWrite: m.cost?.cache_write || 0,
|
||||
input: m.cost?.input || impliedCost?.input || 0,
|
||||
output: m.cost?.output || impliedCost?.output || 0,
|
||||
cacheRead: m.cost?.cache_read || impliedCost?.cacheRead || 0,
|
||||
cacheWrite: m.cost?.cache_write || impliedCost?.cacheWrite || 0,
|
||||
},
|
||||
contextWindow: m.limit?.context || 4096,
|
||||
maxTokens: m.limit?.output || 4096,
|
||||
|
||||
Reference in New Issue
Block a user