ospalabs
Guide · CrewAI

What a CrewAI crew costs, and how to cap it

Updated November 2026

CrewAI's max_iter ends a task after a fixed number of iterations. The current docs default it to 20; some releases default it to 25. Either way it counts steps. A step that resends the whole crew conversation, plus tool output, can cost more than the next ten short ones. max_rpm limits how fast those steps go out. max_execution_time limits how long a task may run. None of them is a dollar amount.

The bill is the sum of the model calls. Give the crew an LLM whose base URL is Fuse, set max_tokens so each reservation is honest, and put a daily ceiling on that key. When the money is gone, the next call fails with 402 and the task stops.

  1. 01

    Keep max_iter, and know what it measures

    Set max_iter to the most steps a finished task needs. Leave it on. It is the backstop for a tool that never returns something the agent accepts. It will still spend max_iter times the cost of your largest step.

  2. 02

    Point the LLM at Fuse

    Pass a Fuse base URL and a Fuse key. The model string CrewAI sends has to be a model you turned on in the project. If the request log shows a prefixed id such as openai/gpt-4.1-mini, either send the bare id or add that exact string as a custom model with your prices.

    crew.py
    import os
    from crewai import Agent, LLM
    
    llm = LLM(
        model="gpt-4.1-mini",
        base_url="https://fuse.ospalabs.com/v1",
        api_key=os.environ["FUSE_API_KEY"],
        max_tokens=1024,
    )
    
    researcher = Agent(
        role="Researcher",
        goal="Answer the question in a few steps",
        backstory="Checks sources, then stops.",
        llm=llm,
        max_iter=8,
    )
  3. 03

    Cap the key, not the whole account

    Create one Fuse key for the crew and set a daily cap on it. Other apps on the same project keep their own keys. A crew that loops hits its cap and gets 402; the rest of the project keeps working.

  4. 04

    Read cost per run from the log

    CrewAI can print token counts for a run. Fuse adds the dollars, across every step, under that key. After a few real tasks, set the daily cap a little above the expensive ones.

Questions

Does max_iter cap the bill?
It caps the number of steps in one task. Ten steps against a long context can cost more than a hundred short calls. The dollar cap is the ceiling on the Fuse key.
Can I use OPENAI_BASE_URL instead?
Yes, for CrewAI's OpenAI integration. Set OPENAI_BASE_URL to https://fuse.ospalabs.com/v1 and OPENAI_API_KEY to the Fuse key. The model id still has to be enabled.