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 整合