Just add very hard high limits and add instrumentation so you can track it and re-evaluate it accordingly. This takes a couple of hours maximum at best.
Ask HN: How are people forecasting AI API costs for agent workflows?
21–28 of 28 posts
Re: Ask HN: How are people forecasting AI API costs for agent workflows?
#22Re: Ask HN: How are people forecasting AI API costs for agent workflows?
#23this is exactly the problem we keep running into. the cost isn't just "how many tokens did this call use," its "how many tokens did this entire user action consume across all the agent loops, retries, tool calls, and embeddings." most observability tools show you the LLM call as one flat span. you can see it cost X tokens but you cant correlate it with the API request that triggered it, or see that the agent looped 4…
Re: Ask HN: How are people forecasting AI API costs for agent workflows?
#24The unpredictability is worse than the absolute cost. Our billing model broke several times not because costs were high, but because we couldn't bound them. One approach that helped: define a 'token budget' per user action at design time - cap total tokens per session and treat hitting the cap as a first-class outcome your product handles gracefully, not an error.
On the forecasting side, we track cost per workflow step rather than per request. Step-level cost is much more stable than request-level because it absorbs the variance in tool calls and retries. Once you have step costs, you can forecast by expected workflow composition.
On fixed subscription pricing for AI APIs - I'd actually pay a premium for that. The unpredictability creates a hidden cost: you over-provision margins and add complexity to your pricing tier design. A flat rate for a capacity bucket would eliminate both.
The question I'd ask about any such service: how do they handle the tail cases where agents go off-rails and rack up 10x normal token usage? That's where the cost risk actually lives.
Re: Ask HN: How are people forecasting AI API costs for agent workflows?
#25Just add very hard high limits and add instrumentation so you can track it and re-evaluate it accordingly. This takes a couple of hours maximum at best.
Sounds like a plan, But what if you can just pay a fixed cost every month and not worry about anything?
Re: Ask HN: How are people forecasting AI API costs for agent workflows?
#26We usually look at cost per workflow run, runs per active account, and the heavier paths separately, then keep retries and tool calls as their own line items. That makes the pricing side easier to reason about.