google · Google AI Docs
Using Gemini API keys
Instructions for obtaining and using API keys to authenticate requests with the Gemini API.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Using Gemini API keys
Instructions for obtaining and using API keys to authenticate requests with the Gemini API.
When To Use
Use when you need to generate credentials and configure authentication to make authorized calls to the Gemini API.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/gemini-api-using-keys-workflow-guide.md | A guide explaining how to create, manage, and configure API keys for the Gemini API using Google AI Studio and Google Cloud projects. | Questions about a guide explaining how to create, manage, and configure API keys for the Gemini API using Google AI Studio and Google... |
examples/gemini-api-using-keys-gemini-api-bashrc-environment-variable-setup.text | A text snippet demonstrating how to export a Gemini API key as an environment variable within a .bashrc file. | Exact payloads, commands, or snippets shown in A text snippet demonstrating how to export a Gemini API key as an environment variable within a .bashrc file. |
examples/gemini-api-using-keys-gemini-api-bashrc-environment-variable-setup-2.text | A shell command sequence for adding a Gemini API key to the .bashrc configuration file. | Exact payloads, commands, or snippets shown in A shell command sequence for adding a Gemini API key to the .bashrc configuration file. |
examples/gemini-api-using-keys-gemini-api-key-environment-variable-export.text | A text snippet demonstrating how to export the GEMINI_API_KEY environment variable in a terminal. | Exact payloads, commands, or snippets shown in A text snippet demonstrating how to export the GEMINIAPIKEY environment variable in a terminal. |
examples/gemini-api-using-keys-gemini-api-bashrc-environment-variable-setup-3.text | A shell command snippet demonstrating how to export a Gemini API key as an environment variable in a bash configuration file. | Exact payloads, commands, or snippets shown in A shell command snippet demonstrating how to export a Gemini API key as an environment variable in a bash configurati... |
examples/gemini-api-using-keys-gemini-api-zshrc-environment-variable-setup.text | A configuration snippet for adding a Gemini API key to the ~/.zshrc shell profile. | Exact payloads, commands, or snippets shown in A configuration snippet for adding a Gemini API key to the ~/.zshrc shell profile. |
examples/gemini-api-using-keys-gemini-api-key-environment-variable-setup-zshrc.text | Commands to create and open a .zshrc file to configure the Gemini API key as an environment variable. | Exact payloads, commands, or snippets shown in Commands to create and open a .zshrc file to configure the Gemini API key as an environment variable. |
examples/gemini-api-using-keys-gemini-api-key-zshrc-environment-variable-setup.text | A shell command snippet demonstrating how to export a Gemini API key as an environment variable in a zsh configuration file. | Exact payloads, commands, or snippets shown in A shell command snippet demonstrating how to export a Gemini API key as an environment variable in a zsh configuratio... |
examples/gemini-api-using-keys-gemini-api-python-client-initialization-with-api-k.text | A Python code snippet demonstrating how to initialize a Gemini API client using an API key to generate content. | Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to initialize a Gemini API client using an API key to generate content. |
examples/gemini-api-using-keys-gemini-api-nodejs-apikey-usage.text | A Node.js code example demonstrating how to initialize the GoogleGenAI client using an API key to generate content. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to initialize the GoogleGenAI client using an API key to generate content. |
examples/gemini-api-using-keys-gemini-api-golang-client-initialization-with-api-k.text | A Go program demonstrating how to initialize a Gemini API client using an API key to generate content. | Exact payloads, commands, or snippets shown in A Go program demonstrating how to initialize a Gemini API client using an API key to generate content. |
examples/gemini-api-using-keys-gemini-api-java-generate-with-api-key.text | A Java class demonstrating how to initialize a Gemini API client and generate text content using an API key. | Exact payloads, commands, or snippets shown in A Java class demonstrating how to initialize a Gemini API client and generate text content using an API key. |
examples/gemini-api-using-keys-gemini-api-curl-generatecontent-request.text | A curl command demonstrating how to make a POST request to the Gemini API using an API key in the header. | Exact payloads, commands, or snippets shown in A curl command demonstrating how to make a POST request to the Gemini API using an API key in the header. |
What This Skill Covers
- To use the Gemini API, you need an API key. This page outlines how to create and manage your keys in Google AI Studio as well as how to set up your environme...
- Main sections:
API Keys,Google Cloud projects,Default project,Import projects,Limitations.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://ai.google.dev/gemini-api/docs/api-key
