summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrisheecho <[email protected]>2025-07-11 06:25:11 -0700
committerGitHub <[email protected]>2025-07-11 13:25:11 +0000
commite8fd2d6147a6527d852d85842bf250400ec93b49 (patch)
treee0f212a8f2e190783aae057c9413dee741195961
parenta634e03177353cc565110da5a3e70c91bf58a34b (diff)
Update authentication.md to show how to use API keys in GCP (#3042)
Co-authored-by: Pascal Birchler <[email protected]>
-rw-r--r--docs/cli/authentication.md25
1 files changed, 12 insertions, 13 deletions
diff --git a/docs/cli/authentication.md b/docs/cli/authentication.md
index a62284d0..41deb825 100644
--- a/docs/cli/authentication.md
+++ b/docs/cli/authentication.md
@@ -40,9 +40,19 @@ The Gemini CLI requires you to authenticate with Google's AI services. On initia
```
3. **Vertex AI:**
- - If not using express mode:
+ - Obtain your Google Cloud API key: [Get an API Key](https://cloud.google.com/vertex-ai/generative-ai/docs/start/api-keys?usertype=newuser)
+ - Set the `GOOGLE_API_KEY` environment variable. In the following methods, replace `YOUR_GOOGLE_API_KEY` with your Vertex AI API key:
+ - You can temporarily set these environment variables in your current shell session using the following commands:
+ ```bash
+ export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
+ ```
+ - For repeated use, you can add the environment variables to your [.env file](#persisting-environment-variables-with-env-files) or your shell's configuration file (like `~/.bashrc`, `~/.zshrc`, or `~/.profile`). For example, the following commands add the environment variables to a `~/.bashrc` file:
+ ```bash
+ echo 'export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"' >> ~/.bashrc
+ source ~/.bashrc
+ ```
+ - To use Application Default Credentials (ADC), use the following command:
- Ensure you have a Google Cloud project and have enabled the Vertex AI API.
- - Set up Application Default Credentials (ADC), using the following command:
```bash
gcloud auth application-default login
```
@@ -59,17 +69,6 @@ The Gemini CLI requires you to authenticate with Google's AI services. On initia
echo 'export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION"' >> ~/.bashrc
source ~/.bashrc
```
- - If using express mode:
- - Set the `GOOGLE_API_KEY` environment variable. In the following methods, replace `YOUR_GOOGLE_API_KEY` with your Vertex AI API key provided by express mode:
- - You can temporarily set these environment variables in your current shell session using the following commands:
- ```bash
- export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
- ```
- - For repeated use, you can add the environment variables to your [.env file](#persisting-environment-variables-with-env-files) or your shell's configuration file (like `~/.bashrc`, `~/.zshrc`, or `~/.profile`). For example, the following commands add the environment variables to a `~/.bashrc` file:
- ```bash
- echo 'export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"' >> ~/.bashrc
- source ~/.bashrc
- ```
4. **Cloud Shell:**
- This option is only available when running in a Google Cloud Shell environment.
- It automatically uses the credentials of the logged-in user in the Cloud Shell environment.