# notebooklm-py

> Drive Google's Gemini Notebook from Python, a CLI or an agent

- Category: AI Productivity & Writing / Notes & Knowledge Bases
- Language: Python
- Licence: MIT
- Repository: https://github.com/teng-lin/notebooklm-py
- Canonical page: https://ai-tldr.dev/tools/notebooklm-py/

## In short

notebooklm-py gives programmatic access to Google's Gemini Notebook — the product formerly called NotebookLM — through a Python API, a `notebooklm` CLI, an MCP server and a local REST server. It sits in the Notes & Knowledge Bases category of the AI Productivity & Writing tools and is open-source, written in Python and licensed MIT.

## Overview

notebooklm-py gives programmatic access to Google's Gemini Notebook — the product formerly called NotebookLM — through a Python API, a `notebooklm` CLI, an MCP server and a local REST server. Google rebranded the product in July 2026; the service and this library are unchanged, and the package kept its original name.

The appeal for agent builders is that a notebook is a grounded engine: Gemini reads your sources and answers from them with citations, on Google's infrastructure. That makes it usable as a synthesis and memory layer an agent drives in a loop — bulk-import a corpus, ask questions against it, and spend your own model's tokens only on the final step. It also covers the reverse direction, pulling artifacts back out in bulk: mind maps as JSON, quizzes and flashcards as JSON, Markdown or HTML, data tables as CSV, slide decks as PDF or PPTX.

Coverage is deliberately complete rather than a thin wrapper. Notebooks, sources, chat, notes, source labels, research agents and sharing all have typed namespaces, and every generated artifact type is supported — audio overviews, video overviews, slide decks, infographics, quizzes, flashcards, reports, data tables and mind maps. Several capabilities have no equivalent in the web UI, including batch downloads, quiz and flashcard export, mind-map JSON extraction and saving a whole chat history as a note. Two authentication backends exist: the default web transport and an opt-in Android gRPC backend for unattended servers. This is an unofficial library built on undocumented Google endpoints, so the maintainers position it for prototypes, research and personal projects.

## What it does

- Full API coverage — notebooks, sources, chat, notes, source labels, web and Drive research agents, and sharing
- Every artifact type generated and downloaded: audio and video overviews, slide decks, infographics, quizzes, flashcards, reports, data tables and mind maps
- Capabilities the web UI does not expose: batch downloads, quiz and flashcard export, mind-map JSON, CSV data tables and per-slide revision
- Four surfaces — Python API, CLI, MCP server (local stdio or a self-hosted remote connector) and a local REST server
- Master-token auth mints fresh cookies on demand, so headless servers, CI and remote MCP connectors self-heal expired sessions
- Ships an agent skill installable with `notebooklm skill install` or `npx skills add`, plus multi-account profiles

## Getting started

Install the CLI into its own isolated environment with uv or pipx — this avoids the externally-managed-environment error on modern macOS and Debian/Ubuntu. Embedding it as a library needs neither Playwright nor Chromium.

1. Install the CLI and sign in

   The first run downloads Chromium (~170 MB) and opens a Google sign-in.

```bash
uv tool install "notebooklm-py[browser]"   # or: pipx install "notebooklm-py[browser]"
notebooklm login
notebooklm auth check --test --json         # expect "status": "ok"
```

2. Or add it as a library

   No browser dependency when you only use the Python API with stored credentials.

```bash
uv add notebooklm-py   # or, inside a virtualenv: pip install notebooklm-py
```

3. Create a notebook, add sources, ask

   Sources can be URLs, local files, YouTube links or Google Drive documents.

```bash
notebooklm create "My Research"
notebooklm use <notebook_id>
notebooklm source add "https://en.wikipedia.org/wiki/Artificial_intelligence"
notebooklm source add "./paper.pdf"
notebooklm ask "What are the key themes?"
```

4. Generate and download artifacts

   `--wait` blocks until generation finishes; downloads write straight to local files.

```bash
notebooklm generate audio "make it engaging" --wait
notebooklm generate quiz --difficulty hard
notebooklm download quiz --format markdown ./quiz.md
notebooklm download mind-map ./mindmap.json
```

5. From Python

   The client is async and loads credentials written by `notebooklm login`.

```python
import asyncio
from notebooklm import NotebookLMClient

async def main():
    async with NotebookLMClient.from_storage() as client:
        nb = await client.notebooks.create("Research")
        await client.sources.add_url(nb.id, "https://example.com", wait=True)
        result = await client.chat.ask(nb.id, "Summarize this")
        print(result.answer)

asyncio.run(main())
```

6. Install the agent skill

   Adds a NotebookLM skill to Claude Code and `.agents` skill directories.

```bash
notebooklm skill install

# or via the open skills ecosystem
npx skills add teng-lin/notebooklm-py
```

## When to use it

- Offload analysis of a large document set to Gemini Notebook and have your own agent spend tokens only on the final answer
- Give a coding agent a grounded, cited knowledge base of your internal docs without standing up a vector database
- Batch-export quizzes, flashcards, mind maps and data tables into a repo, Anki or an Obsidian vault
- Run scheduled audio briefings or automated runbook generation from a headless server using master-token auth
