Monthly spend caps for AI coding agent runs

A monthly spend cap is a budget ceiling for agent runs; DevFlow checks it before every pipeline starts and applies a default of 100 USD to workspaces on managed inference.

Why a hard ceiling

Agents spend money on their own schedule. A loop that keeps retrying, an autopilot that picks up a burst of issues or a team trying a premium model can all run up a bill quickly. A cap turns a surprise into a clear failure message.

How DevFlow enforces the cap

Each workspace has an optional monthly_spend_cap_usd, set under Workspace Settings → Billing → Budgets. Before any pipeline launch, DevFlow sums the recorded cost of every agent run since the start of the calendar month and compares that sum with the cap.

If the total has reached the cap, the task fails before it runs. The failure reason names the amount used, the cap and where to raise it.

Chat is covered too

Team chat runs have no task, so their rows carry the workspace directly; without that, chat could slip past the budget. Team chat replies and the chat bridge's codebase exploration check the same cap before they start, and refuse with a message once the workspace is over it.

What counts

The total comes from the same agent_invocations rows the analytics use: every role and every model that reported a cost. Rows from earlier months drop out when a new calendar month begins.

Managed inference

A workspace using DevFlow's managed OpenRouter access gets a default ceiling even without an explicit one: MANAGED_INFERENCE_DEFAULT_CAP_USD, 100 US dollars unless the operator changes it. The provisioned sub-key carries its own hard limit too, as a second, independent ceiling, and the operator can clamp that limit with MANAGED_INFERENCE_MAX_CAP_USD.

The plan's included credit is not a ceiling. Usage past the credit is metered, never refused; only the cap stops work.

With your own keys and no cap set, DevFlow imposes no limit. Your provider account's own limits still apply.

In container mode

When agents run in containers, their model calls pass through a relay. Once the workspace is over its cap, the relay answers with HTTP 402 instead of forwarding the request.

Setting a useful value

Start from the recorded cost per merged change and the number of changes you expect in a month. Leave headroom for rework, then adjust after the first full month of data.

FAQ

Does a running task stop when DevFlow's monthly spend cap is hit?

DevFlow checks the cap before a pipeline starts. In container mode the model relay also refuses further calls once the workspace is over its cap.

Is there a spend cap if I use my own provider key in DevFlow?

Only if you set one. A workspace with its own keys and no explicit cap has no DevFlow spending limit; the provider account's own limits still apply.