- 01
Create a project and store your OpenAI key
One project is one budget. Name it after the app it protects, then add your OpenAI API key under Providers & models. The key is encrypted and only its last four characters are shown again.
- 02
Set a daily or monthly ceiling
Pick the limit in dollars, the timezone the period resets in, and the percent at which you want a warning email. With both a daily and a monthly ceiling, whichever would be crossed first applies.
- 03
Point the OpenAI SDK at Fuse
Create a Fuse key and swap two environment variables. The SDK, the model names and the request format stay the same.
app.tsimport OpenAI from "openai"; const client = new OpenAI({ baseURL: process.env.FUSE_BASE_URL, apiKey: process.env.FUSE_API_KEY, }); const res = await client.chat.completions.create({ model: "gpt-4.1-mini", messages: [{ role: "user", content: "Hello" }], }); - 04
Handle the 402
When the ceiling would be crossed, Fuse answers 402 with error fuse_blown, how much is spent, the limit, and when the period resets. Show a fallback or queue the work instead of retrying.
How to put a hard spending limit on the OpenAI API
Updated October 2026
An alert tells you about a bill after it happened. A hard limit refuses the request that would cause it. If a retry loop, a busy week, or a leaked key can spend money on your OpenAI account, you want the second one.
Fuse sits between your app and OpenAI. Your OpenAI key stays on a Fuse project with a dollar ceiling. Every request is priced at its worst case before it is sent; the one that could cross the ceiling gets HTTP 402 and is never forwarded.
Questions
Can spend go over the limit?
Fuse reserves each request's worst case (input tokens plus the output cap) before forwarding, so committed spend stays under the ceiling in normal operation. A provider counting a few more tokens than the estimate can cause small misses.
Does this replace OpenAI's own usage settings?
No. Keep whatever your OpenAI organization settings provide. Fuse adds a per-project and per-key stop in front of them that refuses the request before it is sent.
Which OpenAI endpoints work?
Chat completions, Responses and embeddings, including streaming and function tools.