Metronium

Documentation

API reference

Base URL https://api.metronium.xyz/v1. The surface is OpenAI-compatible, so an existing client needs no changes beyond the base URL and the key.

Endpoints

MethodPathAuthPurpose
GET/modelsnoneCatalogue and per-token pricing.
POST/chat/completionskeyRelay. Streaming and non-streaming.
GET/keykeyBalance, active grant policy, rate limits.
GET/auth/keykeyThe same, in OpenRouter's response shape.
GET/grantskeyGrants visible to this address, with remaining value.
GET/healthnoneGateway, database and indexer lag.

Response headers

HeaderMeaning
X-Metron-CostWhat this request cost, in USD. Absent on streamed responses, where the cost is not known until the last token.
X-Metron-RemainingValue left on the active grant. On a stream this is the figure the request started from.
X-Metron-Request-IdQuote this when reporting a problem. It is also the ledger reference.
X-Metron-Overhead-MsMilliseconds Metronium added, measured on this request, excluding the provider.
X-Metron-GrantThe grant id this request drew from.

Errors

Error bodies follow OpenAI's shape, so existing error handling keeps working.

{
  "error": {
    "message": "Grant 41 allows only anthropic/claude-sonnet-5.",
    "type": "invalid_request_error",
    "code": "model_not_allowed",
    "param": null
  }
}
StatusCodeWhen
401invalid_api_keyMissing header, bad signature, or a rotated epoch.
402insufficient_balanceThe grant cannot cover the worst case for this request.
402grant_expiredPast expiresAt. The remainder has returned to the grantor.
403model_not_allowedThe model is not in this grant's allowlist.
403grant_revokedThe grantor reclaimed the unactivated remainder.
429rate_cap_exceededratePerHour reached. Retry after the window moves.
429rate_limit_exceededRequests per minute exceeded for this key.
502upstream_errorThe provider failed. No value is charged when no tokens were produced.
503indexer_laggingChain state is too stale to serve safely. Nothing is charged.

What sits behind us

Requests are relayed through OpenRouter today. Direct provider contracts come later, once there is volume to negotiate with — so we are one hop behind a reseller, and we would rather say that than let you discover it. Our differentiator is the grant, not the hop count, and we do not advertise latency or uptime as an advantage.

One thing this buys you: upstream reports the real cost of every request, so what you are charged is that figure plus our spread. It is not derived from a price table we maintain and might get wrong.

Checking a budget

curl https://api.metronium.xyz/v1/key \
  -H "Authorization: Bearer $METRONIUM_API_KEY"

{
  "object": "key",
  "address": "0x71C…",
  "balance": { "currency": "USD", "available": "41.882300", "used": "8.117700" },
  "grant": {
    "id": 41,
    "models": ["anthropic/claude-sonnet-5"],
    "expires_at": "2026-09-23T00:00:00Z",
    "rate_per_hour": "5.000000",
    "rate_used_this_hour": "1.240000",
    "revocable": true
  },
  "rate_limit": { "requests_per_minute": 120 }
}

Money is always an exact decimal string. A charge lands after the response it pays for, so read this after a request to see what it cost.