/** * Token/cost meter (SRP): it ONLY meters. It computes cost via the pricing * module and appends one record via a sink. It never throws into the caller — * telemetry must not be able to break a real OpenAI call. * * Call sites depend on {@link recordUsage} alone (DIP) — not on the pricing * table or the sink implementation. */ import { type UsageSink } from "./sink.js"; /** One metered OpenAI call. */ export interface UsageEvent { /** Logical bucket: "chat" | "embedding" | "consolidation" | "transcription" … */ category: string; /** Model id as sent to the provider (drives pricing). */ model: string; /** Prompt/input tokens (chat, embeddings). */ promptTokens?: number; /** Completion/output tokens (chat). */ completionTokens?: number; /** Audio length in seconds (transcription). */ audioSeconds?: number; /** Originating thread, when known. */ threadId?: number; /** Epoch ms; stamped by {@link recordUsage}. */ timestamp: number; } /** Everything a caller supplies — the meter stamps {@link UsageEvent.timestamp}. */ export type UsageEventInput = Omit; /** * Record one usage event: compute its cost and append it via the sink. * Best-effort — wrapped in try/catch so it NEVER throws into the caller. */ export declare function recordUsage(event: UsageEventInput, sink?: UsageSink): void; //# sourceMappingURL=meter.d.ts.map