Syntropy.LLMClient.UsageRecorder (syntropy v0.1.0)

Copy Markdown

In-memory per-run LLM usage summaries.

Provider usage is also emitted to logs, but this GenServer keeps in-flight run-level cost and token accounting available to /api/runs. Completed run envelopes include the summary so persistence can retain the final accounting.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

summary()

@type summary() :: map()

usage_event()

@type usage_event() :: map()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

record(event)

@spec record(usage_event()) :: :ok

reset()

@spec reset() :: :ok

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

summary(task_id)

@spec summary(String.t() | nil) :: summary() | nil