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

# Python SDK

> Integrate Vizlook’s powerful APIs natively in your Python apps.

## GitHub

[https://github.com/Vizlook/vizlook-python](https://github.com/Vizlook/vizlook-python)

## Install SDK

```Bash Bash theme={null}
pip install vizlook
```

## Synchronous Client

<Card horizontal="true" arrow="true" title="Get Your Vizlook API Key" icon="key" href="https://www.vizlook.com/dashboard/api-keys">Sign up and receive \$10 free credit.</Card>

If not asign `api_key`, the SDK will get API key from environment variable `VIZLOOK_API_KEY` by default.

### Search

```Python Python theme={null}
from vizlook import Vizlook
import os
from datetime import datetime

vizlook = Vizlook(api_key=os.environ.get("VIZLOOK_API_KEY"))

response = vizlook.search(
    "how to be productive",
    max_results=5,
    start_published_date="2025-08-19T15:01:36.000Z",
    end_published_date=int(datetime.now().timestamp() * 1000),
    include_transcription=True,
    include_summary=True,
)

print("Dict with original API field name: ", response.to_dict())
print("Dict with snake case field name: ", response.to_dict(use_api_field_name=False))
print("Get value with snake case key from pydantic model: ", response.results)
```

### Answer

Answer in non-stream mode.

```Python Python theme={null}
from vizlook import Vizlook
import os

vizlook = Vizlook(api_key=os.environ.get("VIZLOOK_API_KEY"))

response = vizlook.answer(
    "how to be productive",
    include_transcription=True,
)

print("Dict with original API field name: ", response.to_dict())
print("Dict with snake case field name: ", response.to_dict(use_api_field_name=False))
print("Get value with snake case key from pydantic model: ", response.answer)
```

Answer in stream mode.

```Python Python theme={null}
from vizlook import Vizlook
import os

vizlook = Vizlook(api_key=os.environ.get("VIZLOOK_API_KEY"))

stream_response = vizlook.stream_answer(
    "how to be productive",
    include_transcription=True,
)
answer = ""

for chunk in stream_response:
    # Dict with original API field name, or `chunk.to_dict(use_api_field_name=False)` get dict with snake case field name
    chunk_dict = chunk.to_dict()
    chunk_type = chunk_dict.get("type")

    if chunk_type == "answer-chunk":
        answer += chunk_dict.get("data", "")
    if chunk_type == "data-citations":
        print("Citations: ", chunk_dict.get("data").get("citations"))
    if chunk_type == "data-cost":
        print("Cost: ", chunk_dict.get("data").get("dollarCost"))
    if chunk_type == "error":
        print("Error: ", chunk_dict.get("data").get("errorText"))

print("Answer: ", answer)
```

### Get video contents

```Python Python theme={null}
from vizlook import Vizlook
import os

vizlook = Vizlook(api_key=os.environ.get("VIZLOOK_API_KEY"))

response = vizlook.get_video_contents(
    ["https://www.youtube.com/watch?v=QdBokRd2ahw"],
    crawl_mode="Fallback",
    include_transcription=True,
    include_summary=True,
)

print("Dict with original API field name: ", response.to_dict())
print("Dict with snake case field name: ", response.to_dict(use_api_field_name=False))
print("Get value with snake case key from pydantic model: ", response.results)
```

## Asynchronous Client

```Python Python theme={null}
from vizlook import AsyncVizlook
import os

async def run_examples():
    vizlook = AsyncVizlook(api_key=os.environ.get("VIZLOOK_API_KEY"))

    print("============= non stream =============")

    response = await vizlook.answer(
        "how to be productive",
        include_transcription=True,
    )
    print("Dict with original API field name: ", response.to_dict())
    print("Dict with snake case field name: ", response.to_dict(use_api_field_name=False))
    print("Get value with snake case key from pydantic model: ", response.answer)

    print("============= stream =============")

    stream_response = await vizlook.stream_answer(
        "how to be productive",
        include_transcription=True,
    )
    answer = ""

    async for chunk in stream_response:
        # Dict with original field name
        chunk_dict = chunk.to_dict()
        chunk_type = chunk_dict.get("type")

        if chunk_type == "answer-chunk":
            answer += chunk_dict.get("data", "")
        if chunk_type == "data-citations":
            print("Citations: ", chunk_dict.get("data").get("citations"))
        if chunk_type == "data-cost":
            print("Cost: ", chunk_dict.get("data").get("dollarCost"))
        if chunk_type == "error":
            print("Error: ", chunk_dict.get("data").get("errorText"))

    print("Answer: ", answer)


if __name__ == "__main__":
    import asyncio

    asyncio.run(run_examples())
```
