GVNR

GVNR

Budget Governor gives autonomous AI agents a hard spend limit. One budget_clear call before each LLM request checks the agent's envelope and deducts the estimated cost. Stops runaway billing before it starts. No self-hosting required.

Category
访问服务器

README

Gvnr

Substrate primitives for AI agents — spend caps, rate limits, idempotency, post-call reconciliation, human approval bridges. One MCP endpoint, one credit pool, no infrastructure to deploy.

Listed on the Official MCP Registry as dev.gvnr/gvnr.

No deployment. No proxy. No self-hosting.


The problem

Agents cost 10–12x more than estimated in production. System prompts, retry loops, and tool calls multiply fast. A runaway agent can generate a $47,000 bill in 11 days. The common fix — self-hosting LiteLLM — requires running infrastructure most developers won't set up.

Gvnr is the hosted alternative: an external authority your agent checks before spending.


How it works

  1. Your agent calls budget_clear (MCP tool or REST) before each LLM request
  2. The governor checks your account credit balance and the agent's spend envelope
  3. It returns { approved: true } or { approved: false, reason: "..." }
  4. If denied, your agent skips the call

The envelope is configured by you (per-agent daily or session cap). The credit balance is topped up via USDC on Base.


Quick start

1. Provision an account

curl -X POST https://gvnr.dev/v1/account
# { "api_key": "bg_...", "account_id": "..." }

2. Top up credits

Open the payment page for your chosen pack, pass your API key as a query param:

https://gvnr.dev/pay/starter?api_key=bg_YOUR_KEY

Send USDC on Base to the address shown, paste your tx hash — credits are added after on-chain verification.

Or, if you prefer the programmatic path — POST the tx hash directly:

curl -X POST \
  -H "Authorization: Bearer bg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tx_hash":"0x..."}' \
  https://gvnr.dev/v1/account/topup-verify/starter

3. Set a spend envelope for your agent

curl -X PUT \
  -H "Authorization: Bearer bg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"my-agent","limit_usd":5,"window":"daily"}' \
  https://gvnr.dev/v1/budget/envelope
# { "success": true, "agent_id": "my-agent", "limit_usd": 5, "window": "daily" }

4. Set a rate envelope per (agent, provider, model)

curl -X PUT \
  -H "Authorization: Bearer bg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"my-agent","provider":"anthropic","model":"claude-sonnet-4-6","requests_per_minute":30}' \
  https://gvnr.dev/v1/rate/envelope
# { "success": true, ... }

5. Before each LLM request: budget_clear then rate_check

curl -X POST \
  -H "Authorization: Bearer bg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"my-agent","model":"claude-sonnet-4-6","estimated_tokens":2000}' \
  https://gvnr.dev/v1/budget/clear
# { "approved": true, "remaining_usd": 4.994 }

curl -X POST \
  -H "Authorization: Bearer bg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"my-agent","provider":"anthropic","model":"claude-sonnet-4-6"}' \
  https://gvnr.dev/v1/rate/check
# { "allowed": true, "requests_remaining_this_minute": 29 }

6. (optional) Dedupe retries with idempotency_check

curl -X POST \
  -H "Authorization: Bearer bg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"key":"job-abc-123","ttl_seconds":3600}' \
  https://gvnr.dev/v1/idempotency/check
# First call:  { "is_first_call": true,  "ttl_remaining_seconds": 3600 }
# Replay:      { "is_first_call": false, "ttl_remaining_seconds": 3598 }

7. After the LLM responds, reconcile against actual usage

curl -X POST \
  -H "Authorization: Bearer bg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"my-agent","actual_input_tokens":1800,"actual_output_tokens":2400}' \
  https://gvnr.dev/v1/budget/reconcile
# { "ok": true, "drift_usd": 0.003, "remaining_usd": 4.991, "balance_usd": 9.991 }

reconcile is optional but keeps the envelope honest — Anthropic, OpenAI, and Gemini all return usage fields with the actual token counts; pass those in.


MCP setup

Add to Claude Desktop or any MCP-compatible client:

https://gvnr.dev/mcp?api_key=bg_YOUR_KEY

Claude Code

claude mcp add gvnr --transport http \
  "https://gvnr.dev/mcp?api_key=bg_YOUR_KEY"

MCP tools

Tool Description
budget_clear(agent_id, model, estimated_tokens) Check clearance and deduct estimated cost
set_envelope(agent_id, limit_usd, window?) Create or update an agent's spend envelope
get_balance() Get current account credit balance
reconcile(agent_id, actual_input_tokens, actual_output_tokens) Apply the drift between estimated and actual cost after the LLM responds
set_rate_envelope(agent_id, provider, model, requests_per_minute) Allocate a per-(agent, provider, model) rate share
rate_check(agent_id, provider, model) Approve or deny based on the rate envelope; returns retry_after_ms on denial
idempotency_check(key, ttl_seconds?) Dedupe retries on a caller-supplied key; returns is_first_call

REST API

All endpoints (except POST /v1/account) require Authorization: Bearer bg_YOUR_KEY.

Account

Method Path Description
POST /v1/account Provision account — returns api_key
GET /v1/account/balance Current credit balance
GET /v1/packs/:pack/info Public — pack details, USDC address, raw amount
POST /v1/account/topup-verify/:pack Submit tx hash → verify on-chain → credit account
POST /v1/account/topup/:pack x402-gated credit top-up (machine clients)

Budget

Method Path Description
POST /v1/budget/clear Clearance call — approve or deny
PUT /v1/budget/envelope Create or update agent envelope
GET /v1/budget/envelope/:agent_id Read envelope state

Clearance response

{ "approved": true, "remaining_usd": 4.994 }
{ "approved": false, "remaining_usd": 0, "reason": "envelope_exceeded" }

Denial reasons: no_credits · no_envelope · envelope_exceeded


Credit packs

Top up at GET /pay/:pack?api_key=bg_YOUR_KEY. Send USDC on Base mainnet — credits added after on-chain verification.

Pack Price Clearances Link
starter $19 ~10k/month /pay/starter
growth $39 ~30k/month /pay/growth
studio $79 ~100k/month /pay/studio

Envelope windows

  • daily — resets at UTC midnight each day
  • session — never resets (use for one-shot tasks)

Supported models

Model pricing is a static lookup on the hot path — no external calls. Includes claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5, gpt-4o, gpt-4o-mini, and others. Embedding models (text-embedding-3-small/large, gemini-embedding-001/2) are billed input-only — pass input tokens to budget_clear for those. Unknown models fall back to a conservative default.


Network

X402_NETWORK Chain Notes
eip155:84532 Base Sepolia Testnet — safe for development
eip155:8453 Base mainnet Real USDC

Current deployment: Base mainnet.


License

MIT — see LICENSE.

The canonical hosted service is at https://gvnr.dev. Self-hosted instances are unaffiliated.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选