How to create an OpenAI API key and set a spend limit

In short: create the key on the API keys page of your OpenAI account, then set a monthly spend limit with Enforce a hard limit turned on, so the API stops when the cap is reached. Do it before you paste the key into ZapClaw.

ZapClaw Agents answers your WhatsApp with your own business information. The AI key is yours, so set its spend limit first.

About ZapClaw Agents

Create the key

  1. Sign in to the OpenAI API platform at platform.openai.com with the account that will pay for the usage.
  2. Open the API keys page in your account settings.
  3. Create a new key. For an application, OpenAI recommends a project service account over the key of one person. Name it so you know what it is for, for example ZapClaw Agents.
  4. Set an expiration date when you create a project key, and put it in your calendar to replace the key before then.
  5. Copy the key and keep it in a safe place, such as a password manager. Treat it like a password: anyone who has it spends your money. If you lose it, create another one.

Set a spend limit

  1. For the whole account, open Organization limits (platform.openai.com/settings/organization/limits). To cover only the project that holds this key, open the Project settings and select Limits.
  2. In Spend, select Edit spend limit and enter the Monthly spend limit.
  3. Turn on Enforce a hard limit and select Save. Without it the limit only notifies you; with it OpenAI stops the API traffic when the spend reaches the limit.
  4. Also add a spend alert at a lower amount. An alert only sends a notification and stays active next to the hard limit, so you hear about the spend before the stop.

Good to know

Then add the key to ZapClaw

In the ZapClaw dashboard, open the AI key screen of ZapClaw Agents and paste the key there. ZapClaw stores it encrypted. If the provider refuses a request because the key is invalid, out of credit or over its limit, ZapClaw tells the person in charge and the conversation goes to your team. Each provider has its own guide: OpenAI, Gemini and Anthropic.

Steps taken from OpenAI's own help: production best practices and spend limits.

Provider consoles change their labels from time to time. If a button reads differently, follow the provider page linked above.