| name | notebooklm-enterprise-api |
| description | Generate podcast audio using NotebookLM Enterprise API via Google Cloud. Automates the manual NotebookLM workflow - creates notebook, uploads sources, generates audio with custom focus prompt. Requires Google Cloud project with Discovery Engine API enabled. |
NotebookLM Enterprise API Audio Generation
Generate podcast audio using the NotebookLM Enterprise API. This automates the manual NotebookLM web workflow:
- Create notebook via API
- Upload 5 source files (p1-brief.md, report.md, p3-briefing.md, sources.md, content_plan.md)
- Generate audio overview with the standard Yudame Research prompt
- Download the resulting MP3
Prerequisites
Google Cloud Setup
Enable APIs:
gcloud services enable discoveryengine.googleapis.com gcloud services enable aiplatform.googleapis.comRequired IAM Roles:
roles/discoveryengine.admin(for notebook creation)- Or appropriate NotebookLM Enterprise permissions
Authentication:
gcloud auth login gcloud config set project YOUR_PROJECT_IDNotebookLM Enterprise License:
- Must have Gemini Enterprise subscription with NotebookLM Enterprise enabled
- Access may be restricted to select customers
Environment Variables
# Optional - defaults to gcloud config
export GOOGLE_CLOUD_PROJECT=your-project-id
Usage
Command Line
cd podcast/tools
# Basic usage
python notebooklm_api.py ../episodes/YYYY-MM-DD-slug/
# With series name
python notebooklm_api.py ../episodes/cardiovascular-health/ep5-diet/ \
--series "Cardiovascular Health"
# With custom title and cleanup
python notebooklm_api.py ../episodes/YYYY-MM-DD-slug/ \
--title "Diet and Heart Health" \
--series "Cardiovascular Health" \
--cleanup
Arguments
| Argument | Required | Description |
|---|---|---|
episode_dir |
Yes | Path to episode directory |
--series |
No | Series name (included in audio intro) |
--title |
No | Episode title (defaults to directory name) |
--cleanup |
No | Delete notebook after generation |
--timeout |
No | Timeout in minutes (default: 30) |
Required Source Files
The episode directory must contain:
episode-directory/
├── research/
│ ├── p1-brief.md # Phase 1 research brief
│ └── p3-briefing.md # Master briefing (cross-validated)
├── report.md # Narrative synthesis
├── sources.md # Validated source links
└── content_plan.md # Episode structure and NotebookLM guidance
What It Does
- Creates Notebook: API call to create a new notebook
- Uploads Sources: Uploads all 5 source files as text content
- Generates Audio: Calls
audioOverviews.createwith the standard Yudame Research prompt - Waits for Completion: Polls status every 30 seconds (up to timeout)
- Downloads MP3: Saves to
episode-directory/SLUG.mp3 - Cleanup: Optionally deletes the notebook
The Episode Focus Prompt
Uses the same prompt as the manual NotebookLM workflow:
- Opening: "Yudame Research" + series name
- Core principles: Spell out acronyms, define terms, cite studies
- Tone: Intellectually rigorous but accessible
- Closing: Summary + website URL
See generate_episode_focus() in the script for the full prompt.
Output
episode-directory/
└── YYYY-MM-DD-slug.mp3 # Generated audio (typically 20-40 min)
The audio is in the standard NotebookLM format (two hosts, Deep Dive style).
Troubleshooting
"Permission Denied"
- Check gcloud authentication:
gcloud auth print-access-token - Verify Discovery Engine API is enabled
- Confirm NotebookLM Enterprise license is active
"Notebook Not Found"
- The API uses project number, not project ID
- Check
gcloud projects describe PROJECT_IDfor the number
"Audio Generation Failed"
- Check source file sizes (must be under 100,000 tokens combined)
- Verify source files are valid text/markdown
- Check Google Cloud quotas
Timeout
- Increase with
--timeout 60for larger source files - Audio generation typically takes 5-15 minutes
Integration with Workflow
This is the primary audio generation method for Phase 10.
Fallback: Manual NotebookLM web interface (.claude/skills/notebooklm-audio/) when API is unavailable.
API Reference
Endpoints Used
| Operation | Endpoint |
|---|---|
| Create Notebook | POST /notebooks |
| Upload Source | POST /notebooks/{id}/sources:batchCreate |
| Generate Audio | POST /notebooks/{id}/audioOverviews |
| Check Status | GET /notebooks/{id}/audioOverviews/default |
| Download Audio | GET /notebooks/{id}/audioOverviews/default:download |
| Delete Notebook | DELETE /notebooks/{id} |