Budget limits for CrewAI agents

Last updated 24 November 2026

A CrewAI crew can pass work between agents many times, and every hand-off is more model calls. Max iterations count steps, not dollars. With Xpenvo, each crew or agent gets a hard dollar limit that is checked before every model call, and a crew stuck repeating itself is paused.

1. Make a budget and a key

Create a free account, make a budget (for example $20 a day) and an agent key for it under Agent keys. The key starts with xpv_ and is shown once. You keep your own provider key and keep paying your provider directly; Xpenvo never stores it.

2. Point the crew’s LLM at Xpenvo

CrewAI’s LLM takes a base URL and an API key. Put your agent key, a colon, then your provider key in the API key: Xpenvo splits them, keeps nothing, and sends only your provider key on.

import os
from crewai import Agent, LLM

llm = LLM(
    model="openai/gpt-5-mini",
    base_url="https://agents.xpenvo.com/v1",
    api_key=f"{os.environ['XPENVO_KEY']}:{os.environ['OPENAI_API_KEY']}",
)

researcher = Agent(role="Researcher", goal="...", backstory="...", llm=llm)

For Claude, use model="anthropic/claude-sonnet-5-5", base_url="https://agents.xpenvo.com" (without /v1) and your Anthropic key after the colon. With OpenAI models you can instead keep your plain OpenAI key and pass default_headers={"X-Xpenvo-Key": …}, which also lets you add a run id.

3. One limit per crew, run or customer

Give each crew its own agent key and budget, so one crew can never use up another’s money. To limit each run, add an X-Xpenvo-Run header with your own run id (OpenAI models, through default_headers) and set a per-run limit on the budget. When a limit is reached, the call is refused before it reaches the provider, so it is never billed, and CrewAI sees a normal model error with the reason.

Questions

How do I set a spending limit on a CrewAI crew?

Point the crew’s LLM at Xpenvo Agents: set base_url to the Xpenvo address and the API key to your agent key and provider key joined by a colon. The agent key belongs to a budget with a hard dollar limit, checked before every call.

Does it work with Claude in CrewAI?

Yes. Use an anthropic/ model, the Xpenvo address without /v1 as base_url, and your agent key and Anthropic key joined by a colon as the API key.

More: full setup guide · model prices · tested guarantees · security. Questions? [email protected]