A professional-grade command-line interface (CLI) for searching flight prices using the Duffel API. This tool is designed for efficiency, security, and ease of use, both for direct user interaction and for integration with agents.
- World-Class CLI: Proper command structure with subcommands (
search,config). - Secure Authentication: Securely stores your Duffel API key in
~/.config/flight-pricer/config.yaml. No hardcoded credentials. - Comprehensive Search: Filter flights by origin, destination, dates, cabin class, passenger count, and number of stops.
- Intuitive Aliases: Includes convenient flags like
--non-stop. - Clean Output: Displays results in a clean, human-readable table.
- Installable Package: Packaged as a standard Python application, making
flight-priceravailable as a system command.
- Python 3.7+
- pip
- A Duffel API Key (Get one here)
-
Clone the repository (or ensure it is present in your workspace):
git clone https://github.com/jrojas537/flight-pricer.git cd flight-pricer -
Create and activate a Python virtual environment:
python -m venv .venv source .venv/bin/activate -
Perform an editable installation: This command links the script into your path, making
flight-pricera globally available command within the activated environment.pip install -e .
Before you can search, you must set your Duffel API key. This only needs to be done once.
flight-pricer config set --api-key YOUR_DUFFEL_API_KEYThis command will create the configuration file and securely store your key.
The primary command is search. It takes several options to define your flight search.
--from <IATA>: (Required) Departure airport IATA code (e.g.,DTW).--to <IATA>: (Required) Arrival airport IATA code (e.g.,MIA).--depart <YYYY-MM-DD>: (Required) Departure date.--return <YYYY-MM-DD>: (Optional) Return date for a round-trip flight.--passengers <number>: (Optional) Number of passengers (default: 1).--max-stops <number>: (Optional) Maximum number of connections.--non-stop: (Optional) A convenient alias for--max-stops 0.--cabin <class>: (Optional) Cabin class. Choices:economy,business,first,premium_economy.
Search for a non-stop, first-class flight for one person:
flight-pricer search --from DTW --to MIA --depart 2026-04-06 --return 2026-04-10 --non-stop --cabin firstSearch for a one-way economy flight for two passengers:
flight-pricer search --from JFK --to LAX --depart 2026-08-15 --passengers 2 --cabin economy