@mastra/core
Version:
19 lines • 985 B
TypeScript
import type { Mastra } from '../mastra/index.js';
export declare const USAGE_TELEMETRY_EVENT = "mastra_model_token_usage";
export interface SyncUsageTelemetryOptions {
/** Override the cursor file location (used by tests). */
cursorPath?: string;
/** Override the current time (used by tests). */
now?: Date;
}
/**
* Sends aggregated model token usage (input/output tokens per provider+model) to
* Mastra's anonymous telemetry when the project has observability metrics enabled.
*
* Sync strategy: deltas since the last successful sync, tracked per project via a
* cursor file in `~/.mastra/usage-telemetry.json`. Each event also carries lifetime
* totals so consumers can read either incremental or cumulative usage. Runs once at
* server startup; respects `MASTRA_TELEMETRY_DISABLED`. Never throws.
*/
export declare function syncUsageTelemetry(mastra: Mastra, options?: SyncUsageTelemetryOptions): Promise<void>;
//# sourceMappingURL=usage-telemetry.d.ts.map