Ledgy is a command-line interface (CLI) tool designed to help users manage their financial transactions and ledger entries. It provides functionalities to add transactions (including extraction from various sources) and ask questions about financial data. Ledgy integrates exclusively with hledger for its ledger management.
- Add Transactions: Add new financial transactions to your ledger. This includes the ability to extract transaction details from text, images, and documents.
- Ask Questions: Query your financial data using natural language to get insights and answers.
- hledger: Ledgy relies on
hledgerfor all ledger operations. Please ensurehledgeris installed and properly configured on your system. You can find installation instructions forhledgerhere.
To install Ledgy, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/ledgy.git cd ledgy -
Install Ledgy using uv:
uv tool install .
Ledgy uses a YAML configuration file located at ~/.config/ledgy/config.yaml by default. If this file does not exist, Ledgy will create it with default values on its first run.
api:
base_url: https://openrouter.ai/api/v1
api_key: ""
model: google/gemini-2.5-flash
vision_model: google/gemini-2.5-flash
ledger:
file_path: /home/user/.ledgy/bank.ledger # Default ledger file path
executable: hledger # Ledgy works exclusively with 'hledger'
defaults:
spending_account: Expenses:Unknown
currency: RUBAdds a new transaction to your ledger. This command is powerful as it can extract transaction details from various input types, including plain text, image files, and document files (PDF, TXT, DOCX).
ledgy add <input_data> [OPTIONS]Examples:
-
Add a simple transaction from a text string and print to console:
ledgy add "2023/10/26 Groceries:Food $50.00 Assets:Bank" -
Extract transactions from an image file and write to the default ledger file:
ledgy add "/path/to/receipt.jpg" --write -
Extract transactions from a PDF document and write to a specific ledger file:
ledgy add "/path/to/bank_statement.pdf" --file /path/to/my/personal.ledger --write
Starts a FastAPI server to expose add and ask functionalities via HTTP API.
ledgy serve [OPTIONS]Options:
--host TEXT: Host for the API server (default:127.0.0.1)--port INTEGER: Port for the API server (default:8000)