Documentation
¶
Index ¶
- func NewService(ctx context.Context, logger log.ContextLogger, tag string, ...) (adapter.Service, error)
- func RegisterService(registry *boxService.Registry)
- type AggregatedUsage
- func (u *AggregatedUsage) AddUsage(model string, contextWindow int, messagesCount int, ...) error
- func (u *AggregatedUsage) AddUsageWithCycleHint(model string, contextWindow int, messagesCount int, ...) error
- func (u *AggregatedUsage) Load() error
- func (u *AggregatedUsage) Save() error
- func (u *AggregatedUsage) ToJSON() *AggregatedUsageJSON
- type AggregatedUsageJSON
- type CostCombination
- type CostCombinationJSON
- type CostsSummaryJSON
- type ModelPricing
- type Service
- type UsageStats
- type UsageStatsJSON
- type UserManager
- type WeeklyCycleHint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
func NewService(ctx context.Context, logger log.ContextLogger, tag string, options option.CCMServiceOptions) (adapter.Service, error)
func RegisterService ¶
func RegisterService(registry *boxService.Registry)
Types ¶
type AggregatedUsage ¶
type AggregatedUsage struct {
LastUpdated time.Time `json:"last_updated"`
Combinations []CostCombination `json:"combinations"`
// contains filtered or unexported fields
}
func (*AggregatedUsage) AddUsageWithCycleHint ¶
func (u *AggregatedUsage) AddUsageWithCycleHint( model string, contextWindow int, messagesCount int, inputTokens, outputTokens, cacheReadTokens, cacheCreationTokens, cacheCreation5MinuteTokens, cacheCreation1HourTokens int64, user string, observedAt time.Time, cycleHint *WeeklyCycleHint, ) error
func (*AggregatedUsage) Load ¶
func (u *AggregatedUsage) Load() error
func (*AggregatedUsage) Save ¶
func (u *AggregatedUsage) Save() error
func (*AggregatedUsage) ToJSON ¶
func (u *AggregatedUsage) ToJSON() *AggregatedUsageJSON
type AggregatedUsageJSON ¶
type AggregatedUsageJSON struct {
LastUpdated time.Time `json:"last_updated"`
Costs CostsSummaryJSON `json:"costs"`
Combinations []CostCombinationJSON `json:"combinations"`
}
type CostCombination ¶
type CostCombination struct {
Model string `json:"model"`
ContextWindow int `json:"context_window"`
WeekStartUnix int64 `json:"week_start_unix,omitempty"`
Total UsageStats `json:"total"`
ByUser map[string]UsageStats `json:"by_user"`
}
type CostCombinationJSON ¶
type CostCombinationJSON struct {
Model string `json:"model"`
ContextWindow int `json:"context_window"`
WeekStartUnix int64 `json:"week_start_unix,omitempty"`
Total UsageStatsJSON `json:"total"`
ByUser map[string]UsageStatsJSON `json:"by_user"`
}
type CostsSummaryJSON ¶
type ModelPricing ¶
type Service ¶
type Service struct {
boxService.Adapter
// contains filtered or unexported fields
}
type UsageStats ¶
type UsageStats struct {
RequestCount int `json:"request_count"`
MessagesCount int `json:"messages_count"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
CacheReadInputTokens int64 `json:"cache_read_input_tokens"`
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens"`
CacheCreation5MinuteInputTokens int64 `json:"cache_creation_5m_input_tokens,omitempty"`
CacheCreation1HourInputTokens int64 `json:"cache_creation_1h_input_tokens,omitempty"`
}
type UsageStatsJSON ¶
type UsageStatsJSON struct {
RequestCount int `json:"request_count"`
MessagesCount int `json:"messages_count"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
CacheReadInputTokens int64 `json:"cache_read_input_tokens"`
CacheCreationInputTokens int64 `json:"cache_creation_input_tokens"`
CacheCreation5MinuteInputTokens int64 `json:"cache_creation_5m_input_tokens,omitempty"`
CacheCreation1HourInputTokens int64 `json:"cache_creation_1h_input_tokens,omitempty"`
CostUSD float64 `json:"cost_usd"`
}
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
func (*UserManager) Authenticate ¶
func (m *UserManager) Authenticate(token string) (string, bool)
func (*UserManager) UpdateUsers ¶
func (m *UserManager) UpdateUsers(users []option.CCMUser)
type WeeklyCycleHint ¶
Click to show internal directories.
Click to hide internal directories.