Documentation
¶
Index ¶
- Variables
- type AdminAPI
- type BillingDailyUsage
- type ClaudeTokenRefresher
- type ClaudeUsagePoller
- type DailyUsage
- type OAuthStarter
- type Op
- type PinStore
- type PricingService
- type Queue
- type QueueOption
- type Recorder
- func (r *Recorder) RecordRequest(rec ingress.UsageRecord)
- func (r *Recorder) SetClaudePool(p *broker.ClaudePool)
- func (r *Recorder) Today() DailyUsage
- func (r *Recorder) TodayByAccount() map[string]DailyUsage
- func (r *Recorder) TodayByAccountBilling() map[string]map[string]BillingDailyUsage
- func (r *Recorder) TodayByKey() map[string]DailyUsage
- func (r *Recorder) TodayByKeyBilling() map[string]map[string]BillingDailyUsage
- type RefreshFunc
- type TokenRefresher
- type WhamPoller
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPinExpired = errors.New("pin: expired")
View Source
var ErrQueueClosed = errors.New("persist: queue closed")
Functions ¶
This section is empty.
Types ¶
type AdminAPI ¶
type AdminAPI struct {
Pool *broker.Pool
ClaudePool *broker.ClaudePool
KeyPool *broker.APIKeyPool
Recorder *Recorder
Refresher *TokenRefresher
ClaudeRefresher *ClaudeTokenRefresher
Pricing PricingService
Queue *Queue
Token string
OAuthStart OAuthStarter
ClaudeOAuthStart OAuthStarter
}
type BillingDailyUsage ¶
type BillingDailyUsage struct {
DailyUsage
Model string `json:"model,omitempty"`
ServiceTier string `json:"service_tier,omitempty"`
}
type ClaudeTokenRefresher ¶
func (*ClaudeTokenRefresher) RefreshClaudeToken ¶
func (t *ClaudeTokenRefresher) RefreshClaudeToken(ctx context.Context, acc *broker.ClaudeAccount) error
type ClaudeUsagePoller ¶
type ClaudeUsagePoller struct {
Pool *broker.ClaudePool
Refresher *ClaudeTokenRefresher
Queue *Queue
Interval time.Duration
Logger *slog.Logger
// contains filtered or unexported fields
}
func (*ClaudeUsagePoller) Start ¶
func (p *ClaudeUsagePoller) Start(parent context.Context)
func (*ClaudeUsagePoller) Stop ¶
func (p *ClaudeUsagePoller) Stop()
type DailyUsage ¶
type DailyUsage struct {
Date string `json:"date"`
Requests int64 `json:"requests"`
InputTokens int64 `json:"input_tokens"`
CachedTokens int64 `json:"cached_tokens,omitempty"`
OutputTokens int64 `json:"output_tokens"`
TotalTokens int64 `json:"total_tokens"`
TotalCost float64 `json:"total_cost"`
Errors int64 `json:"errors"`
Unpriced int64 `json:"unpriced,omitempty"`
}
type PricingService ¶
type QueueOption ¶
type QueueOption func(*Queue)
func WithBatchSize ¶
func WithBatchSize(n int) QueueOption
func WithMaxWait ¶
func WithMaxWait(d time.Duration) QueueOption
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
func (*Recorder) RecordRequest ¶
func (r *Recorder) RecordRequest(rec ingress.UsageRecord)
func (*Recorder) SetClaudePool ¶
func (r *Recorder) SetClaudePool(p *broker.ClaudePool)
func (*Recorder) Today ¶
func (r *Recorder) Today() DailyUsage
func (*Recorder) TodayByAccount ¶
func (r *Recorder) TodayByAccount() map[string]DailyUsage
func (*Recorder) TodayByAccountBilling ¶
func (r *Recorder) TodayByAccountBilling() map[string]map[string]BillingDailyUsage
func (*Recorder) TodayByKey ¶
func (r *Recorder) TodayByKey() map[string]DailyUsage
func (*Recorder) TodayByKeyBilling ¶
func (r *Recorder) TodayByKeyBilling() map[string]map[string]BillingDailyUsage
type RefreshFunc ¶
type TokenRefresher ¶
func (*TokenRefresher) RefreshToken ¶
type WhamPoller ¶
type WhamPoller struct {
Pool *broker.Pool
Client *provider.ChatGPTClient
Refresher *TokenRefresher
Interval time.Duration
Logger *slog.Logger
// contains filtered or unexported fields
}
func (*WhamPoller) Start ¶
func (p *WhamPoller) Start(parent context.Context)
func (*WhamPoller) Stop ¶
func (p *WhamPoller) Stop()
Click to show internal directories.
Click to hide internal directories.