Skip to main content

Set and manage API keys

Using API keys offers several benefits:

  • More models. Access a wider range of models from a bigger pool of AI providers than what is available without API keys.

  • More control. Monitor and manage your AI usage and costs directly on the AI provider's platform.

  • Improved privacy. We do not log inputs and outputs when you use a model with an API key. For more information, see our security and privacy FAQ.

  • Reduced costs. If you're on usage-based pricing, using an API key reduces costs. You pay the model usage fees directly to the AI provider, while paying a reduced service fee for GPT for Work.

If you're on a subscription plan, using an API key is mandatory since you do not have access to models without a key.

API key levels

API keys in GPT for Work can be set at two different levels:

  • For a specific user: When you set API keys for your own use, they work only for you. Only you have access to models associated with the keys, and only you can set and manage the keys.

  • For all space users: When you set API keys for your space, they work for all users in the space. Space users automatically have access to models associated with the keys, but only the space owner and admins can set and manage the keys. Billing for a space key reflects its usage by all space users. Learn more.

If keys are set at both levels for the same AI provider, the specific user key overrides the space key.

Create API keys

info

Make sure your keys belong to an organization or project with the following rate limits:

  • RPM (requests per minute) ≥ 1,000

  • TPM (tokens per minute) ≥ 1,000,000

The actual limits required depend on your workload requirements.

To create an API key, go to the AI provider's platform and follow their instructions:

Set your own API keys

tip

If you want to share an API key with your space users, set it at space level.

note

You must be the Creator, Editor, or Owner of the spreadsheet to set the API key.

  1. Open a Google spreadsheet.

  2. In the menu bar, select Extensions > GPT for Sheets and Docs > Open.

    Launch GPT for Sheets

  3. In the sidebar menu, select API keys.

  4. Enter your API key in the appropriate field and click Save.

    note

    If the AI provider already has a space API key set, you can override the key with your own API key by clicking Set your own and entering and saving your key.

You have set the API key. You can now use any model available with the key in GPT for Sheets.

Manage API keys

Check which level of API key you're using

You can check whether you're using your own API key or a space API key for a specific AI provider.

  1. In the sidebar menu, select API keys.

  2. Check the text in the AI provider's API key field:

    Field textWhat it meansExample

    Using space key

    You're using the space API key for the AI provider.

    xxxxx...

    You're using your own API key for the AI provider.

Switch to a space API key

Prerequisites
The space owner has set the space API key.

If you're currently using your own API key for an AI provider but want to switch to using the space API key for the same provider, delete the your own key from GPT for Work.

  1. In the sidebar menu, select API keys.

  2. Click Remove for the API key you want to delete.

  3. Click Remove API key to verify.

    The API key defaults to the space API key.

You're now using the space API key for the AI provider.

Switch to your own API key

If you're currently using the space API key for an AI provider but want to switch to using your own API key for the same provider, simply set the your own key in GPT for Work. A user key always overrides a space key.

Troubleshoot OpenAI API keys

You can use our API key checker to verify that your OpenAI API key is working.

  1. Open the OpenAI API key checker and click Use template.

    Google Sheets creates a copy of the spreadsheet in your Google drive and opens the spreadsheet for editing.

  2. Enter your OpenAI API key in cell B12.

The results show the status of your OpenAI API key and the models and Assistants available through the key.

API key tester

If your API key is not working, check on the OpenAI Platform that the key's permissions aren't restricted. The following permissions are required:

PermissionDescription
ModelsList available models.
Model capabilitiesUse model capabilities, such as chat completion.
AssistantsConnect OpenAI Assistants to Google Sheets or Microsoft Excel.
Fine-tuningConnect OpenAI fine-tuned models to Google Sheets or Microsoft Excel.
FilesUse OpenAI Assistants with file search.

What's next