Mastra launches Metrics API for token usage, cost and latency
Mastra introduced a Metrics API that lets developers query token usage, model cost, latency and error rates for production projects through the Mastra Client SDK, Mastra CLI or observability endpoints. The API supports totals, breakdowns, time series and percentile queries, combinable with time ranges and status filters, for custom reports, dashboards, downstream data pushes or alerts when model costs or error rates rise. According to the Mastra blog, queries require a platform access token and project ID plus the region-specific observability base URL (US and EU), with @mastra/client-js 1.9.0+ and mastra CLI 1.9.2+; Mastra also says the API can be paired with code mode so agents construct their own queries.
It gives Mastra Platform users programmatic access to cost, latency and error data, making it easier to feed dashboards, alerts and custom reports.