mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 12:22:14 +03:00
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
58 lines
1.1 KiB
TypeScript
58 lines
1.1 KiB
TypeScript
/**
|
|
* Usage tracking types for API call monitoring and statistics.
|
|
*/
|
|
export interface UsageEntry {
|
|
id: string;
|
|
date: string;
|
|
provider: string;
|
|
model: string;
|
|
inputTokens: number;
|
|
outputTokens: number;
|
|
totalTokens: number;
|
|
latencyMs: number;
|
|
statusCode: number;
|
|
comboId?: string;
|
|
apiKeyId?: string;
|
|
}
|
|
|
|
export interface UsageStats {
|
|
totalCalls: number;
|
|
totalTokens: number;
|
|
totalInputTokens: number;
|
|
totalOutputTokens: number;
|
|
avgLatencyMs: number;
|
|
errorRate: number;
|
|
byProvider: Record<string, ProviderUsageStats>;
|
|
byModel: Record<string, ModelUsageStats>;
|
|
}
|
|
|
|
export interface ProviderUsageStats {
|
|
calls: number;
|
|
tokens: number;
|
|
errors: number;
|
|
avgLatencyMs: number;
|
|
}
|
|
|
|
export interface ModelUsageStats {
|
|
calls: number;
|
|
inputTokens: number;
|
|
outputTokens: number;
|
|
avgLatencyMs: number;
|
|
}
|
|
|
|
export interface CallLog {
|
|
id: string;
|
|
timestamp: string;
|
|
method: string;
|
|
path: string;
|
|
provider: string;
|
|
model: string;
|
|
statusCode: number;
|
|
latencyMs: number;
|
|
inputTokens: number;
|
|
outputTokens: number;
|
|
error?: string;
|
|
comboId?: string;
|
|
connectionId?: string;
|
|
}
|