Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultPricing = map[string]ModelPricing{
"claude-3-7-sonnet": {PromptPer1M: 3.00, CompletionPer1M: 15.00},
"claude-3-5-sonnet": {PromptPer1M: 3.00, CompletionPer1M: 15.00},
"claude-sonnet-4-5": {PromptPer1M: 3.00, CompletionPer1M: 15.00},
"claude-3-5-haiku": {PromptPer1M: 0.80, CompletionPer1M: 4.00},
"claude-haiku-4-5": {PromptPer1M: 0.80, CompletionPer1M: 4.00},
"claude-opus": {PromptPer1M: 15.00, CompletionPer1M: 75.00},
"gpt-4o": {PromptPer1M: 2.50, CompletionPer1M: 10.00},
"gpt-4o-mini": {PromptPer1M: 0.15, CompletionPer1M: 0.60},
"o1": {PromptPer1M: 15.00, CompletionPer1M: 60.00},
"o3": {PromptPer1M: 10.00, CompletionPer1M: 40.00},
"o3-mini": {PromptPer1M: 1.10, CompletionPer1M: 4.40},
"gemini-2.5-pro": {PromptPer1M: 1.25, CompletionPer1M: 5.00},
"gemini-3.1-pro": {PromptPer1M: 1.25, CompletionPer1M: 5.00},
"gemini-2.5-flash": {PromptPer1M: 0.075, CompletionPer1M: 0.30},
"gemini-3.8-flash": {PromptPer1M: 0.075, CompletionPer1M: 0.30},
"deepseek-chat": {PromptPer1M: 0.14, CompletionPer1M: 0.28},
"deepseek-reasoner": {PromptPer1M: 0.55, CompletionPer1M: 2.19},
}
View Source
var GlobalLedger = NewCostLedger(5000)
Functions ¶
This section is empty.
Types ¶
type CostLedger ¶ added in v0.4.0
type CostLedger struct {
// contains filtered or unexported fields
}
func NewCostLedger ¶ added in v0.4.0
func NewCostLedger(maxSize int) *CostLedger
func (*CostLedger) Record ¶ added in v0.4.0
func (l *CostLedger) Record(providerID, model string, promptToks, complToks int)
func (*CostLedger) Summary ¶ added in v0.4.0
func (l *CostLedger) Summary() LedgerSummary
type LedgerSummary ¶ added in v0.4.0
type LedgerSummary struct {
TotalRequests int64 `json:"total_requests"`
TotalTokens int64 `json:"total_tokens"`
TotalCostUSD float64 `json:"total_cost_usd"`
TotalSavedUSD float64 `json:"total_saved_usd"`
ModelDistribution map[string]int64 `json:"model_distribution"`
ProviderSpendUSD map[string]float64 `json:"provider_spend_usd"`
}
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
func NewLimiter ¶
func NewLimiter() *Limiter
type ModelPricing ¶ added in v0.4.0
type UsageRecord ¶ added in v0.4.0
type UsageRecord struct {
Timestamp time.Time `json:"timestamp"`
ProviderID string `json:"provider_id"`
Model string `json:"model"`
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
EstimatedCostUSD float64 `json:"estimated_cost_usd"`
IsFreeOrOAuth bool `json:"is_free_or_oauth"`
}
Click to show internal directories.
Click to hide internal directories.