ldrouter 1.18.2 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <meta name="color-scheme" content="light dark" />
8
8
  <title>LateDev Router</title>
9
- <script type="module" crossorigin src="/assets/index-DYrnLQwk.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-BdbskFHA.js"></script>
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-n9bGQMSj.css">
11
11
  </head>
12
12
  <body>
@@ -0,0 +1,60 @@
1
+ CREATE TABLE daily_model_stats (
2
+ day TEXT NOT NULL,
3
+ model_id TEXT NOT NULL DEFAULT '',
4
+ requests INTEGER NOT NULL DEFAULT 0,
5
+ successful_requests INTEGER NOT NULL DEFAULT 0,
6
+ failed_requests INTEGER NOT NULL DEFAULT 0,
7
+ input_tokens INTEGER NOT NULL DEFAULT 0,
8
+ output_tokens INTEGER NOT NULL DEFAULT 0,
9
+ cache_read_tokens INTEGER NOT NULL DEFAULT 0,
10
+ cache_write_tokens INTEGER NOT NULL DEFAULT 0,
11
+ reasoning_tokens INTEGER NOT NULL DEFAULT 0,
12
+ gateway_cache_hits INTEGER NOT NULL DEFAULT 0,
13
+ fallback_requests INTEGER NOT NULL DEFAULT 0,
14
+ latency_success_sum_ms INTEGER NOT NULL DEFAULT 0,
15
+ latency_success_count INTEGER NOT NULL DEFAULT 0,
16
+ ttft_sum_ms INTEGER NOT NULL DEFAULT 0,
17
+ ttft_count INTEGER NOT NULL DEFAULT 0,
18
+ PRIMARY KEY (day, model_id)
19
+ );
20
+ CREATE TABLE daily_provider_stats (
21
+ day TEXT NOT NULL,
22
+ provider_id TEXT NOT NULL,
23
+ attempts INTEGER NOT NULL DEFAULT 0,
24
+ successful_attempts INTEGER NOT NULL DEFAULT 0,
25
+ failed_attempts INTEGER NOT NULL DEFAULT 0,
26
+ input_tokens INTEGER NOT NULL DEFAULT 0,
27
+ output_tokens INTEGER NOT NULL DEFAULT 0,
28
+ cache_read_tokens INTEGER NOT NULL DEFAULT 0,
29
+ cache_write_tokens INTEGER NOT NULL DEFAULT 0,
30
+ reasoning_tokens INTEGER NOT NULL DEFAULT 0,
31
+ latency_success_sum_ms INTEGER NOT NULL DEFAULT 0,
32
+ latency_success_count INTEGER NOT NULL DEFAULT 0,
33
+ PRIMARY KEY (day, provider_id)
34
+ );
35
+ CREATE TABLE daily_api_key_stats (
36
+ day TEXT NOT NULL,
37
+ api_key_id TEXT NOT NULL DEFAULT '',
38
+ requests INTEGER NOT NULL DEFAULT 0,
39
+ successful_requests INTEGER NOT NULL DEFAULT 0,
40
+ failed_requests INTEGER NOT NULL DEFAULT 0,
41
+ input_tokens INTEGER NOT NULL DEFAULT 0,
42
+ output_tokens INTEGER NOT NULL DEFAULT 0,
43
+ total_tokens INTEGER NOT NULL DEFAULT 0,
44
+ PRIMARY KEY (day, api_key_id)
45
+ );
46
+ CREATE TABLE daily_stats_backfill_marker (id INTEGER PRIMARY KEY CHECK (id = 1), completed_at TEXT NOT NULL);
47
+ CREATE INDEX idx_daily_model_day ON daily_model_stats(day);
48
+ CREATE INDEX idx_daily_provider_day ON daily_provider_stats(day);
49
+ CREATE INDEX idx_daily_api_key_day ON daily_api_key_stats(day);
50
+
51
+ INSERT INTO daily_model_stats (day,model_id,requests,successful_requests,failed_requests,input_tokens,output_tokens,cache_read_tokens,cache_write_tokens,reasoning_tokens,gateway_cache_hits,fallback_requests,latency_success_sum_ms,latency_success_count,ttft_sum_ms,ttft_count)
52
+ SELECT substr(created_at,1,10), COALESCE(final_model_id,''), COUNT(*), SUM(success), COUNT(*)-SUM(success), SUM(input_tokens), SUM(output_tokens), SUM(cache_read_tokens), SUM(cache_write_tokens), SUM(reasoning_tokens), SUM(gateway_cache_hit), SUM(attempts_count > 1), SUM(CASE WHEN success=1 THEN total_latency_ms ELSE 0 END), SUM(success), SUM(CASE WHEN success=1 AND ttft_ms IS NOT NULL THEN ttft_ms ELSE 0 END), SUM(success AND ttft_ms IS NOT NULL)
53
+ FROM requests GROUP BY substr(created_at,1,10), final_model_id;
54
+ INSERT INTO daily_api_key_stats (day,api_key_id,requests,successful_requests,failed_requests,input_tokens,output_tokens,total_tokens)
55
+ SELECT substr(created_at,1,10), COALESCE(api_key_id,''), COUNT(*), SUM(success), COUNT(*)-SUM(success), SUM(input_tokens), SUM(output_tokens), SUM(total_tokens)
56
+ FROM requests GROUP BY substr(created_at,1,10), api_key_id;
57
+ INSERT INTO daily_provider_stats (day,provider_id,attempts,successful_attempts,failed_attempts,input_tokens,output_tokens,cache_read_tokens,cache_write_tokens,reasoning_tokens,latency_success_sum_ms,latency_success_count)
58
+ SELECT substr(a.started_at,1,10), a.provider_id, COUNT(*), SUM(a.success), COUNT(*)-SUM(a.success), SUM(a.input_tokens), SUM(a.output_tokens), SUM(a.cache_read_tokens), SUM(a.cache_write_tokens), SUM(a.reasoning_tokens), SUM(CASE WHEN a.success=1 THEN a.latency_ms ELSE 0 END), SUM(a.success)
59
+ FROM request_attempts a GROUP BY substr(a.started_at,1,10), a.provider_id;
60
+ INSERT INTO daily_stats_backfill_marker (id,completed_at) VALUES (1,strftime('%Y-%m-%dT%H:%M:%fZ','now'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ldrouter",
3
- "version": "1.18.2",
3
+ "version": "1.19.0",
4
4
  "description": "LateDev Router — lightweight self-hosted LLM gateway with admin UI",
5
5
  "type": "module",
6
6
  "license": "MIT",