Versions in this module Expand all Collapse all v0 v0.1.0 Jun 24, 2026 Changes in this version + func Record(ctx context.Context, k *togo.Kernel, userID, apiKeyID, model string, ...) + type APIKey struct + CreatedAt string + ID string + KeyHash string + LastUsedAt string + Name string + Prefix string + Quota int64 + RevokedAt string + Scopes string + UserID string + func KeyFromContext(ctx context.Context) (*APIKey, bool) + type Consumption struct + Cost float64 + Events int + InputTokens int64 + OutputTokens int64 + TotalTokens int64 + type Service struct + func (s *Service) Authenticate(ctx context.Context, plaintext string) (*APIKey, error) + func (s *Service) GenerateKey(ctx context.Context, userID, name, scopes string, quota int64) (APIKey, string, error) + func (s *Service) ListKeys(ctx context.Context, userID string) ([]APIKey, error) + func (s *Service) Middleware(next http.Handler) http.Handler + func (s *Service) RecordUsage(ctx context.Context, userID, apiKeyID, model string, inTok, outTok int64, ...) error + func (s *Service) RevokeKey(ctx context.Context, id string) error + func (s *Service) Summary(ctx context.Context, userID string) (Consumption, error) + func (s *Service) WithinQuota(ctx context.Context, key APIKey) (bool, error) + type UsageEvent struct + APIKeyID string + Cost float64 + CreatedAt string + ID string + InputTokens int64 + Model string + OutputTokens int64 + UserID string