# OpenAI Agents API session budgets: set a limit and handle pauses

Use spend_control in the OpenAI Agents API, interpret recorded cents, and handle budget pauses without accidentally starting a second turn.

By Paras Madan | 2026-11-24


A long-running agent can spend quite a bit more on one task than on the next. OpenAI's [Python SDK 3.58.0](https://github.com/openai/openai-python/releases/tag/v3.58.0) and [Node SDK 7.63.0](https://github.com/openai/openai-node/releases/tag/v7.63.0) shipped support for setting and reading individual Agents API session budgets on November 23. The setting gives your app a way to pause one costly session without treating every session in the project the same.

Use this as a per-task spending control, not a promise that the final bill can't exceed the amount you set. OpenAI says the reading can lag, already-started work can still incur charges, and work may continue if the service can't check spend.

## Set the budget when you create the session

The [session management guide](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#set-a-session-budget) shows `spend_control` on `POST /v1/agents/sessions`. The limit is a positive integer in **US cents**. In this illustrative request, 300 means $3, not $300:

```json
{
  "agent": {"model": "gpt-6.1-terra"},
  "environment": {"type": "none"},
  "input": "Return a three-item checklist for proofreading a short paragraph.",
  "spend_control": {"limit": 300}
}
```

Include the setting at creation if every new task needs one. If you omit it or set the object to `null`, the session starts with no session limit. This is a field on an Agents API session, not on an ordinary Responses API call.

## Read the two numbers separately

Retrieve the session with `GET /v1/agents/sessions/{session_id}`. In the [Agents API reference](https://developers.openai.com/api/reference/resources/beta/subresources/agents), `spend_control.limit` is the configured total, and `spend_control.consumed` is recorded spend rounded down to whole cents. A null consumption reading means unavailable, not zero. If both arrive null after you requested a budget, check whether the project supports the control rather than displaying a reassuring spend meter.

If you later post `{"spend_control":{"limit":500}}` to that session's URL, $5 is the new total. It doesn't add $5 or reset what's already recorded. For a session with exactly $2.10 recorded at that point, the arithmetic leaves $2.90 of headroom, subject to the measurement lag.

## Handle a budget pause without sending the task twice

The session can move to `budget_reached` and emit `agent.session.budget_reached`. New input is rejected once the pause is detected, and a turn stopped for this reason reports `session_budget_exceeded`. Treat this as a pause that needs a decision, not an ordinary error to retry.

If a user approves a higher total, update the existing session and follow its events. OpenAI says paused work can resume automatically. Submitting the original prompt again before checking could start redundant work. In staging, confirm the app can display the session ID, budget state and last known output without launching another session.

## Keep a separate project-level backstop

A session budget answers how much you intend to spend on one task. The [API Platform spend-limit controls](https://developers.openai.com/api/docs/guides/spend-limits) apply monthly across a project or organization. Those hard limits can also lag, but they're the separate control for stopping aggregate traffic. Before exposing a session limit to customers, decide how to handle unknown readings and who owns any increase. A number shown in your UI shouldn't imply more precision than the API gives you.

---

I'm Paras. I work at the intersection of AI, engineering and distribution.

I help AI teams turn new API features into technical guides that developers can put into practice.

[Book a 30-minute call](https://cal.com/paras-madan/30min)
