Skip to main content

Usage Metering

Lucid uses OpenMeter for precise, real-time usage tracking across all API operations.

What’s Metered

MetricDescriptionBilling Impact
requestsTotal API requestsCounts toward plan limit
tokens_inInput tokens processedToken-based billing
tokens_outOutput tokens generatedToken-based billing
receiptsReceipts createdIncluded in plan
epochs_anchoredEpochs anchored on SolanaPer-epoch fee
tool_callsMCPGate tool invocationsPer-call fee on overage

View Usage

Via API

const usage = await lucid.usage.current();
console.log("Requests this month:", usage.requests);
console.log("Tokens used:", usage.tokensIn + usage.tokensOut);
console.log("Tool calls:", usage.toolCalls);
console.log("Cost so far:", `$${usage.costUsd.toFixed(2)}`);

Per-Model Breakdown

const breakdown = await lucid.usage.breakdown({
  groupBy: "model",
  since: "30d",
});

breakdown.forEach(entry => {
  console.log(`${entry.model}: ${entry.requests} requests, $${entry.costUsd}`);
});

Via Dashboard

View real-time usage at Dashboard → Settings → Usage:
  • Daily/weekly/monthly usage charts
  • Per-model cost breakdown
  • Token consumption trends
  • Comparison with plan limits

Alerts

Set up spending alerts to avoid unexpected costs:
await lucid.usage.setAlert({
  metric: "costUsd",
  threshold: 50.00,
  action: "email", // or "webhook"
});
Alerts trigger when the metric exceeds the threshold within the current billing period.

Export

Download usage data for accounting:
const csv = await lucid.usage.export({
  format: "csv",
  since: "2026-01-01",
  until: "2026-02-01",
});
Usage exports include per-request detail: timestamp, model, tokens in/out, cost, receipt ID.