请问HN:你们是如何防止人工智能编程助手浪费资金的?
我的代理重试的次数比应该的要多,这导致我的账单飙升。我试着找出原因,但没有一个工具能提供太多帮助。对我来说最糟糕的是,所有的使用情况都显示为汇总数据,包括总令牌数、总费用,可能还按模型分类。
于是我最终在OpenAI前面搭建了一个简单的层,每个请求都被强制携带一些上下文信息(代理、任务、用户、团队),然后记录和计算每次调用的费用,并设置一些基本的限制,这样如果出现异常情况就可以进行阻止。这是一个非常基础的实现,但仅仅看到“这个代理 + 这个任务 = 这个费用”就让我松了一口气。
它使用你自己的OpenAI密钥,因此在执行方面并没有做什么神奇的事情,只是进行观察和强制执行。
我想知道你们现在是如何处理这个问题的。你们只是关注汇总使用情况并信任它,还是已经建立了某种机制来按代理/任务进行细分?
如果有用的话,这里是我正在使用的粗略版本:https://authority.bhaviavelayudhan.com/
查看原文
My agents retry a bit more than it should, and there goes my bill up in the sky.
I tried figuring out what is causing this but none of the tools helped much.<p>and the worse thing for me is that everything shows up as aggregate usage. Total tokens, total cost, maybe per model.<p>So I ended up hacking together a thin layer in front of OpenAI where every request is forced to carry some context (agent, task, user, team), and then just logging and calculating cost per call and putting some basic limits on top so you can actually block something if it starts going off the rails.
It’s very barebones, but even just seeing “this agent + this task = this cost” was a big relief.<p>It uses your own OpenAI key, so it’s not doing anything magical on the execution side, just observing and enforcing.<p>I want to know you guys are dealing with this right now. Are you just watching aggregate usage and trusting it, or have you built something to break it down per agent / task?<p>If useful, here is the rough version I’m using : https://authority.bhaviavelayudhan.com/