ospalabs
Guide · Anthropic

How to cap Claude API spend

Updated October 2026

Long context windows make Claude requests vary a lot in price. One request can cost a hundred times another, which makes a flat request-per-minute limit a poor stand-in for a budget.

Fuse prices each request from its actual input and output cap before forwarding it, then holds that amount against the project's ceiling. When the money is gone, the next request gets 402 instead of reaching Anthropic.

  1. 01

    Add your Anthropic key to a Fuse project

    Under Providers & models, store the Anthropic key and switch on the Claude models the app may call. Models that are off are refused.

  2. 02

    Set the ceiling

    A monthly ceiling caps the bill; a daily one stops one bad day from using the month. Fuse warns by email at the percent you choose.

  3. 03

    Call Claude through the OpenAI-compatible endpoint

    Fuse speaks the OpenAI chat format. The model name decides which stored key goes out, so the same client can call Claude and GPT models.

    app.py
    import os
    from openai import OpenAI
    
    client = OpenAI(
        base_url=os.environ["FUSE_BASE_URL"],
        api_key=os.environ["FUSE_API_KEY"],
    )
    
    res = client.chat.completions.create(
        model="claude-sonnet-5-5",
        messages=[{"role": "user", "content": "Summarise this ticket"}],
        max_tokens=1024,
    )
  4. 04

    Keep max_tokens honest

    The reservation is input plus the output cap. A realistic max_tokens means a smaller hold, so more requests fit under the ceiling at once. Without one, the project default applies.

Questions

Do I need the Anthropic SDK?
No. Use any OpenAI-compatible client pointed at Fuse and pass a Claude model name.
Is my prompt stored?
No. Prompts pass through memory for the length of the request. The dashboard keeps metadata only: time, model, tokens, cost and status.