Description
# [Deprecated] Google AI Python SDK for the Gemini API With Gemini 2.0, we took the chance to create a single unified SDK for all developers who want to use Google's GenAI models (Gemini, Veo, Imagen, etc). As part of that process, we took all of the feedback from this SDK and what developers like about other SDKs in the ecosystem to create the [Google Gen AI SDK](https://github.com/googleapis/python-genai). The full migration guide from the old SDK to new SDK is available in the [Gemini API docs](https://ai.google.dev/gemini-api/docs/migrate). The Gemini API docs are fully updated to show examples of the new Google Gen AI SDK. We know how disruptive an SDK change can be and don't take this change lightly, but our goal is to create an extremely simple and clear path for developers to build with our models so it felt necessary to make this change. Thank you for building with Gemini and [let us know](https://discuss.ai.google.dev/c/gemini-api/4) if you need any help! **Please be advised that this repository is now considered legacy.** For the latest features, performance improvements, and active development, we strongly recommend migrating to the official **[Google Generative AI SDK for Python](https://github.com/googleapis/python-genai)**. **Support Plan for this Repository:** * **Limited Maintenance:** Development is now restricted to **critical bug fixes only**. No new features will be added. * **Purpose:** This limited support aims to provide stability for users while they transition to the new SDK. * **End-of-Life Date:** All support for this repository ended permanently on **November 30, 2025**. We encourage all users to begin planning their migration to the [Google Generative AI SDK](https://github.com/googleapis/python-genai) to ensure continued access to the latest capabilities and support. <!-- [START update] # With Gemini 2 we're launching a new SDK. See the following doc for details. # https://ai.google.dev/gemini-api/docs/migrate [END update] -->
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 0.8.6 | Imported from PyPI (0.8.6) | Low | 4/21/2026 |
| v0.8.6 | ## What's Changed Add a warning message on import telling people that this package is archived. **Full Changelog**: https://github.com/google-gemini/deprecated-generative-ai-python/compare/v0.8.5...v0.8.6 | Low | 12/16/2025 |
| v0.8.5 | ## What's Changed ### Bugfixes * Several bug fixes by @MarkDaoust in https://github.com/google-gemini/deprecated-generative-ai-python/pull/731 * Fix broken samples (all samples pass now). * Fix empty `GEMINI_API_KEY=""` shadowing "GOOGLE_API_KEY". * Fix code broken by pydantic 2.11 * Make "models/" optional for embedding models @Surya2k1 in https://github.com/google-gemini/deprecated-generative-ai-python/pull/645 * Remove bad test @MarkDaoust in https://github.com/google-gemin | Low | 4/17/2025 |
| v0.8.4 | ## What's Changed * feat: add py.typed by @Goldziher in https://github.com/google-gemini/generative-ai-python/pull/509 * Remove references to Pro 1.0 by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/600 * Fix GenerationConfig to match the API. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/609 * fix: thread-safe discovery API setup (Issues#327) by @Sumeet213 in https://github.com/google-gemini/generative-ai-python/pull/583 * Use doub | Low | 1/21/2025 |
| v0.8.3 | ## New features * Search grounding by @shilpakancharla in https://github.com/google-gemini/generative-ai-python/pull/558 ## Updates, bug fixes, and examples * Preserve quality and optimize transfer of prompt images by @PicardParis in https://github.com/google-gemini/generative-ai-python/pull/570 * Remove finish_message by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/571 * Stream file upload by @Hamza-nabil in https://github.com/google-gemini/generative-ai- | Low | 10/31/2024 |
| v0.8.2 | ## What's Changed * Ensure tests are runnable when standalone by @markmcd in https://github.com/google-gemini/generative-ai-python/pull/552 * Add 002 parameters and fixes. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/561 **Full Changelog**: https://github.com/google-gemini/generative-ai-python/compare/0.8.1...v0.8.2 | Low | 9/24/2024 |
| 0.8.1 | ## What's Changed * Expand `.text` error descriptions. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/527 * Fix default_metadata for files API. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/548 * Update version for 0.8.1 release. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/554 **Full Changelog**: https://github.com/google-gemini/generative-ai-python/compare/v0.8.0...0.8.1 | Low | 9/12/2024 |
| v0.8.0 | ## Breaking changes * Remove DiscussService and TextService by @shilpakancharla in https://github.com/google-gemini/generative-ai-python/pull/512 ## New features * Enum support by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/529 ## Minor updatres and bug fixes * Fix PIL.Image imports. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/447 * Expand PIL image support. by @MarkDaoust in https://github.com/google-gemini/generativ | Low | 9/9/2024 |
| v0.7.2 | ## What's Changed ### Bugfixes * Fix bug passing single-string safety settings. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/417 * Fix operator conversion. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/419 * Fix 'ResourceWarning: unclosed <ssl.SSLSocket>' by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/422 * Fix `list_models` by @rozha in https://github.com/google-gemini/generative-ai-python/pull | Low | 7/8/2024 |
| v0.7.1 | ## What's Changed * Add code execution by @shilpakancharla in https://github.com/google-gemini/generative-ai-python/pull/396 **Full Changelog**: https://github.com/google-gemini/generative-ai-python/compare/v0.7.0...v0.7.1 | Low | 6/27/2024 |
| v0.7.0 | ## What's Changed For a detailed introduction, check out [the context caching guide](https://ai.google.dev/gemini-api/docs/caching?lang=python) on the site. ### Features * Explicit Caching by @mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/355 * Explicit Caching patch by @mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/377 ### Bugfixes and small changes * Delete .github/ISSUE_TEMPLATE directory by @ryanwilson in https | Low | 6/17/2024 |
| v0.6.0 | ## What's Changed ### Features * Add `genai.protos` to discourage direct use of google.ai.generativelanguage by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/354 * Add video metadata and error to File by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/348 * Restrict Harm category to the subset supported by Gemini by @aertoria in https://github.com/google-gemini/generative-ai-python/pull/295 * Improve request_options by @MarkDaoust in | Low | 6/3/2024 |
| v0.5.4 | ## What's Changed * Update version of generativelanguage to fix timeout errors. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/345 | Low | 5/17/2024 |
| v0.5.3 | ## What's Changed ### Features * Extend permissions service support to Tuned Models by @mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/219 * Support improved CountTokens and usage_metadata output by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/315 * Add JSON schema support * Add response_schema parameter by @shilpakancharla in https://github.com/google-gemini/generative-ai-python/pull/302 * Improve schema support by @M | Low | 5/13/2024 |
| v0.5.2 | ## Bug Fix * Fix file uploads by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/291 ## New Features * Support for new `TaskTypes` and `output_dimensionality` param by @mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/285 **Full Changelog**: https://github.com/google-gemini/generative-ai-python/compare/v0.5.1...v0.5.2 | Low | 4/18/2024 |
| v0.5.1 | ## New features * Add JSON mode by @shilpakancharla in https://github.com/google/generative-ai-python/pull/274 ## Docs and small fixes * Fix: incorrect type checking by @Yeuoly in https://github.com/google/generative-ai-python/pull/283 * Fix an internal test failure by @markmcd in https://github.com/google/generative-ai-python/pull/279 * Allow incomplete GenerationConfigDict by @markmcd in https://github.com/google/generative-ai-python/pull/286 * Use generativelanguage v0.6.2 for jso | Low | 4/16/2024 |
| v0.5.0 | ## What's Changed ### New features * Files API You can now upload files to the api. Then instead of resending an image with each request, just pass a file reference in your prompt: ``` f = genai.upload_file(path="image.png") m = genai.GenerativeModel(model_name=...) response = m.generate_content(["Please describe this file:", f]) ``` * Add initial prototype supporting the files API by @MarkDaoust in https://github.com/google/generative-ai-python/pull/249 * Fil | Low | 4/8/2024 |
| v0.4.1 | ## Bugfix * The send_message_async method should call the asynchronous method generate_content_async by @xnny in https://github.com/google/generative-ai-python/pull/229 ## Docs * Fix wrong arg name in README by @lll-lll-lll-lll in https://github.com/google/generative-ai-python/pull/228 ## New Contributors * @lll-lll-lll-lll made their first contribution in https://github.com/google/generative-ai-python/pull/228 * @xnny made their first contribution in https://github.com/google/gene | Low | 3/13/2024 |
| v0.4.0 | ## What's new ### Features * Update notebook magics to work with Gemini by @markmcd in https://github.com/google/generative-ai-python/pull/109 * Semantic retriever by @shilpakancharla in https://github.com/google/generative-ai-python/pull/168 * Attributed question answering (`genai.generate_answer`) by @shilpakancharla in https://github.com/google/generative-ai-python/pull/169 * Automatic function calling. by @MarkDaoust in https://github.com/google/generative-ai-python/pull/201 `` | Low | 3/4/2024 |
| v0.3.2 | ## What's Changed Fix `GenerativeModel.count_tokens`. Add basic function call support. Fix async streaming with python 3.9. Use typing_extensions for TypedDict. Fix docs and error messages. ## New Contributors * @Andy963 made their first contribution in https://github.com/google/generative-ai-python/pull/123 * @luo-anthony made their first contribution in https://github.com/google/generative-ai-python/pull/132 * @thesanju made their first contribution in https://github.com/google/ge | Low | 12/20/2023 |
| v0.3.1 | Doc and Bug fixes. | Low | 12/13/2023 |
| v0.3.0 | Adds the `Content` family of methods to support Gemini models. | Low | 12/12/2023 |
| v0.2.2 | - Handle maximum batch size for `embed_text`. - Restore `types.ModelNameOptions`. - Update tuning to handle more dataset types (json, pandas, urls, google-sheets). - Expose `count_text_tokens` - Expose operations management. - Allow users to pass custom `metadata` (HTML headers). - Add dataclass prettyprinting. | Low | 10/23/2023 |
| v0.2.1 | - Bugfix: Add missing enum names to `saftey_types.py` - Update to `google.ai.generativelanguage` v0.3.3 - replace generativelanguage_v1beta3 with generativelanguage since that's the default in `v0.3.3`. | Low | 10/3/2023 |
| v0.2.0 | * Add support for tuning: * Add get_tuned_model. * Add list_tuned_models. * Add create_tuned_model. * More flexible safety settings: * Accept strings and ints for enums. * Accept a {category:threshold} dict in addition to the list of dicts format (`[{"category": category, "threshold": threshold}, ...]`). * Add support for batched embeddings. | Low | 9/26/2023 |
| v0.1.0 | * First real release. * Support for text generation, chat and embeddings. | Low | 5/26/2023 |
| v0.1.0rc2 | Release v0.1.0rc2 | Low | 5/11/2023 |
| v0.1.0rc1 | Release v0.1.0rc1 | Low | 5/5/2023 |
