← back to Letsbegin
url-info: hook Gemini call into cost-tracker (best-effort)
7a38d3239116fc004fdbae078c5efdfc15a1e923 · 2026-05-13 08:36:28 -0700 · Steve
require()-based dynamic load with try/catch so Next.js Edge runtime falls
through cleanly if cost-tracker isn't present (e.g. on Kamatera deploy).
Pattern to replicate across the other 7 Gemini-using routes:
/api/prd/clarify, /api/prd/generate, /api/ralph/convert,
/api/claude/suggest, /api/processes/analyze, /api/processes/fix,
/api/projects/scan
Files touched
M app/api/url-info/route.ts
Diff
commit 7a38d3239116fc004fdbae078c5efdfc15a1e923
Author: Steve <steve@designerwallcoverings.com>
Date: Wed May 13 08:36:28 2026 -0700
url-info: hook Gemini call into cost-tracker (best-effort)
require()-based dynamic load with try/catch so Next.js Edge runtime falls
through cleanly if cost-tracker isn't present (e.g. on Kamatera deploy).
Pattern to replicate across the other 7 Gemini-using routes:
/api/prd/clarify, /api/prd/generate, /api/ralph/convert,
/api/claude/suggest, /api/processes/analyze, /api/processes/fix,
/api/projects/scan
---
app/api/url-info/route.ts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/api/url-info/route.ts b/app/api/url-info/route.ts
index 3686063..4c81f33 100644
--- a/app/api/url-info/route.ts
+++ b/app/api/url-info/route.ts
@@ -23,6 +23,12 @@ async function callGemini(prompt: string): Promise<string> {
}
const data = await response.json()
+ // Cost-tracker hook (best-effort; fail-soft in Next.js runtime).
+ try {
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const { logGemini } = require(require('os').homedir() + '/.claude/skills/cost-tracker/scripts/log-gemini.js')
+ logGemini(data, { app: 'letsbegin', note: 'url-info', model: 'gemini-2.0-flash' })
+ } catch {}
return data.candidates?.[0]?.content?.parts?.[0]?.text || ''
}
← 5987dec initial scaffold (gitify-all 2026-05-06)
·
back to Letsbegin
·
letsbegin: shared cost-tracker helper + hook 7 Gemini routes cecf2c3 →