> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/googleapis/python-genai/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install the Google Gen AI Python SDK with pip or uv, including optional dependencies for enhanced performance and local tokenization.

The Google Gen AI Python SDK provides a unified interface for Google's generative AI models through both the Gemini Developer API and Vertex AI.

## Requirements

Python 3.10 or higher is required.

## Install with pip

Install the SDK using pip:

```bash theme={null}
pip install google-genai
```

## Install with uv

For faster installation, you can use [uv](https://github.com/astral-sh/uv):

```bash theme={null}
uv pip install google-genai
```

## Optional Dependencies

The SDK includes optional dependencies for enhanced functionality:

### aiohttp (Faster Async Performance)

By default, the SDK uses httpx for both sync and async operations. For improved async performance, install with aiohttp support:

```bash theme={null}
pip install google-genai[aiohttp]
```

The SDK configures `trust_env=True` to match httpx's default behavior. You can pass additional `aiohttp.ClientSession.request()` arguments through `HttpOptions`:

```python theme={null}
from google import genai
from google.genai import types

http_options = types.HttpOptions(
    async_client_args={'cookies': ..., 'ssl': ...},
)

client = genai.Client(
    api_key='GEMINI_API_KEY',
    http_options=http_options
)
```

### local-tokenizer (Local Token Counting)

For local token counting and computation without API calls, install with tokenizer support:

```bash theme={null}
pip install google-genai[local-tokenizer]
```

This enables the `LocalTokenizer` class:

```python theme={null}
from google import genai

tokenizer = genai.LocalTokenizer(model_name='gemini-2.5-flash')
result = tokenizer.count_tokens("What is your name?")
print(result)
```

## Verify Installation

Verify your installation by checking the SDK version:

```python theme={null}
import google.genai
print(google.genai.__version__)
```

## Core Dependencies

The SDK automatically installs these core dependencies:

* `anyio>=4.8.0, <5.0.0` - Async I/O support
* `google-auth[requests]>=2.47.0, <3.0.0` - Google authentication
* `httpx>=0.28.1, <1.0.0` - HTTP client
* `pydantic>=2.9.0, <3.0.0` - Data validation and typing
* `requests>=2.28.1, <3.0.0` - HTTP library
* `tenacity>=8.2.3, <9.2.0` - Retry logic
* `websockets>=13.0.0, <17.0` - WebSocket support
* `typing-extensions>=4.11.0, <5.0.0` - Type hints backport

## Next Steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get started with your first API call
  </Card>

  <Card title="Authentication" icon="key" href="/authentication">
    Configure API keys and credentials
  </Card>
</CardGroup>
