@metera/sdk
v0.6.0
Published
Verified data for AI agents — every datum carries a verification block (level, source, cost, traceId)
Maintainers
Readme
@metera/sdk — verified data for AI agents
Metera answers questions from measured data feeds and returns the datum with
a verification block — level, source, cost, traceId. Your agent decides
programmatically whether to trust the value from level alone. When no source
measures the question, Metera says so instead of inventing an answer.
This is not another API proxy: the same datum from two sources only counts as
consensus when they are measured to be independent, and a value backed by an
on-chain truth is anchored. The level is the product.
Verification levels (read this first)
anchored— agreed with an on-chain / authoritative truth (e.g. a Pyth price). Highest trust.consensus— ≥3 independently measured providers agree. High trust; no single source can forge it.single_source— one provider, or providers not yet proven independent. Use it, but know it is unconfirmed.
Get a key at your Metera dashboard. mk_live_… charges credits; mk_test_…
returns a fixture with the same verification block, charges nothing, and calls
no paid source — integrate for free, flip the prefix to go live.
Path 1 — curl
curl https://api.metera.xyz/v1/ask \
-H "Authorization: Bearer $METERA_KEY" \
-H "content-type: application/json" \
-d '{"query":"SOL price"}'{
"status": "delivered",
"data": { "token": "SOL", "priceUsd": 172.46, "asOf": 1785761476113 },
"verification": { "level": "anchored", "source": "kraken", "cost": "0.0015", "traceId": "tr_dr29wv" }
}Direct canonical call (no LLM): POST /v1/get_data { "type": "token.price", "params": { "token": "BTC" } }.
Catalog: GET /v1/types → every type with its maxLevel and the capReason when it cannot exceed single_source.
Path 2 — SDK
npm install @metera/sdkimport { Metera } from '@metera/sdk'
const metera = new Metera(process.env.METERA_KEY)
const { data, verification } = await metera.ask('SOL price')
console.log(data.priceUsd, verification.level, verification.source)
// 172.46 anchored krakenverification is always present on a delivered answer. A non-delivered answer
(no source, refused below level, missing identifier) throws MeteraError — never
a fabricated value. Also: metera.getData(type, params) and metera.listTypes().
Path 3 — MCP (Claude Code, or any MCP client)
claude mcp add --transport http metera https://api.metera.xyz/mcp \
--header "Authorization: Bearer $METERA_KEY"Then ask your agent for "the SOL price via metera" — it calls the ask tool and
gets back the datum with its verification block. Tools: ask, get_data,
list_types. Every tool result carries the same verification block as the HTTP API.
Local development
Point any path at a local server with the base URL:
const metera = new Metera(process.env.METERA_KEY, { baseUrl: 'http://localhost:3001' })curl → http://localhost:3001/v1/ask; MCP → claude mcp add --transport http metera http://localhost:3001/mcp --header "Authorization: Bearer $METERA_KEY".
The hosted MCP is served from the main domain — https://api.metera.xyz/mcp — no separate host.
