← 返回价格对比

开放 API 文档

LLM Price Compare public API · 只读 JSON · 无需鉴权 · CORS 全开放 · 数据来源 OpenRouter,每日抓取(北京时间 04:17)并增量写入 Cloudflare D1。

接口列表

接口说明
GET /api/meta最近一次抓取时间、模型/报价/供应商数量、单位
GET /api/models?q=&vendor=&limit=&offset=搜索模型(模糊),返回每个模型各项最低价及对应供应商
GET /api/models/{id}单个模型详情 + 全部供应商报价(输入/输出/缓存读/缓存写、量化、上下文、最大输出、可用率、阶梯价)
GET /api/compare?ids=a,b,c并排对比,每个模型给出最便宜的供应商(按 workload 计算)
GET /api/cost?ids=..&input=&output=&cache_hit=费用估算:每个模型每个供应商的费用,从低到高
GET /api/rankings?period=weekOpenRouter 热门排行:week / day / month / trending
GET /api/history/{id}价格变动记录(旧值 → 新值)
GET /api/runs抓取任务记录(新增/变更/删除/未变)
GET /api/all网站使用的完整数据(较大)

示例

搜索

curl 'BASE/api/models?q=claude%20opus&limit=3&pretty'

模型详情(ID 含斜杠无需转义)

curl 'BASE/api/models/deepseek/deepseek-v4.1-flash'
curl 'BASE/api/models/gpt'          # 模糊匹配

对比

curl 'BASE/api/compare?ids=gpt,claude%20opus,deepseek'

费用估算

curl 'BASE/api/cost?ids=gpt,claude%20opus&input=10m&output=1m&cache_hit=0.6'

费用公式:input×(1−cache_hit)×输入价 + input×cache_hit×缓存读取价(无则用输入价) + output×输出价,未计入缓存写入、推理 token 单独计费、请求/图片附加费及长上下文阶梯价。

热门

curl 'BASE/api/rankings?period=week'

价格历史

curl 'BASE/api/history/openai/gpt-4o'

字段说明

cheapest.input 等该模型所有供应商中该项的最低价 {price, provider}
providers[]provider, tag, quantization, context_length, max_output, input, output, cache_read, cache_write, cache_write_1h, reasoning, request, image, web_search, tiers, uptime_1d, uptime_30m, status
variable_pricing路由类模型(如 openrouter/auto),价格随实际路由变化,无固定价
tiers长上下文阶梯价(min_prompt_tokens 以上适用)
hot_rank_weekOpenRouter 本周 token 用量排名(前 10)

命令行工具

Go CLI llmprice:llmprice search claude、llmprice compare gpt "claude opus" deepseek、llmprice cost gpt --input 10m --output 1m --cache-hit 0.5、llmprice top、llmprice history gpt-4o,加 --json 输出原始 JSON。

非 OpenRouter 官方服务。价格以 OpenRouter 实时为准。