Register (or clear) the process-wide LLM usage observer.
Hosts typically call this once at app boot:
setGlobalLlmObserver((event) => { recordFoundationUsageEvent({ meterKey: event.source ?? 'llm.call', providerKey: event.provider, modelKey: event.model, quantity: event.usage.costUSD ?? 0, unit: 'usd', });}); Copy
setGlobalLlmObserver((event) => { recordFoundationUsageEvent({ meterKey: event.source ?? 'llm.call', providerKey: event.provider, modelKey: event.model, quantity: event.usage.costUSD ?? 0, unit: 'usd', });});
Passing null clears the observer (useful in tests).
null
While content-safe telemetry is on (enableContentSafeTelemetry), the observer is not called; read usage from the call's result instead.
enableContentSafeTelemetry
The observer callback, or null to clear.
Register (or clear) the process-wide LLM usage observer.
Hosts typically call this once at app boot:
Passing
nullclears the observer (useful in tests).While content-safe telemetry is on (
enableContentSafeTelemetry), the observer is not called; read usage from the call's result instead.