Budget limits for the OpenAI Agents SDK

Last updated 24 November 2026

The OpenAI Agents SDK makes it easy to build agents that call tools and hand off to each other, which also makes it easy for one run to make many more model calls than planned. Xpenvo puts a hard limit in front of every call.

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. Give the SDK an Xpenvo client

import os
from openai import AsyncOpenAI
from agents import set_default_openai_client

set_default_openai_client(AsyncOpenAI(
    base_url="https://agents.xpenvo.com/v1",
    default_headers={"X-Xpenvo-Key": os.environ["XPENVO_KEY"]},
))

3. Per run and per customer

Add X-Xpenvo-Run with your own run id and X-Xpenvo-Customer with your own customer id (never an email address) to limit each run and each of your customers separately. Tool spending, such as search APIs, can be checked against the same budget with one call to /v1/xpenvo/spend.

Questions

Can I limit how much an OpenAI Agents SDK run spends?

Yes. Set the default OpenAI client to one whose base URL is Xpenvo Agents, add a run id header, and set a per-run limit on the budget.

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