You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Is your feature request related to a problem? Please describe.
Currently, there is no built-in mechanism in opencode to stop the agent based on accrued costs. This poses a significant risk: if the agent enters a loop, hallucinates, or performs a very long task without supervision, it can rapidly drain API credits without the user noticing until it's too late.
Describe the solution you'd like
I would like to be able to set a hard monetary limit (e.g., "max cost per session").
This could be implemented via:
Configuration: A key in .opencode.json (e.g., "max_session_cost": 2.0).
Environment Variable: A standard variable like OPENCODE_MAX_COST=2.0 that sets a global cap for any session running in that environment.
Behavior: If the session cost exceeds this limit, the agent should immediately pause or terminate execution and prompt the user for confirmation to proceed.
Additional context
This is a crucial safety feature for autonomous agents to prevent "runaway" billing.
Other tools (like Kilo Code) already offer similar cost-control mechanisms to protect users.
Activity
rekram1-node commentedon Nov 20, 2025
Yeah that makes sense