Files
OmniRoute/src/lib/usageDb.ts
diegosouzapw 71d14209a4 feat: OmniRoute v1.0.0 — Intelligent AI Gateway & Universal LLM Proxy
OmniRoute is an intelligent API gateway that unifies 20+ AI providers behind a single
OpenAI-compatible endpoint. Features include intelligent routing with 6 strategies,
multi-format translation (OpenAI/Claude/Gemini/Responses API), circuit breakers,
semantic caching, combo fallback chains, real-time health monitoring, and a full
dashboard with provider management, analytics, and CLI tool integration.

Key highlights:
- 20+ providers (Claude Code, Codex, Gemini CLI, GitHub Copilot, iFlow, Qwen, Kiro, etc.)
- 6 routing strategies (Fill First, Round Robin, P2C, Random, Least Used, Cost Optimized)
- Export/Import database backup with full archive support
- Translator Playground with 4 modes (Playground, Chat Tester, Test Bench, Live Monitor)
- 100% TypeScript across src/ and open-sse/
- Docker support with multi-stage builds
- Comprehensive documentation and 9 dashboard screenshots
2026-02-18 00:02:15 -03:00

40 lines
1.1 KiB
TypeScript

/**
* usageDb.js — Facade (T-15 decomposition)
*
* This file is now a thin re-export layer. All logic has been
* extracted into focused modules under `./usage/`:
*
* migrations.js — Legacy file + JSON→SQLite migration
* usageHistory.js — Usage tracking, request log, pending requests
* costCalculator.js — Cost calculation (pure function)
* usageStats.js — Aggregated stats for dashboard
* callLogs.js — Structured call log management
*
* Existing imports like `import { getUsageStats } from "@/lib/usageDb"`
* continue to work unchanged.
*/
// Trigger migrations on module load (side-effect)
import "./usage/migrations";
// Re-export everything for backward compatibility
export {
trackPendingRequest,
getUsageDb,
saveRequestUsage,
getUsageHistory,
appendRequestLog,
getRecentLogs,
} from "./usage/usageHistory";
export { calculateCost } from "./usage/costCalculator";
export { getUsageStats } from "./usage/usageStats";
export {
saveCallLog,
rotateCallLogs,
getCallLogs,
getCallLogById,
} from "./usage/callLogs";