Skip to main content
Glama

AgentBill

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


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

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


安装

pip install agentbill-sdk

快速开始

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


为此仓库点赞

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

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
0dRelease cycle
2Releases (12mo)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/marketinglior-pixel/agentbill'

If you have feedback or need assistance with the MCP directory API, please join our Discord server