Set Budget
metrx_set_budgetCreate or update an agent or org-wide spending budget in dollars with daily or monthly periods, warning thresholds, and alert-only or blocking enforcement, requiring an admin-scoped API key.
Instructions
Create or update a budget configuration for an agent or the entire organization. Enforcement modes: "alert_only" (notify, never block), "soft_block" (block with override) and "hard_block" (block). "soft_block" and "hard_block" act only on LLM calls routed through the Metrx gateway (proxy); calls reported by the SDK or OpenTelemetry are never blocked. They are unavailable while the gateway's Cloudflare settings for budget sync are unset: the server then refuses them with 409 ENFORCEMENT_UNAVAILABLE and only "alert_only" works. Specify limits in dollars. Needs an API key with the 'admin' scope (an org owner or admin mints one in Settings → Security → API Keys); any other key is refused with 403 — then make the change at https://app.metrxbot.com/settings/budgets. Do NOT use just to change enforcement mode — use update_budget_mode for that. Requires an API key with the 'admin' scope.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"period": "<period>",
"limit_dollars": "<limit_dollars>"
},
"name": "metrx_set_budget"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | Yes | Budget period | |
| agent_id | No | Agent to set budget for. Omit for org-wide budget. | |
| warning_pct | No | Percentage of limit that triggers a warning (default: 80) | |
| limit_dollars | Yes | Spending limit in dollars (e.g., 100 for $100/month) | |
| enforcement_mode | No | How to enforce the budget when exceeded. soft_block/hard_block: gateway traffic only; 409 ENFORCEMENT_UNAVAILABLE while gateway enforcement is not configured | alert_only |