@follow-app/client-sdk
Version:
TypeScript client SDK for Follow RSS Server API
45 lines (38 loc) • 1.56 kB
text/typescript
import type { aiTokens } from "@folo-services/drizzle"
// Analytics query parameters
export interface AnalyticsRequest {
days?: string // Number of days to analyze (1-365), defaults to "30"
}
// Usage pattern by operation type
export interface UsagePattern {
operationType: string // Type of AI operation (chat, summary, translation, etc.)
totalTokens: number // Total tokens used for this operation type
operationCount: number // Number of operations performed
percentage: number // Percentage of total usage
avgTokensPerOperation: number // Average tokens per operation
}
// Daily usage pattern
export interface DailyPattern {
date: string // Date in YYYY-MM-DD format
totalTokens: number // Total tokens used on this day
operationCount: number // Number of operations on this day
peakHour: number | null // Hour of day (0-23) with most usage
}
// Model usage pattern
export interface ModelPattern {
model: string // AI model name
totalTokens: number // Total tokens used with this model
operationCount: number // Number of operations with this model
percentage: number // Percentage of total usage
avgEfficiency: number // Average tokens per operation for this model
}
// Analytics response data
export interface AnalyticsData {
patterns: {
daily: DailyPattern[] // Daily usage patterns
byOperation: UsagePattern[] // Usage patterns by operation type
byModel: ModelPattern[] // Usage patterns by AI model
}
usageHistory: typeof aiTokens.$inferSelect[]
}
export type AnalyticsResponse = AnalyticsData