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
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:
OpenAI Platform for GPT models, fine-tuned models, and OpenAI Assistants
Anthropic Console for Claude models
DeepSeek Platform for DeepSeek models
Google AI Studio for Gemini models
Mistral AI for Mistral models
OpenRouter for access to various models from different AI providers using a single API key
Perplexity for Perplexity models
xAI Cloud Console for xAI models
Set your own API keys
If you want to share an API key with your space users, set it at space level.
G Sheets
MS Excel
MS Word
G Docs
You must be the Creator, Editor, or Owner of the spreadsheet to set the API key.
Open a Google spreadsheet.
In the menu bar, select Extensions > GPT for Sheets and Docs > Open.
In the sidebar menu, select API keys.
Enter your API key in the appropriate field and click Save.
noteIf 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.
Open a Microsoft Excel workbook.
In the Home tab, click GPT for Excel Word.
infoYou can also select Home > Add-ins > My Add-ins > GPT for Excel Word.
In the sidebar menu, select API keys & endpoints.
In the Your API keys tab, enter your API key in the appropriate field and click Save.
noteIf 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 Excel.
Open a Microsoft Word document.
In the Home tab, click GPT for Excel Word.
infoYou can also select Home > Add-ins > My Add-ins > GPT for Excel Word.
In the sidebar menu, select Manage API keys.
In the Your API keys tab, enter your API key in the appropriate field and click Save.
noteIf 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 Word.
You must be the Creator, Editor, or Owner of the document to set the API key.
Open a Google document.
In the menu bar, select Extensions > GPT for Sheets and Docs > Set API keys.
Enter your API key in the appropriate field and click Save key.
noteIf the AI provider already has a space API key set, you can override the key with your own API key by entering your key and clicking Save key.
You have set the API key. You can now use any model available with the key in GPT for Docs.
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.
G Sheets
MS Excel
MS Word
G Docs
In the sidebar menu, select API keys.
Check the text in the AI provider's API key field:
Field text What it means Example 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.
In the sidebar menu, select API keys & endpoints.
Check the text in the AI provider's API key field:
Field text What it means Example 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.
In the sidebar menu, select Manage API keys.
Check the text in the AI provider's API key field:
Field text What it means Example 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.
Select Extensions > GPT for Sheets and Docs > Set API keys.
Check the note above the AI provider's API key field.
Note What it means Example Using <AI provider> API key from your space.
You're using the space API key for the AI provider.
An <AI provider> API key is set.
You're using your own API key for the AI provider.
Switch to a space API key
Prerequisites
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.
G Sheets
MS Excel
MS Word
G Docs
In the sidebar menu, select API keys.
Click Remove for the API key you want to delete.
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.
In the sidebar menu, select API keys & endpoints.
Click Remove for the API key you want to delete.
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.
In the sidebar menu, select Manage API keys.
Click Remove for the API key you want to delete.
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.
Select Extensions > GPT for Sheets and Docs > Set API keys.
Click Clear key for the API key you want to delete.
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.
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.
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.

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:
Permission | Description |
---|---|
Models | List available models. |
Model capabilities | Use model capabilities, such as chat completion. |
Assistants | Connect OpenAI Assistants to Google Sheets or Microsoft Excel. |
Fine-tuning | Connect OpenAI fine-tuned models to Google Sheets or Microsoft Excel. |
Files | Use OpenAI Assistants with file search. |
What's next
Need to use your own LLM service endpoint for models?