Vercel 开放账单用量与成本 API,并推出 Vantage 原生集成

1 分钟阅读
2026 年 2 月 19 日
Vercel 现已支持通过 API 和 CLI 以编程方式访问账单用量与成本数据。新的 /billing/charges 端点会以 FOCUS v1.3 开放标准格式 返回数据,让团队无需编写自定义转换逻辑,就能将成本数据接入 FinOps 工具。
该端点支持按 1 天粒度查询,最大日期范围为一年。为高效处理大规模数据集,响应采用按行分隔的 JSON(JSONL)流式返回。
SDK 用法
import { Vercel } from "@vercel/sdk";const vercel = new Vercel({ bearerToken: "<YOUR_BEARER_TOKEN_HERE>",});async function run() { const result = await vercel.billing.listBillingCharges({ from: "2025-01-01T00:00:00.000Z", to: "2025-01-31T00:00:00.000Z", teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l", slug: "my-team-url-slug", }); for await (const event of result) { // Handle the event console.log(event); }}run();
**curl** 用法
curl -N --request GET \ --url 'https://api.vercel.com/v1/billing/charges?teamId=<team>' \ --header 'Authorization: Bearer <token>' \ --header 'Accept-Encoding: gzip' \ --compressed
CLI 用法
用于快速查看时,vercel usage 命令可显示当前周期或自定义日期范围内的账单用量。这包括各项服务的 credit 使用情况与成本。
查看当前账单周期用量
vercel usage
查看自定义日期范围用量
vercel usage --from 2025-01-01 --to 2025-01-31
Vantage 也发布了一个原生集成,可将 Vercel 团队连接到 Vantage 账户。该集成会与其他工具的数据一起自动同步用量与成本数据,简化成本可观测性。详情可阅读 Vantage 公告博客。
原文链接:https://vercel.com/changelog/access-billing-usage-cost-data-api

