mcpField
S
statlyte — live LLM pricing

statlyte — live LLM pricing

本地服务
statlyte.comAI 与智能体011 周前更新

关于 statlyte — live LLM pricing

statlyte 是一个 JavaScript 包和 MCP 服务,提供多个供应商公布的 LLM 价格、上下文窗口和模型 ID,面向开发者及 Agent。它支持查询最新数据、估算费用并检查已公告的价格变动。

主要功能

  1. 01查询模型 ID 和详情
  2. 02获取供应商公布的价格
  3. 03估算工作负载费用
  4. 04按成本对模型排序
  5. 05检查计划中的价格变动
  6. 06使用内置数据离线查询

适用场景

  1. 01估算某项工作负载的 API 费用
  2. 02比较应用使用的模型成本
  3. 03在构建时检查即将生效的涨价
  4. 04更新应用中的模型价格数据

MCP 相关

MCP 服务提供列出模型、获取价格、估算费用、查找适合工作负载的低成本选项,以及检查计划价格变动的工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"richardwilkinson9-statlyte": {
"command": "npx",
"args": [
"-y",
"statlyte"
]
}
}
}
启动命令npx -y statlyte

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npmstatlyte0.1.1

工具

5

收录的工具列表 · 更新于 3 周前

参数类型必填说明
providerstring否例如 anthropic、openai、google、mistral
includeRetiredboolean否包含已弃用和已停用的模型

详细介绍

statlyte

为所有主流 LLM API 提供实时价格、上下文窗口和标识符——让你不必再把过时的模型表硬编码到项目中。

任何调用 LLM 的应用,最终都会贴上类似这样的内容:

const PRICES = {
  'gpt-4o': { input: 2.5, output: 10 },
  'claude-3-5-sonnet': { input: 3, output: 15 },
  // …written once, wrong within a month
};

然后,某个模型退役了,新模型上线了,优惠价格到期了,你的成本仪表板却悄悄地开始撒谎。这个软件包会获取当前数据。

  • 涵盖 13 家提供商的 159 个模型——Anthropic、OpenAI、Google、xAI、DeepSeek、Mistral、Together AI、Voyage AI、Groq、Cohere、Fireworks AI、Deepgram、AssemblyAI
  • 每三小时从各厂商自行发布的定价页面读取数据,并记录来源 URL
  • **零依赖。**支持 Node、Bun、Deno、Cloudflare Workers 和浏览器
  • 内置快照回退,因此网络不稳定也不会影响请求
  • **MIT 许可。**数据免费,API 无需密钥
npm i statlyte

使用方法

import { getModel, costOf, rankByCost, scheduledChanges } from 'statlyte';

// What does this actually cost me?
await costOf('claude-sonnet-5', { input: 12_000, output: 800 });
// => 0.032

// Look up by statlyte id or the vendor's own API id
const m = await getModel('gpt-5-mini');
m.contextWindow;        // 400000
m.prices.input;         // 0.25  (USD per million tokens)
m.prices.cache_read;    // 0.025

// Cheapest model for a real monthly workload
const ranked = await rankByCost({ inputPerMonth: 620e6, outputPerMonth: 210e6 });
ranked[0].name;         // cheapest first
ranked[0].monthlyCost;  // USD/month

// Price rises vendors have already announced
await scheduledChanges();
// [{ name: 'Claude Sonnet 5', effectiveOn: '2026-09-01',
//    from: { input: 2, output: 10 }, to: { input: 3, output: 15 },
//    reason: 'Introductory pricing ends' }]

所有数据都会在进程内缓存六小时。向任意调用传入 { offline: true },即可只使用内置快照,完全不访问网络。

音频/转录模型(Deepgram、OpenAI Whisper/TTS)并非按 token 计价——它们使用 m.nonTokenPrice({ unit: 'per_minute' | 'per_million_characters', amount }),而且 m.prices 为 {}。如果你对其中一个模型调用 costOf(),它会抛出明确错误,而不是悄悄返回 0;请先检查 m.nonTokenPrice,或使用 m.prices.input != null 进行筛选。

当价格即将变动时,让构建失败

这是一个真正实用的技巧。scheduledChanges() 会返回厂商已宣布但尚未实施的涨价——这样你可以在构建时发现,而不是等到看到账单:

// scripts/check-model-costs.mjs
import { scheduledChanges } from 'statlyte';

const MODELS_WE_USE = ['anthropic/claude-sonnet-5', 'openai/gpt-5-mini'];
const soon = (await scheduledChanges())
  .filter((c) => MODELS_WE_USE.includes(c.id))
  .filter((c) => new Date(c.effectiveOn) - Date.now() < 60 * 86400_000);

if (soon.length) {
  console.error('Price change coming:');
  for (const c of soon) {
    console.error(`  ${c.name} on ${c.effectiveOn}: ` +
      `in $${c.from.input}→$${c.to.input}, out $${c.from.output}→$${c.to.output} per MTok`);
  }
  process.exit(1);
}

MCP 服务

助手的训练数据中,价格信息几周内就会过时,而猜测一个数字还不如不给数字。这个服务能为你的 Agent 提供当前数据:

claude mcp add statlyte -- npx -y statlyte
其他 MCP 客户端
{
  "mcpServers": {
    "statlyte": {
      "command": "npx",
      "args": ["-y", "statlyte"]
    }
  }
}

工具:list_models、get_model_pricing、estimate_cost、cheapest_for_workload、scheduled_price_changes。

也已列入官方 MCP Registry,名称为 io.github.richardwilkinson9/statlyte。

或者直接获取 JSON

无需安装,无需密钥,CORS 开放:

https://statlyte.com/api/v1/models
https://statlyte.com/api/v1/models/anthropic/claude-opus-5
https://statlyte.com/api/v1/changes

原始数据集也保存在此仓库的 models.json 和 changes.json 中,并通过提交更新——你可以对比差异、固定版本,或将其纳入自己的项目。

数据来源

每三小时运行一次任务,重新读取各提供商发布的定价页面。如果某个数值与文件中的上一个数值不同,任务就会写入一条带时间戳和来源 URL 的新记录。不会推断,也不会估算:未公开的价格不会列出。

有两点需要如实说明:

  1. **这些是公开标价。**协商价、企业价、区域价和承诺消费价可能有所不同,有时差异很大。作出商业决策前,请向厂商确认。
  2. **更便宜不代表可以替代。**这里记录的是模型的价格,而非它们的能力。rankByCost 会毫不犹豫地告诉你,8B 模型比前沿模型便宜。这只是算术,不是建议。

发现数据与厂商页面不符?厂商是对的,我们错了——请提交问题,我们会在下次运行时修正。

其他内容

statlyte.com 提供面向用户的功能:变更日志、可按你的用量对比两种模型的计算器,以及列出已宣布变更的日历。免费,无需账户。

采用 MIT 许可。欢迎注明出处,但并非必需。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。