This is a collection of guides and examples for the Gemini API, including quickstart tutorials for writing prompts and using different features of the API, and examples of things you can build.
NEW: Check out the latest Gemini 2.0 capabilities in the docs, Google AI Studio and here in the cookbook.
The Gemini API gives you access to Gemini models created by Google DeepMind. Gemini models are built from the ground up to be multimodal, so you can reason seamlessly across text, images, code, and audio. You can use these to develop a range of applications.
- Go to Google AI Studio.
- Log in with your Google account.
- Create an API key.
- Use a quickstart for Python, or call the REST API using curl.
We're excited to show you the latest additions to the Gemini API, and new notebooks.
- Gemini 2.0: Explore the capabilities of the new Gemini 2.0 model, including multimodal Live API, audio streaming applications with tool use and Spatial understanding.
Learn about the capabilities of the Gemini API by checking out these quickstart tutorials.
- Authentication: Start here to learn how you can set up your API key so you can get access to the Gemini API.
- Counting Tokens Tokens are the basic inputs to the Gemini models. Through this notebook, you will gain a better understanding of tokens through an interactive experience.
- Files: Use the Gemini API to upload files (text, code, images, audio, video) and write prompts using them.
- Audio: Learn how to use the Gemini API with audio files.
- JSON mode: Discover how to use JSON mode.
- Function Calling: The Gemini API works great with code. Use this quickstart to learn how to write prompts to understand and call functions. Then check out the function calling config tutorial to learn more.
- System Instructions: Give models additional context on how to respond by setting system instructions.
- Embeddings: Create high-quality and task-specific embeddings.
- Tuning: Learn how to improve model performance on a specific task through tuning.
- Code execution: Solve complex tasks by Generating and running Python code based on plain-text instructions.
You can find lots more in the quickstarts folder, and check out the examples folder for fun examples. We're also maintaining an Awesome Gemini list of all the cool projects the community is building using Gemini.
The Gemini API is a REST API. You can call the API using a command line tool like curl
(and you can find REST examples here), or by using one of our official SDKs:
Ask a question on the Google AI Developer Forum.
If you're an enterprise developer looking to build on a fully managed platform, you can also use the Gemini API on Google Cloud. Check out this repo for lots of cool examples.
Contributions are welcome. See contributing to learn more.
Thank you for developing with the Gemini API! We’re excited to see what you create.