> ## Documentation Index
> Fetch the complete documentation index at: https://docs.videodb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Python SDK

> Install and configure the VideoDB Python SDK

## Installation

```bash theme={null}
pip install videodb
```

<CardGroup cols={2}>
  <Card icon="package" title="PyPI" href="https://pypi.org/project/videodb/">
    View package on PyPI
  </Card>

  <Card icon="github" title="GitHub" href="https://github.com/video-db/videodb-python">
    Source code and issues
  </Card>
</CardGroup>

## Quick Start

```python theme={null}
import videodb

# Connect using environment variable
conn = videodb.connect()

# Or pass API key directly
conn = videodb.connect(api_key="your-api-key")
```

## Environment Variables

| Variable           | Description                                                                                                                                                                         |
| :----------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `VIDEO_DB_API_KEY` | Your API key from [console.videodb.io](https://console.videodb.io/auth?utm_source=docs_videodb_io\&utm_medium=docs_link\&utm_campaign=console_auth\&utm_content=docs_link\&id=docs) |

```bash theme={null}
export VIDEO_DB_API_KEY="your-api-key"
```

## Requirements

* Python 3.8 or higher
* Works on Linux, macOS, and Windows

## Basic Usage

```python theme={null}
import videodb

conn = videodb.connect()

# Upload a video
coll = conn.get_collection()
video = coll.upload(url="https://www.youtube.com/watch?v=example")

# Create a timed transcript artifact, then make it searchable
understanding = video.understand(
    analyzers=[{"type": "spoken_words", "name": "transcript"}],
)
understanding.wait_until_complete()
transcript_analyzer = understanding.get_analyzer("transcript")

transcript_index = video.index(
    name="transcript",
    source=transcript_analyzer,
    use_for=["semantic"],
    fields={"semantic": ["text"]},
)
transcript_index.wait_until_complete()

# Search with natural language
results = video.semantic_search(
    query="key moments",
    index_ids=[transcript_index.index_id],
    top_k=5,
)
for shot in results.get_shots():
    print(f"{shot.start}s: {shot.text}")
```

## Server Side

Use the full SDK on your backend to manage sessions, run AI pipelines, and handle webhooks. Your API key should never be exposed to the browser.

```python theme={null}
# Create a capture session and generate a client token
cap = conn.create_capture_session(end_user_id="user_123")
token = conn.generate_client_token(expires_in=600)
```

## Client Side

For real-time desktop capture, install the Capture SDK on your client application. It uses short-lived tokens instead of your API key.

<Note>
  Desktop capture currently supports **macOS** and **Windows**.
</Note>

```bash theme={null}
pip install "videodb[capture]"
```

<Card icon="monitor" title="Capture SDK Overview" href="/pages/ingest/capture-sdks/overview">
  Learn how to integrate real-time screen, audio, and camera capture into your application
</Card>

## Next Steps

<CardGroup cols={2}>
  <Card icon="rocket" title="Quickstart" href="/pages/getting-started/quickstart">
    Build your first perception-enabled agent
  </Card>

  <Card icon="code" title="API Reference" href="/api-reference/introduction">
    Complete REST API documentation
  </Card>
</CardGroup>
