I don't know how long the agent loop runs. Without a limit, the cost seemed likely to be higher than expected. Therefore, I decided to create a library to limit the cost. It's not complex as it blocks with purely simple code. I'm developing it little by little during my breaks. npm install budget-guard const ai = guard(openai.chat.completions, {project: 'app', dailyCapUSD: 50}); await ai.create({ model: 'gpt-5.6', messages }, { feature: 'summarize' }); The current default behavior is blocking. I'm wondering if it would be better to use warning messages and callback functions. Any feedback is appreciated.
Repository
kimbeomgyu/budget-guard
Budget Guard
A circuit breaker for your LLM API bill — hard budget caps + per-feature cost attribution for OpenAI & Anthropic.
3stars
kimbeomgyu/budget-guard
Budget Guard
Budget Guard: A circuit breaker library for LLM API bills that enforces a hard daily spending cap on OpenAI/Anthropic calls, with per-feature cost attribution.
Visit project- First shared
- Aug 19, 2026
- HN activity
- 11
Show HN@kimbeomgyuAug 19, 2026
Show HN: Budget Guard – a hard daily cap for your OpenAI/Anthropic bill
Community