Skip to main content

Metering

Both sides independently verify what was delivered. Token usage is estimated from HTTP content lengths and stream byte totals. Sellers generate EIP-191 signed receipts (using their secp256k1 identity key) after each request. Buyers independently verify receipts via ecrecover and flag disputes when estimates diverge.

Token Estimation

Provider-specific bytes-per-token ratios:

ProviderBytes/Token
anthropic4.2
openai4.0
google4.1
default4.0

For SSE streams, a factor of 0.82 is applied to account for framing overhead. Minimum thresholds: 100 tokens for requests, 10 tokens for responses.

Usage Receipts

receipt structure
{
"receiptId": "uuid-v4",
"sessionId": "session-uuid",
"eventId": "event-uuid",
"timestamp": 1708272000000,
"provider": "anthropic",
"sellerPeerId": "a1b2...40 hex (EVM address)",
"buyerPeerId": "c3d4...40 hex (EVM address)",
"tokens": {
"inputTokens": 1024,
"outputTokens": 512,
"totalTokens": 1536,
"method": "content-length",
"confidence": "high"
},
"unitPriceCentsPerThousandTokens": 300,
"costCents": 5,
"signature": "eip191...130 hex"
}

Cost Calculation

costUSD = (freshInputTokens * inputUsdPerMillion + cachedInputTokens * cachedInputUsdPerMillion + outputTokens * outputUsdPerMillion) / 1_000_000

cachedInputUsdPerMillion defaults to inputUsdPerMillion when not set by the seller. Non-zero usage always costs at least 1 cent. Zero tokens = zero cost.

Receipt Verification

Buyers verify the EIP-191 signature (recovering the seller's address via ecrecover) and compare token estimates. A dispute is flagged when the difference exceeds 15% or the signature is invalid. If their measurements diverge significantly, the transaction is disputed and the buyer is protected.