Build with Meterly.
Everything you need to give an agent a balance, set its limits and read its record.
Quickstart
Meterly speaks the OpenAI API format, so most agents only need a new base URL and key. This takes about five minutes.
- Request access and create an agent in the dashboard. You get a key that starts with
mtr_live_. - Fund the balance with a card or USDC. Five dollars is enough to try everything here.
- Point your client at Meterly and make a call.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.meterly.cc/v1",
apiKey: process.env.METERLY_API_KEY,
});
const res = await client.chat.completions.create({
model: "meterly/auto",
messages: [{ role: "user", content: "Summarize this ticket" }],
});The response is a normal chat completion. Every call also returns a meterly-receipt-id header that points at its signed receipt.
Authentication
Send your key as a bearer token on every request. Each agent has its own key, so spending and receipts stay separate.
curl https://api.meterly.cc/v1/me \
-H "Authorization: Bearer $METERLY_API_KEY"Models and routing
Pass any model ID from the pricing page in the model field, or pass meterly/auto and let the router choose.
The router reads the request, estimates how hard it is and sends it to the cheapest model that has handled similar requests reliably. You can bound it:
{
"model": "meterly/auto",
"meterly": {
"min_tier": "general",
"max_cost_per_call": 0.05
},
"messages": [ ... ]
}Auto routing keeps 30% of what it saves against the top model and nothing when it routes to the top model. The picked model is returned in the model field of the response.
Spending limits
Limits are set by the account owner and can't be changed with an agent key. A call that would break a limit fails with 402 limit_exceeded and costs nothing.
| Limit | What it does |
|---|---|
daily_cap | Maximum total spend per UTC day. |
max_per_payment | Largest single charge, including tool payments. |
allowed_payees | Tools and agents this agent may pay. Empty means none. |
allowed_models | Models it may call. Empty means all. |
loop_breaker | Stops identical calls repeated more than N times in a minute. |
paused | Blocks every paid call until switched off. |
curl -X PUT https://api.meterly.cc/v1/agents/researcher-01/limits \
-H "Authorization: Bearer $METERLY_OWNER_KEY" \
-H "Content-Type: application/json" \
-d '{"daily_cap":10,"max_per_payment":0.5,"loop_breaker":20}'Funding
Every agent draws from its own balance. Top up from the dashboard or the API.
- Card or Apple Pay: $5 to $1,000 per top-up, 2.9% + $0.30.
- USDC: send to the agent's deposit address. Arrives in about a minute, no Meterly fee.
- Vault interest: interest on vault deposits is credited automatically.
Credits don't expire. Unused balance can leave as mCREDIT, with a fixed 2% cash-out fee.
Receipts and records
Each paid call produces a receipt with the agent ID, model or tool, token counts, cost and a timestamp. Prompts and replies are never part of it.
- Every call: the receipt is signed with Meterly's key.
- Every hour: a Merkle root of that hour's receipts is written onchain.
- Every day: a statement with totals is filed to the agent's ERC-8004 entry.
curl https://api.meterly.cc/v1/records/researcher-01Records are public by agent ID and need no key. An agent moves up the rungs (New, Active, Steady, Earning, Established) as it builds sealed history without disputes.
Selling a tool
Any HTTP API can be listed. Agents find it with find_tools and pay per call from their balance. Listing is free and Meterly keeps 1.5% of what you earn.
- Describe the endpoint, its inputs and its price per call.
- Meterly calls it on the agent's behalf and charges only when it returns a 2xx response.
- Earnings land on your balance and can be withdrawn or kept in the vault.
Errors
| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_key | The key is missing, wrong or rotated. |
| 402 | insufficient_balance | Top up the agent's balance and retry. |
| 402 | limit_exceeded | A spending limit blocked the call. Nothing was charged. |
| 429 | rate_limited | Too many requests. Wait for the retry-after header. |
| 502 | upstream_error | The model or tool failed. Paid tool calls are refunded. |