Agent Metering

io.github.jdhart81由 GitHub 账号 jdhart81 发布v0.2.0更新于 Nov 2, 2026

Usage metering + SLA accounting for agent services (the meter behind x402 micropayments).

发布方自己的服务:Energyai

已验证Streamable HTTP可网页运行金融数据与分析商业与电商

概览

AI 生成的概览

面向代理服务的远程 MCP 用量计量与 SLA 核算服务,提供计价计量表、用量事件、发票与哈希链校验。

可以做什么
  • 创建和列出计量表,设定计量单位与以最小货币单位计价的价格
  • 记录幂等的用量事件(含结果、消费方类别、渠道),并按条件筛选、分页读取
  • 按计量表汇总总量,并按小时或天生成时间序列及分桶明细
  • 生成 SLA 报告,对比成功率与目标值,并校验防篡改的事件哈希链
  • 将周期结算为不可变发票,以及将计量表标记或取消标记为测试/合成(管理员)
适用场景
适用于需要对代理间调用进行计费或核算的场景:统计调用次数或 token、跟踪成功率是否达到 SLA、把某段时间冻结成发票。更适合构建付费代理服务的团队,而非通用任务。
运行要求
通过 streamable HTTP 连接的远程 MCP 端点,无需安装软件包。默认使用托管服务,README 说明核心也可从代码仓库自行部署。管理员标记工具需要服务器的 VIRIDIS_ADMIN_TOKEN。托管版每个服务每天有 10 次调用的免费额度,支付、席位与 SLA 属于付费方案。
安装前请注意
记录用量和关闭周期会生成计费记录,已关闭的发票不可更改且需由托管结算代理处理,出错可能带来财务后果。管理员标记工具需要 VIRIDIS_ADMIN_TOKEN 这一高权限凭据。托管服务层(含支付、结算与客户数据)为专有,不在开源仓库中。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Agent Metering,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.jdhart81%2Fagent-metering/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "agent-metering": {
      "type": "http",
      "url": "https://mcp.viridisconservation.com/metering/mcp"
    }
  }
}

README

Viridis Agent Fleet: open-source agents for the agent economy

Deterministic, auditable MCP agents: trust and settlement rails (identity, trust, escrow, metering, arbitration, notary, surety, provenance, covenant, offsets, compute-ledger) and priced-grade services (tax credits, GHG accounting, construction takeoff, measurement, compliance). Every core is pure Python with no LLM in the serving path, and every result is content-addressed so anyone can re-verify it.

Licensed Apache-2.0. Run any agent yourself, fork it, embed it.

Run an agent locally (free, forever)

bash
pip install -r requirements-dev.txtpython3 agent-escrow-agent/adapters/mcp_server.py          # stdio MCPpython3 run_fleet_tests.py                                 # every agent's invariant tests

Or use the hosted fleet

https://mcp.viridisconservation.com runs all agents as one managed MCP service:

Self-hosted (this repo)Hosted by Viridis
Agent logic & verification✅ identical✅ identical
Viridis-signed receipts & notary chain–✅
Shared trust/reputation network data–✅
Maintained rule packs (tax, GHG factors, regs)snapshot✅ kept current
Payments (x402, card), seats, SLA–✅

Free tier: 10 calls/day per service; the rails (identity, escrow, metering…) are free forever. Verification is always free.

For agents

Agents and LLM tools can start from llms.txt, a generated index of every agent, and AGENTS.md, the rules for using and changing the fleet.

Part of the Viridis open-source commons

Building agents for conservation or energy work? VergeCommon and EnergyAI MCP also expose MCP tools, and ViridisOS serves its decision functions to agents over MCP.

This project is one of a connected set of open tools from Viridis. Each stands on its own; together they run from field evidence to checked decisions.

Conservation commons

Verifiable science

  • Viridis Canon: machine-checked Lean 4 mathematics for ecological decisions, with a DOI for every result
  • ViridisOS: open reference runtime for DOI-backed decision modules and recomputable results
  • Viridis Research: the nightly public research record, each claim labeled by what a verifier actually checked
  • ProofLens: see what a Lean statement means before reading the proof

Agent tools

  • Viridis Agent Fleet (this repository): open-source MCP agents with deterministic, auditable cores
  • EnergyAI MCP: energy-planning estimates and incentive sources for AI agents

Browse every project on the Viridis profile. If this one is useful to you, a star helps other people find it.

Boundary

This repo contains agent cores, MCP adapters, tests, standards and self-host tooling. The hosted service layer (gateway, payment and settlement, seats, signing authority, operations, telemetry and customer data) is proprietary and is not in this repo. Please don't open PRs that add it.

"Viridis", "Viridis Conservation" and the Viridis marks are trademarks of Viridis LLC; see TRADEMARKS.md.

来源:README.md,提交 350712c

工具

11

create_meter

Create a usage meter between a provider and a consumer agent. unit: what is being counted (call, token, kwh, ...). Price is in minor currency units (cents) per unit. Returns the meter_id.

输入参数unit必填consumer必填currencyprovider必填sla_targetprice_minor_per_unit必填

record_usage

Record a usage event. Idempotent on event_id (safe to retry — never double-billed). outcome is 'ok' or 'error' and feeds the SLA report.

输入参数outcomeevent_id必填metadatameter_id必填quantity必填

usage_summary

Totals for a meter: event count, total quantity, accrued minor units.

输入参数meter_id必填

sla_report

Pure SLA report: success_rate vs sla_target, breach flag. No mutation.

输入参数meter_id必填

close_period

Freeze all open events into an immutable invoice (exactly-once). The invoice amount is what agent-escrow-agent should settle.

输入参数meter_id必填

verify_chain

Verify the tamper-evident event hash chain for a meter.

输入参数meter_id必填

list_meters

List all meters with event/invoice counts.

无需输入参数。

list_events

Read usage events (paginated, read-only). Filter by meter, provider, consumer_class (internal|external|unknown), channel, outcome (ok|error), and ISO date range [since, until). Test-flagged events are excluded unless include_test=true. Returns events + next_cursor.

输入参数limitsinceuntilcursorchanneloutcomemeter_idproviderinclude_testconsumer_class

usage_timeseries

Usage time series bucketed on each event's recorded_at (UTC; bucket=day|hour), grouped across meters by provider — a real time-series primitive, independent of meter creation times. Includes per-bucket breakdowns by consumer_class / channel / provider. est_accrued_minor is an estimate; authoritative billing stays with usage_summary.

输入参数sinceuntilbucketchannelmeter_idproviderinclude_testconsumer_class

flag_meter

Admin: flag/unflag a meter as test/synthetic so its events are excluded from usage statistics by default. Touches meter metadata only — never events, never the hash chain, never billing accruals. Requires the server's VIRIDIS_ADMIN_TOKEN.

输入参数noteis_test必填meter_id必填admin_token必填

describe_agent

Fleet-standard self-description.

无需输入参数。

版本历史

1
  1. v0.2.0最新Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Energyaisolution 集成