API 与开发者

免费、只读的 JSON 接口,提供实时的 LLM 与 GenAI 价格数据 —— 无需 API key,无需注册。

无需 API key · 无需注册

基础 URL

https://www.llmrates.ai

接口列表

列出并筛选模型及其当前价格,支持分页。

参数: provider, modality, minContext, maxInputPrice, hasCaching, hasBatch, sort, order, page, pageSize, currency

GET/api/models/{slug}

单个模型的完整信息,含近期价格变动和相关模型。同一 slug 可能有多个渠道在售,用 ?provider= 指定;不传则返回第一方渠道。

参数: provider

所有在用的供应商及其模型数量。

GET/api/providers/{slug}

单个供应商及其在用模型列表与代表价格。

通过稳定 id(sid)最多并排对比 5 个模型。

参数: models (comma-separated sids, max 5), currency

完整数据集导出——包含全部模型与供应商及所有价格档位。可加 ?type=models|providers 与 ?format=csv。

参数: type, format

面向 LLM 与 AI 智能体的纯文本目录摘要。

首页价格排行榜的 Markdown 版本——精选旗舰文本模型按综合价格排序,附方法说明与引用格式。

所有查询参数均为可选。

AI构建者摘要

每日汇总 AI 研究者、创始人与工程师的动态,提供结构化 JSON 和适合 LLM 直接读取的 markdown。与上面一样免鉴权、开启 CORS。

最新一期的 markdown —— 对 agent 而言这一个 URL 就是全部接口:取回、读取、完成。

参数: locale

最新一期已发布的摘要,结构化 JSON。

参数: locale

每条都带一个稳定 id,同时用作页面锚点和 RSS guid,所以同一个标识符在 JSON、markdown、HTML 和 feed 里通用。任意接口加 ?locale=:en(默认)、zh-Hans、zh-Hant、es、ja。

{
  "date": string,                 // YYYY-MM-DD (UTC)
  "locale": string,
  "intro": string,
  "item_count": number,
  "items": [
    {
      "id": string,               // stable; also the page anchor and RSS guid
      "date": string,
      "kind": "tweet" | "podcast" | "blog",
      "source": string,
      "author": string | null,
      "role": string | null,      // only when the source bio supports it
      "headline": string,
      "summary": string,
      "topics": string[],
      "url": string,
      "urls": string[],
      "permalink": string
    }
  ],
  "source": {                     // upstream attribution (MIT)
    "name": "follow-builders",
    "url": string,
    "author": "zarazhangrui",
    "license": "MIT"
  },
  "links": { "html": string, "markdown": string, "raw": string }
}

快速开始

curl "https://www.llmrates.ai/api/models?provider=openai&sort=inputPrice&order=asc"

Model 响应结构

{
  "models": [
    {
      "id": number,
      "name": string,
      "slug": string,
      "family": string | null,
      "contextWindow": number | null,
      "maxOutput": number | null,
      "supportsTools": boolean,
      "supportsBatch": boolean,
      "supportsCaching": boolean,
      "deprecatedAt": string | null,        // ISO 8601
      // providerType is the primary type; providerTypes lists every type the
      // provider belongs to (direct | aggregator | cloud | coding_tool).
      "provider": { "name": string, "slug": string, "providerType": string, "providerTypes": string[], "baseUrl": string | null },
      "modalities": string[],               // e.g. ["text", "image"]
      "price": PriceRow | null,             // headline price in the requested currency
      "prices": PriceRow[]                  // every tier / region
    }
  ],
  "pagination": { "page": number, "pageSize": number, "total": number, "totalPages": number }
}

// PriceRow (per 1M tokens unless the field name says otherwise)
{
  "inputPricePerMillion": number | null,
  "outputPricePerMillion": number | null,
  "cachedInputPricePerMillion": number | null,
  "processingTier": "standard" | "batch" | "fast" | "off_peak",
  "region": string | null,
  "priceUnit": string,                      // currency the row was sourced in
  "sourceUrl": string | null,
  "verifiedAt": string | null               // ISO 8601
}

缓存与时效

每个接口都经过边缘缓存并频繁刷新,因此响应数据可能有几分钟的延迟。每个响应都包含 Cache-Control 头。

免费使用

公开 API 对轻量使用、研究、原型、内部工具和开源项目免费开放。欢迎署名。

如需大流量使用、商业再分发、生产环境集成、SLA、历史数据或定制监控,请以获取商业方案。

需要定时拉全量?请改取 GitHub 上每日更新的 JSON 和 CSV。同一份数据,一个文件,而且完全不碰数据库。

不作担保

API 按现状提供,不对准确性、完整性或可用性作出担保。这里的每个价格都是厂商已发布内容的副本,可能过期,也可能被读错——拿它计费或做预算之前,请到厂商自己的页面确认。完整条款

署名

如果数据对你的项目有帮助,欢迎链接回 LLMRates.ai —— 这有助于数据持续开放与更新。

<a href="https://www.llmrates.ai" target="_blank" rel="noopener">
  LLM &amp; GenAI pricing data by LLMRates.ai
</a>

开放数据集

更想要文件而非 API?同样的数据每天以 JSON 与 CSV 形式发布在我们 GitHub 上的开放数据集中(CC BY 4.0)。