Skip to main content
Glama

AgentBill

基于使用量的 AI 智能体计费系统。预检。单次请求上限。无需 Stripe。


Stripe 只能告诉你花了多少钱。太晚了。 如果预算不足,AgentBill 会在运行开始前拦截它。

“当你把 Stripe 当作安全网时,你已经输掉了这场运行。” — scarlett1908, r/LangChain


安装

pip install agentbill-sdk

Related MCP server: agent-budget

快速开始

from agentbill import AgentBillClient

client = AgentBillClient(api_key="agb_your_key")

check = client.preflight(agent_id="researcher", budget=5.00) if not check.approved: raise Exception("Budget exceeded")

client.record(agent_id="researcher", cost=check.estimated_cost)

获取 API 密钥:https://agentbill.fly.dev/register


功能特点

预检。在智能体运行之前,AgentBill 会检查:该客户是否有足够的预算?如果没有,在消耗任何计算资源之前拦截它。

单次请求上限。月度上限无法捕捉单次糟糕的运行。一次 3 小时的研究循环可能会在触发上限之前就耗尽你的预算。AgentBill 在调用层面强制执行上限。

基于结果的计量。你定义什么算作可计费事件。不是字节,也不是秒数。而是智能体执行的业务级操作。


免费层级

每月 1,000 次预检调用。无需信用卡。


不具备的功能

  • 带有状态机或撤销逻辑的多步工作流(超出范围)

  • 替代你的支付处理器(AgentBill 位于其前端)

  • 面向非开发者的无代码仪表板


Node.js

npm install agentbill


为什么不用 Stripe

Stripe

AgentBill

预检拦截:否

是

单次请求上限:否

是

计算前拦截:否

是

为智能体构建:否

是


MCP 服务器

AgentBill 提供了一个 MCP 服务器,用于与 Claude Code、Cursor、Windsurf 以及任何兼容 MCP 的智能体宿主进行原生集成。

通过 agentbill-mcp on PyPI 安装:

uvx agentbill-mcp

该 MCP 服务器公开了两个工具:

  • preflight(agent_id, customer_id, estimated_units, ceiling) — 在运行前检查预算。如果耗尽则拦截。

  • record_event(agent_id, units, customer_id, metadata) — 在工作完成后计费。

在 ~/.claude/settings.json 中配置:

{
  "mcpServers": {
    "agentbill": {
      "command": "uvx",
      "args": ["agentbill-mcp"],
      "env": { "AGENTBILL_API_KEY": "sk_live_..." }
    }
  }
}

源码:mcp/ | PyPI: agentbill-mcp | MCP 注册表:io.github.marketinglior-pixel/agentbill-mcp


为此仓库点赞

如果单次请求上限正是你所需要的,请为此点赞。这有助于其他开发者发现它。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    • MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows

      https://mcp.flowra.dev/mcp
    • Veqen brings together work and coding agent costs per person and team, product inference costs per customer, agent spending, protection incidents, invoice checks, chargeback and the month-end close. Ask your assistant to investigate recorded spending, compare model prices, review provider keys and incidents, record bills and credits, or manage budgets, alerts, teams and spending policies. Your account role and plan govern access. Provider-key shut-off and agent-card controls require the appropriate role and provider permissions. Destructive actions require confirmation, and organizations can require a second person to approve a shut-off. SDK budget blocking is not a guaranteed spending cap. Work and coding agents are free for up to 3 people; product inference is free up to $1,000 in monthly AI spend. Connect your Veqen account for private organization data. The separate public model-price server needs no account. Estimates remain separate from provider invoices. Setup and permissions: https://veqen-app.com/docs/mcp

      https://veqen-app.com/mcp
    • Veqen brings together work and coding agent costs per person and team, product inference costs per customer, agent spending, protection incidents, invoice checks, chargeback and the month-end close. Ask your assistant to investigate recorded spending, compare model prices, review provider keys and incidents, record bills and credits, or manage budgets, alerts, teams and spending policies. Your account role and plan govern access. Provider-key shut-off and agent-card controls require the appropriate role and provider permissions. Destructive actions require confirmation, and organizations can require a second person to approve a shut-off. SDK budget blocking is not a guaranteed spending cap. Work and coding agents are free for up to 3 people; product inference is free up to $1,000 in monthly AI spend. Connect your Veqen account for private organization data. The separate public model-price server needs no account. Estimates remain separate from provider invoices. Setup and permissions: https://veqen-app.com/docs/mcp

      https://veqen-app.com/mcp
    • Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server for AgentPay — the payment gateway for autonomous AI agents. Fund a wallet once, give your agent the key, and it discovers, provisions, and pays for tool APIs on its own. One key, every tool.
      112 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Budget management and cost tracking MCP server for autonomous agents, enabling budget creation, cost recording, spending projections, and alert rules.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      MCP server that enables AI agents to request human approval before spending money, check approval status, verify signed tokens, and manage API keys.
      9
      MIT