免费提示词
估算模型月度费用和分级路由
适合在给 AI 产品算账的人。你要提供:日请求量、字数和响应要求。
请根据我产品的预估日活请求量、每次对话平均输入输出字数与响应速度要求,帮我算出一笔精确的月度算力账,并设计一套「大小模型混合分级路由」省钱架构。
示例片段(ans-llm-cost.ts)
只是写法示意,不是完整程序。
// ANS 大模型月度 API 账单与缓存折扣精算器 (ans-llm-cost.ts)
export function estimateAnsMonthlyLlmCost(dailyReqs: number, inTokens: number, outTokens: number, inPricePerM: number, outPricePerM: number, cacheHitRatio = 0.5) {
const effectiveInPrice = inPricePerM * (1 - cacheHitRatio * 0.8);
const dailyUsd = (dailyReqs * (inTokens * effectiveInPrice + outTokens * outPricePerM)) / 1_000_000;
return { dailyUsd: +dailyUsd.toFixed(2), monthlyUsd: +(dailyUsd * 30).toFixed(2) };
}免费使用,可用于个人和商业项目。模型输出的内容由你自己核对。