Set a monthly spend limit and an alert on every API account your agents use, with one key per agent, so a runaway task stops before it burns your budget.
Who it is for
Owners and builders running agents on pay-as-you-go API keys, especially for clients.
Tools
Claude Console and or OpenAI API platform
One project or workspace per agent
A note of what you can afford per month
Steps
List every agent and which API key it uses. Shared keys make one runaway task hit everything.
Create one project or workspace per agent and give each its own key.
Set a monthly spend limit. Anthropic says you can set your own limit below your tier cap on the Billing page in the Claude Console; OpenAI documents per-project spend limits and notification thresholds.
Set an alert at about half the limit so you hear before it stops.
Use the prompt below to write a short clause for client work on usage limits and who pays for overruns.
Check spend weekly for the first month and adjust.
The prompt
Write a short clause for my client agreement about AI usage costs. Plain English, under 120 words.
What I run for the client: [DESCRIPTION]
Monthly usage cap I set: [AMOUNT]
What happens at the cap: [e.g. the agent pauses and I notify the client]
Who pays above the cap, and only with written approval: [CLIENT OR ME]
Also list the 3 settings I should confirm before starting: spend limit, alert threshold, separate key. This is a draft for my lawyer to review, not legal advice.
Tips
One key per agent makes it obvious which one ran away.
An alert without a hard limit only tells you after the money is gone.
Retry loops are the usual culprit; limit retries in the agent too.