How to create a Gemini API key and set a spend cap

In short: create the key in Google AI Studio, turn on the paid tier for its project (never use the free tier with customer messages), and set a monthly spend cap. Gemini cannot be used in a service aimed at, or likely used by, people under 18.

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. Open the API keys page of Google AI Studio (aistudio.google.com/apikey), sign in with your Google account and accept the terms. A new user gets a default Google Cloud project and key.
  2. If you already use Google Cloud, AI Studio does not create a default project. Open the dashboard, go to Projects, select Import projects, choose your project and select Import.
  3. On the API Keys page, create a key in that project. If the create button is unavailable, you need permissions in the project: ask an administrator for a role such as Project Editor, or use a new project that is not tied to an organization.
  4. Copy the key and keep it in a safe place, such as a password manager. Anyone who has it spends your money.

Turn on the paid tier

  1. On the API keys or Projects page of AI Studio, select Set up billing under the Billing Tier column of your free tier project.
  2. Confirm your country and the terms, then enter contact and payment details. If you already have a billing account, pick it, or select Add new billing account. If AI Studio offers a choice, pick prepay or postpay.
  3. Why the paid tier: on the unpaid services Google can use prompts and responses to improve its products, and human reviewers may read them. On the paid services Google does not use them for that. Customer conversations must only go through a paid tier key.

Set a spend cap

  1. In AI Studio, open the Spend page.
  2. Select Monthly spend cap, then Edit spend cap, and enter the amount. You need the editor, owner or admin role on the project. Google marks this feature as experimental.
  3. The cap is a stop, but not an instant one: because of billing delay a project can go over it for about 10 minutes. For a stricter guard, also use the budget alerts of Google Cloud Billing, and on a prepaid account the requests fail when the balance reaches zero.

Restrictions to know before you choose Gemini

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 Google's own help: API keys, billing and spend caps and the Gemini API terms.

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