Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDBPath ¶
DefaultDBPath returns the default path for the usage database.
Types ¶
type UsageRecord ¶
type UsageRecord struct {
Provider string `json:"provider"`
Model string `json:"model"`
Date string `json:"date"`
Requests int64 `json:"requests"`
SuccessRequests int64 `json:"success_requests"`
ErrorRequests int64 `json:"error_requests"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
CacheCreationTokens int64 `json:"cache_creation_tokens"`
CacheReadTokens int64 `json:"cache_read_tokens"`
TotalTokens int64 `json:"total_tokens"`
}
UsageRecord represents a single usage data point.
type UsageStore ¶
type UsageStore struct {
// contains filtered or unexported fields
}
UsageStore provides async SQLite storage for usage statistics.
func NewUsageStore ¶
func NewUsageStore(dbPath string) (*UsageStore, error)
NewUsageStore creates a new UsageStore with the database at the given path.
func (*UsageStore) AsyncRecord ¶
func (s *UsageStore) AsyncRecord(record UsageRecord)
AsyncRecord queues a usage record for async writing.
func (*UsageStore) Close ¶
func (s *UsageStore) Close() error
Close stops the processing loop and closes the database.
func (*UsageStore) QueryUsage ¶
func (s *UsageStore) QueryUsage(provider, model, startDate, endDate string) ([]UsageRecord, error)
QueryUsage retrieves usage records with optional filters.
Click to show internal directories.
Click to hide internal directories.