7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
fix(analytics): show the user's key label for custom providers in recent calls (#785) (#815)
suantea (asuan_suan)9c99ab7dd343
diff --git a/.gitignore b/.gitignoreindex 92b84aa6..ec7c9bb9 100644--- a/.gitignore+++ b/.gitignore@@ -15,6 +15,9 @@ server/data/.env.local.DS_Store+# TypeScript incremental build cache+*.tsbuildinfo+# Personal deployment scripts (contain keys/credentials — kept local)deploy-pi.shupdate-hermes.shdiff --git a/client/src/pages/AnalyticsPage.tsx b/client/src/pages/AnalyticsPage.tsxindex 7f1bf17d..2768d380 100644--- a/client/src/pages/AnalyticsPage.tsx+++ b/client/src/pages/AnalyticsPage.tsx@@ -160,6 +160,10 @@ interface RecentCallRow {clientIp: string | nullclientUserAgent: string | nullcreatedAt: string+ // #785: custom endpoints all share the generic 'custom' platform id; the+ // user's key label ("Ollama box") names the real provider. Null when the+ // key was deleted or never labelled.+ keyLabel: string | null// Failover-ladder length: attempts hang off the TERMINAL row of a proxied// request, so mid-ladder failure rows report 0.attemptCount: number@@ -852,7 +856,9 @@ export default function AnalyticsPage() {{r.modelId}{r.requestedModel && r.requestedModel !== r.modelId ? ' *' : ''}</TableCell>- <TableCell className="text-xs text-muted-foreground">{r.platform}</TableCell>+ <TableCell className="text-xs text-muted-foreground">+ {r.platform === 'custom' && r.keyLabel ? r.keyLabel : r.platform}+ </TableCell><TableCell className={`text-xs ${statusTextClass(r.status)}`} title={r.error ?? undefined}>{r.status}</TableCell>diff --git a/server/src/routes/analytics.ts b/server/src/routes/analytics.tsindex 178f9a23..85b36c7e 100644--- a/server/src/routes/analytics.ts+++ b/server/src/routes/analytics.ts@@ -522,26 +522,28 @@ analyticsRouter.get('/requests', (req: Request, res: Response) => {const db = getDb();const filterSql =- (status !== undefined ? ' AND status = ?' : '') +- (platform !== undefined ? ' AND platform = ?' : '');+ (status !== undefined ? ' AND r.status = ?' : '') ++ (platform !== undefined ? ' AND r.platform = ?' : '');const filterParams = [...(status !== undefined ? [status] : []),...(platform !== undefined ? [platform] : []),];const total = (db.prepare(- `SELECT COUNT(*) as c FROM requests WHERE created_at >= ?${filterSql}`+ `SELECT COUNT(*) as c FROM requests r WHERE r.created_at >= ?${filterSql}`).get(since, ...filterParams) as { c: number }).c;const rows = db.prepare(`- SELECT id, platform, model_id, requested_model, request_type, status,- input_tokens, output_tokens, latency_ms, error,- client_ip, client_user_agent, client_agent,- strftime('%Y-%m-%dT%H:%M:%SZ', created_at) as created_at_iso,- (SELECT COUNT(*) FROM request_attempts a WHERE a.request_id = requests.id) as attempt_count- FROM requests- WHERE created_at >= ?${filterSql}- ORDER BY created_at DESC, id DESC+ SELECT r.id, r.platform, r.model_id, r.requested_model, r.request_type, r.status,+ r.input_tokens, r.output_tokens, r.latency_ms, r.error,+ r.client_ip, r.client_user_agent, r.client_agent,+ strftime('%Y-%m-%dT%H:%M:%SZ', r.created_at) as created_at_iso,+ (SELECT COUNT(*) FROM request_attempts a WHERE a.request_id = r.id) as attempt_count,+ k.label as key_label+ FROM requests r+ LEFT JOIN api_keys k ON k.id = r.key_id+ WHERE r.created_at >= ?${filterSql}+ ORDER BY r.created_at DESC, r.id DESCLIMIT ? OFFSET ?`).all(since, ...filterParams, limit, offset) as any[];@@ -562,6 +564,11 @@ analyticsRouter.get('/requests', (req: Request, res: Response) => {clientUserAgent: r.client_user_agent,clientAgent: r.client_agent,createdAt: r.created_at_iso,+ // #785: custom endpoints all share the generic 'custom' platform id, so+ // the user's key label ("Ollama box") rides along to name the real+ // provider in the recent-calls list. Null when the key was deleted or+ // never labelled.+ keyLabel: r.key_label ?? null,// Failover-ladder length for this row. Attempts hang off the TERMINAL// row of a proxied request; mid-ladder failure rows report 0.attemptCount: r.attempt_count,