kimbeomgyu
5 hours ago
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.