llm open finance
Talk to your own bank data from the terminal. llmopenfinance is a web chat with an LLM financial assistant
(Claude, Codex, Gemini (no paid API, using only regular OAUTH sign-in) or a local Ollama / llama.cpp
model (recommended for privacy), all through pyllmrouter). It answers questions about your accounts, credit cards, investments and
loans, using data pulled through:
The responses are consistent (and free of hallucinations), generated by a local, deterministic SQL process.
$ llmopenfinance
Financial assistant ready. Commands: /help /summary (data sent to the model) /sync /reset /history exit
======================================================================
You: Which subscriptions do I have?
Assistant:
↳ consultando detect_subscriptions(months=12)
| Service | Value | Last charge | Annual cost |
|---------|---------|-----------------|-------------|
| Netflix | $ 8.99 | 2026-11-08 | $ 107.88 |
| Spotify | $ 6.99 | 2026-11-12 | $ 83.88 |
...
Example questions (answers are in Brazilian Portuguese by default; set LLMOPENFINANCE_LANG=en for English,
see Language):
- what services do I subscribe to?
- how much do I spend on online shopping each month?
- how can I improve my finances?
- what were my 3 largest expenses in November?
- how much is left on my loan, and what is its total effective cost?
Open Finance US
- TODO
Open Finance Brasil
Connecting Banks in "My Pluggy" and Generating Tokens (Brazilian Open Finance)
Before you begin:
- Connect your bank accounts via Open Finance in Meu Pluggy ( meu.pluggy.ai ) - Brazilian Open Finance.
- Obtain your credentials (
Client IDandClient Secret) from the Pluggy Dashboard ( dashboard.pluggy.ai ).
Part 1: How to connect your banks via Open Finance (meu.pluggy.ai)
Meu Pluggy ( meu.pluggy.ai ) is Pluggy’s free portal designed for personal use (tracking expenses, populating spreadsheets, feeding your own systems, or providing data to AI agents using information from your own accounts).
Important: Pluggy is an institution regulated by the Central Bank of Brazil. Data sharing is handled directly through your bank’s official Open Finance flow.
Step 1: Create your "Meu Pluggy" account
- Go to https://meu.pluggy.ai.
- Create a new account using your email and a password.
- Registration is immediate (self-service); no invitation or manual approval is required.
Step 2: Initiate the connection with your bank
- Once logged into the "Meu Pluggy" dashboard, click the "Connect My Account" button.
- In the list of financial institutions, search for and select the bank you wish to connect (e.g., Nubank, Itaú, Inter, Banco do Brasil, Bradesco, Santander, etc.).
Step 3: Authorize data sharing via Open Finance
- You will be automatically redirected to your bank’s official app or website.
- Log in to your bank as you normally would and review the data-sharing permissions (balances, statements, cards, investments).
- Confirm the authorization within your bank’s interface.
⚠️ Important (Common cause of errors): Stay on the final confirmation screen provided by your bank and wait for the automatic redirect back to Meu Pluggy. Closing the app or navigating back manually before the process is complete will cancel the connection.
Step 4: Verify that the connection is complete
- Once back on the Meu Pluggy dashboard, check that the account appears in your list, showing both your balance and transaction history (statement).
- If the account does not appear, please repeat the authorization process.
- Do you have accounts at other banks? Simply click "Connect My Account" again and repeat the process for each institution.
Part 2: How to create credentials and generate tokens (dashboard.pluggy.ai)
To consume data via the API (or integrate it into external tools), you will need to create an application in the Pluggy Dashboard, obtain your credentials, and generate an authentication token.
Step 1: Create your Dashboard account
- Go to https://dashboard.pluggy.ai.
- Register your account — it is recommended to use the same email address you registered with on
meu.pluggy.ai. - Note: If a notice regarding a trial period (e.g., 15 days) appears, you can disregard it for the personal use flow integrated with "Meu Pluggy."
Step 2: Create an Application
- In the Dashboard menu, go to the Applications section and click to create a new application.
- Give it an identifying name (e.g.,
My Personal Finances). - A single application is sufficient to access all the bank accounts you connected in Part 1.
Step 3: Copy the Client ID and Client Secret
- Open the newly created application and go to the "Application" tab (or the credentials settings section).
- Locate and copy the following two values:
Client ID: The unique identifier for the application (in UUID format).Client Secret: The application's secret key (new keys typically begin withpluggy_sk_).
🔒 Security best practices:
- The
Client Secretmay only be displayed once—at the moment of creation. Store it in a secure location (such as a password manager or an.envfile). If you lose it, you will need to rotate it or generate a new one via the Dashboard. > - Never expose theClient Secretin front-end code, mobile applications, or public repositories (GitHub).
Quick start
# 1. Install (uv only)
uv sync
# 2. Credentials (Pluggy application clientId/clientSecret from dashboard.pluggy.ai)
$env:PLUGGY_USERNAME = "<clientId>"
$env:PLUGGY_PASSWORD = "<clientSecret>"
# 3. One LLM provider (see "LLM providers" below): an API key, a sign-in or a local server
$env:ANTHROPIC_API_KEY = "<key>" # e.g. Claude through the Anthropic API
# 4. Connect your banks (MeuPluggy, free for personal use) — see docs/pluggy-setup.md
uv run llmopenfinance items add <item-id> # item ids copied from the Pluggy dashboard
# or: uv run llmopenfinance connect # opens the Pluggy Connect widget in your browser
# 5. Chat (syncs first)
uv run llmopenfinance # auto-detects the first usable provider
uv run llmopenfinance --provider anthropic # a specific provider
uv run llmopenfinance --provider ollama --model qwen3.5:9b # 100% local
LLM providers
The LLM layer is pyllmrouter, which is the only LLM service this project uses
(it is installed from GitHub with the project: uv sync). Pick the provider with --provider <name>, the
LLMOPENFINANCE_PROVIDER variable, or leave it out to let pyllmrouter auto-detect.
--provider |
Backend | Needs |
|---|---|---|
claude-agent-token |
Claude Agent SDK, long-lived token | CLAUDE_CODE_OAUTH_TOKEN |
claude-agent-login |
Claude Agent SDK, Claude CLI login | claude auth login |
anthropic (alias claude) |
Anthropic Messages API | ANTHROPIC_API_KEY |
gemini |
Gemini API | GEMINI_API_KEY |
antigravity |
Gemini through the Antigravity CLI (agy) |
agy signed in |
codex |
OpenAI Codex (ChatGPT plan or API key) | codex login |
ollama |
Local Ollama server | a running server (OLLAMA_SERVER) |
llamacpp |
Local llama.cpp llama-server |
a running server (LLAMACPP_SERVER) |
- Chosen explicitly (
--provider, orLLMOPENFINANCE_PROVIDER): that provider is used, never replaced. An unknown name stops the program with exit status 2 and the list of valid names; an unusable one (missing key, SDK or server) is reported before the chat starts. - Not chosen (or
auto): pyllmrouter reads its ownLLMROUTER_PROVIDERvariable and otherwise probes the providers in the order of the table and uses the first one that works. A machine withANTHROPIC_API_KEYset therefore picks Claude; use--provider ollamato stay local. --model(or the provider's own variable, e.g.OLLAMA_MODEL) picks the model; empty means the provider's default.uv run pyllmrouter providersshows why each provider is or is not available. pyllmrouter accepts more aliases (llama.cpp,google, ...):uv run pyllmrouter describelists them all.- pyllmrouter is a plain chat API, so the tools are called through a small text protocol that works the same on every provider (see docs/architecture.md). Small local models follow it less reliably than the large hosted ones.
Commands
| Command | What it does |
|---|---|
llmopenfinance / llmopenfinance chat |
Interactive chat. Syncs first; skip with --no-sync |
llmopenfinance server [--host H] [--port N] |
Serves the same chat as a local web page (needs uv sync --extra web) |
llmopenfinance ask "pergunta" |
Asks one question and exits |
llmopenfinance sync [--force] |
Downloads accounts, transactions, card bills, investments and loans |
llmopenfinance status |
Shows connections, consent expiry dates and local row counts |
llmopenfinance connect [--sandbox] |
Connects accounts through the Pluggy Connect widget on a local page |
llmopenfinance items add/list/remove |
Manages the registered Pluggy item ids |
Global options: --provider <pyllmrouter provider>|auto, --model <id>, --db <file>, -v.
See docs/usage.md for the full reference.
Language
The application speaks Brazilian Portuguese (pt-BR, the default) or English (en): the command help, every message,
the assistant's system prompt and its answers. Pick one with the LLMOPENFINANCE_LANG environment variable. There is
no command-line option for it.
$env:LLMOPENFINANCE_LANG = "en" # or "pt-BR"
uv run llmopenfinance
- English shows money as
R$ 1,234.56and dates asYYYY-MM-DD. Portuguese keepsR$ 1.234,56andDD/MM/AAAA. - An unsupported value stops the program with a short message on stderr and exit status 2.
- Stored data such as category labels (
Alimentação) is never translated, and the chat commands of both languages (/ajudaand/help,/resumoand/summary,sairandexit) work in either.
Web chat
llmopenfinance server serves the same assistant as a chat page in your browser, with buttons for /help, /summary,
/sync, /reset and /history and a language that follows LLMOPENFINANCE_LANG. It needs the optional web extra
(Flask and Waitress):
uv sync --extra web
uv run llmopenfinance server # syncs, prints a URL with a token and opens the browser
uv run llmopenfinance server --no-browser --no-sync --port 8123
Options: --host (default 127.0.0.1), --port (8000), --threads (4, at least 2), --browser/--no-browser,
--sync/--no-sync and --sql/--no-sql (the last two work as in chat); the global --provider and --model choose
the LLM. Without the extra the command prints the install line and exits with status 1.
Security, in short (details in docs/usage.md):
- It listens on the loopback address only, unless you pass another
--host; the page then travels over plain HTTP andserverprints a warning. With a wildcard host (0.0.0.0,::) the token alone protects access. - Every launch creates a new secret token. The URL with the token (
http://127.0.0.1:8000/?token=...) is printed once and never logged; the browser keeps it in anHttpOnlycookie and the address bar drops it. - Requests whose
Hostheader is not this server are refused (DNS-rebinding defence). - One server process holds one conversation, shared by every tab. A request that arrives while the assistant is busy is refused with "busy"; requests are not queued.
How it works
Pluggy API ──sync──▶ DuckDB (local) ──read-only──▶ tools ◀──tool calls── LLM (any pyllmrouter provider)
│ ▲
└──── financial snapshot (aggregates) ───────────────┘ system prompt
- Sync (
sync.py) pulls each item's full history. It is incremental per item and skips unchanged items. A failing item or product is reported, and the rest of the sync continues. - Local enrichment (
categorize.py):- Every transaction gets a pt-BR category and a kind: expense, refund, income, transfer or investment.
- Card bill payments and transfers between your own accounts are never counted as spending.
- This works even after Pluggy's paid categorization stops at the end of the trial.
- Assistant (
agent.py,tools.py,analytics.py):- The system prompt carries a compact snapshot of your finances.
- The model calls deterministic SQL tools to get the details, so the numbers it gives come from your data.
- For remote providers there is also a guarded
run_sqlescape hatch (off by default for local ones).
Details: docs/architecture.md.
Privacy
With a local provider (ollama or llamacpp) nothing leaves your machine except the Pluggy sync itself. With any
other provider, the snapshot and the rows returned by tools are sent to that provider's service, and the chat prints a
notice saying so. Each tool result is capped at 100 rows, but run_sql (on by default for remote providers) can select
any column, including the full raw Pluggy record of a transaction. Use --no-sql to limit the model to the curated
tools. The local database
lives at ~/.llmopenfinance/finance.duckdb (change it with --db or LLMOPENFINANCE_DB).
Development
uv run ruff format . ; uv run ruff check . ; uv run pyrefly check ; uv run pytest
The tests use synthetic Pluggy payloads, httpx.MockTransport and a pyllmrouter chat with a scripted backend, so they never touch the network.
The coverage gate is 90%. See AGENTS.md.
Author
- Jorge Albuquerque, Ph.D. [LinkedIn] [X]
- GitHub: fortalbrz/llmopenfinance
- Companion project: fortalbrz/pyllmrouter – the LLM layer, reusable in other projects
- Also, check out the ollama2cpp project for a simple and optimized migration from the local LLM server ollama to llama-cpp (increase your local token generation rate by tunning algorithm).
License
The companion project pyllmrouter is MIT-licensed too.
Metadata
Release files for llmopenfinance 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llmopenfinance-0.1.1.tar.gz | 184.6 kB | Without provenance | Details for llmopenfinance-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llmopenfinance-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for llmopenfinance-0.1.1-py3-none-any.whl |
Total release size: 298.4 kB
Release files / llmopenfinance-0.1.1.tar.gz
| Download URL | llmopenfinance-0.1.1.tar.gz |
|---|---|
| Size | 184.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f160304974ee5e51c38dd0ffdee537f6fdae6eb33da788c6d55ffc47f1457e0c
|
|
BLAKE2b-256 checksum How to use checksums |
3bb09529b6d1418aa5b17e0719489d4a62b3750f75b67114e8f2aeaf79b9fb7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / llmopenfinance-0.1.1-py3-none-any.whl
| Download URL | llmopenfinance-0.1.1-py3-none-any.whl |
|---|---|
| Size | 113.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71dd00d94d494f33de69f69a0552aa6869a1b16ad973375fa183a3e63edb786e
|
|
BLAKE2b-256 checksum How to use checksums |
14119dec978178a49b079d048235ec39e6cdfac270becc47619ab5926548db05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for llmopenfinance 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.