Newshot
Account

Agents Burn Cash Repeatedly Calling Tools; OpenRouter's Four Gates Stop the Loop

AI summary

OpenRouter's tests show that when a tool such as an invoice API keeps timing out, an agent may retry the same call repeatedly, and each retry resends a longer conversation history, making calls increasingly expensive. Its Agent SDK adds four gates—blocking duplicate calls, normalizing parameters, limiting steps and cost per run, and capping total spend via API key quotas—to stop loops before bills spiral. In one demo, input grew from 131 to 3,262 tokens and per-turn cost nearly quadrupled; another with a step limit made 41 identical tool calls for $0.0309, while without a step limit the agent would not stop on its own, and the third identical call was blocked.

Translation(model translation, not the source's own text)

Agent repeatedly calls tools and burns money; OpenRouter’s four gates stop the loop

OpenRouter uses four gates to deal with an Agent repeatedly calling the same tool: identifying repeated calls, preventing tiny parameter changes from bypassing detection, limiting steps and cost per run, and using API key quota to cover total spending.

Cover image from OpenRouter: Announcements (RSS) (official article image)
Cover image from OpenRouter: Announcements (RSS) (official article image)
  • Failed retries resend the full conversation, pushing up per-round cost
  • Repetition detection can block identical calls based on consecutive count
  • loopKey can normalize parameter differences to identify variants
  • Beyond per-run limits, server-side key quota is also needed as a backstop

Official tutorial and product demo; testing was performed by OpenRouter; the figures in this article are internal experiment results and have not been independently retested by third parties.

The invoice endpoint keeps timing out, yet the Agent keeps retrying with the same invoice over and over; you see the call count rising, but it does not stop on its own. OpenRouter’s tests show that this kind of loop not only repeatedly consumes tool calls, but each round also carries a longer conversation history, making each call more expensive. It adds four gates to the Agent SDK: identify and block repeated calls, normalize parameters, limit steps and cost per run, and then use API key quota to guard total spending, with the goal of stopping the loop before the bill spirals out of control.

Why does the Agent

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by 听说了吗
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗