Documentation
¶
Overview ¶
Package usage is a small persistent token-usage ledger: prompt/completion tokens spent, bucketed by day, provider, and model. It lets /usage show a history beyond the current session.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Date string `json:"date"` // YYYY-MM-DD
Provider string `json:"provider"`
Model string `json:"model"`
Prompt int `json:"prompt"`
Completion int `json:"completion"`
}
Entry is one (day, provider, model) bucket of token counts.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the ledger, persisted to a JSON file (in-memory if path is "").
func Open ¶
Open loads the ledger, or starts empty if the file is absent. A blank path yields an in-memory store that never persists.
func (*Store) Add ¶
Add folds tokens into the (date, provider, model) bucket. A no-op for a non-positive delta so a turn that reported no usage doesn't create a row.