Does Open-Notebook Have a CLI? Command-Line Interface Options Explained
Open Notebook does not ship with a dedicated command-line interface (CLI); instead, it exposes all functionality through a FastAPI-based REST API that can be called from the command line using HTTP clients like curl.
The lfnovo/open-notebook repository is a web-based research assistant designed for interactive knowledge management. While many Python tools provide native command-line utilities, this project takes a different architectural approach centered on HTTP endpoints. If you are searching for a command-line interface for Open Notebook, you will interact with its documented API rather than a traditional CLI binary.
Why There Is No Native CLI
Open Notebook is architected as a service-oriented application rather than a command-line tool. The repository contains no console_scripts entry point in pyproject.toml, which confirms that no CLI is packaged for end users.
The only executable script in the top-level source tree is run_api.py. This file simply invokes the FastAPI server using uvicorn api.main:app and is intended for local development workflows. It does not accept commands for creating notebooks, ingesting sources, or managing content—it merely starts the web server on port 5055.
While the repository contains a commands/ package with modules like source_commands.py and podcast_commands.py, these are internal helper functions used by the server. They are not wired to a command-line entry point using libraries like click or argparse, and remain inaccessible from the shell.
The REST API as the Primary Interface
All user-facing functionality—including notebook management, source ingestion, chat interactions, and podcast generation—is exposed through a REST API defined in api/main.py and organized under api/routers/. This API is the supported programmatic interface for the project.
When you launch the service, the interactive API documentation is automatically available at http://localhost:5055/docs. This Swagger UI documents every endpoint, request schema, and response format, making it straightforward to construct command-line HTTP calls.
Command-Line Access via HTTP Clients
Since Open Notebook lacks a native CLI, the recommended way to interact with it from the command line is to call its HTTP endpoints directly. Below are practical examples using curl to perform common operations against the running API server.
Start the API server first:
python -m uvicorn api.main:app --host 0.0.0.0 --port 5055
Create a new notebook:
curl -X POST http://localhost:5055/notebooks \
-H "Content-Type: application/json" \
-d '{"title":"My research notebook"}'
Add a source URL to an existing notebook:
curl -X POST http://localhost:5055/sources \
-H "Content-Type: application/json" \
-d '{
"notebook_id":"<notebook-id>",
"type":"url",
"url":"https://example.com/article.pdf"
}'
Ask a question using the notebook's context:
curl -X POST http://localhost:5055/ask \
-H "Content-Type: application/json" \
-d '{
"notebook_id":"<notebook-id>",
"question":"Summarise the key points."
}'
Internal Command Structure
The commands/ directory contains domain-specific logic for operations like source_commands.py and podcast_commands.py. These modules encapsulate business logic used by the FastAPI route handlers in api/routers/. However, they are internal implementation details and are not exposed as standalone shell commands. If you need automated scripting, you should target the REST endpoints that utilize these internal modules rather than attempting to import them directly.
Summary
- Open Notebook does not provide a user-oriented CLI tool or
console_scriptsentry point in its packaging configuration. - The only command-line script,
run_api.py, merely starts the FastAPI development server. - All functionality is exposed via a REST API documented at
http://localhost:5055/docs. - You can interact with Open Notebook from the command line using standard HTTP clients like
curlorwget. - A custom CLI can be built on top of the documented API endpoints if your workflow requires shell-native interaction.
Frequently Asked Questions
Does Open Notebook have a built-in CLI tool?
No. According to the source code in pyproject.toml, there is no console_scripts definition, and the repository does not ship with a command-line interface for end users. The project is designed to be accessed via its web UI or REST API.
How do I start Open Notebook from the command line?
Use the run_api.py script or invoke uvicorn directly to start the FastAPI server. The command python -m uvicorn api.main:app --host 0.0.0.0 --port 5055 starts the service, after which you can access the web interface or API at http://localhost:5055.
Can I create notebooks and add sources via the command line?
Yes, but not through a native CLI. You must use HTTP requests to the REST API endpoints. For example, send a POST request to /notebooks to create a notebook and to /sources to add content, using tools like curl or any language-specific HTTP client.
Is it possible to build a custom CLI for Open Notebook?
Absolutely. Since every operation is exposed through the FastAPI routes in api/routers/, you can construct a custom CLI using libraries like click or typer that wraps HTTP calls to localhost:5055. This approach respects the project's architecture while providing shell-based automation.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →