Changeset 0.10.0 (#56)
This commit is contained in:
@@ -404,6 +404,62 @@ type AuditEntry struct {
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
}
|
||||
|
||||
// =========================================
|
||||
// USAGE TRACKING
|
||||
// =========================================
|
||||
|
||||
type UsageEntry struct {
|
||||
ID string `json:"id" db:"id"`
|
||||
ChannelID *string `json:"channel_id,omitempty" db:"channel_id"`
|
||||
UserID string `json:"user_id" db:"user_id"`
|
||||
ProviderConfigID *string `json:"provider_config_id,omitempty" db:"provider_config_id"`
|
||||
ProviderScope string `json:"provider_scope" db:"provider_scope"`
|
||||
ModelID string `json:"model_id" db:"model_id"`
|
||||
Role *string `json:"role,omitempty" db:"role"` // null=chat, "utility", "embedding"
|
||||
PromptTokens int `json:"prompt_tokens" db:"prompt_tokens"`
|
||||
CompletionTokens int `json:"completion_tokens" db:"completion_tokens"`
|
||||
CacheCreationTokens int `json:"cache_creation_tokens" db:"cache_creation_tokens"`
|
||||
CacheReadTokens int `json:"cache_read_tokens" db:"cache_read_tokens"`
|
||||
CostInput *float64 `json:"cost_input,omitempty" db:"cost_input"`
|
||||
CostOutput *float64 `json:"cost_output,omitempty" db:"cost_output"`
|
||||
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
||||
}
|
||||
|
||||
type UsageAggregate struct {
|
||||
GroupKey string `json:"group_key"`
|
||||
Label string `json:"label"`
|
||||
Requests int `json:"requests"`
|
||||
InputTokens int `json:"input_tokens"`
|
||||
OutputTokens int `json:"output_tokens"`
|
||||
TotalCost float64 `json:"total_cost"`
|
||||
}
|
||||
|
||||
type UsageTotals struct {
|
||||
Requests int `json:"requests"`
|
||||
InputTokens int `json:"input_tokens"`
|
||||
OutputTokens int `json:"output_tokens"`
|
||||
TotalCost float64 `json:"total_cost"`
|
||||
Period string `json:"period"`
|
||||
}
|
||||
|
||||
// =========================================
|
||||
// MODEL PRICING
|
||||
// =========================================
|
||||
|
||||
type PricingEntry struct {
|
||||
ID string `json:"id" db:"id"`
|
||||
ProviderConfigID string `json:"provider_config_id" db:"provider_config_id"`
|
||||
ModelID string `json:"model_id" db:"model_id"`
|
||||
InputPerM *float64 `json:"input_per_m" db:"input_per_m"`
|
||||
OutputPerM *float64 `json:"output_per_m" db:"output_per_m"`
|
||||
CacheCreatePerM *float64 `json:"cache_create_per_m" db:"cache_create_per_m"`
|
||||
CacheReadPerM *float64 `json:"cache_read_per_m" db:"cache_read_per_m"`
|
||||
Currency string `json:"currency" db:"currency"`
|
||||
Source string `json:"source" db:"source"` // "catalog" | "manual"
|
||||
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
||||
UpdatedBy *string `json:"updated_by,omitempty" db:"updated_by"`
|
||||
}
|
||||
|
||||
// =========================================
|
||||
// VIEW MODELS (computed, not stored)
|
||||
// =========================================
|
||||
|
||||
Reference in New Issue
Block a user