demo-small.mp4
Dynamically import notes from Trilium Notes into Anki as flashcards,
with optional Ollama (local AI) powered card generation.
By Gibran Ali
https://gibranali.com
-
Locate your Anki addons folder:
- Windows:
%APPDATA%\Anki2\addons21\ - macOS:
~/Library/Application Support/Anki2/addons21/ - Linux:
~/.local/share/Anki2/addons21/
- Windows:
-
Copy the
trilium_anki_addon/folder into that directory:addons21/ └── trilium_anki_addon/ ├── __init__.py ├── config.json ├── manifest.json ├── addon_config.py ├── trilium_client.py ├── ollama_client.py ├── anki_importer.py ├── config_dialog.py └── trilium_sync.py -
Restart Anki. You should see two new entries under Tools:
Sync from Trilium NotesTrilium Sync Settings
- Open Trilium → Options (top-right gear icon)
- Go to the ETAPI tab
- Click Generate new token, copy it
- In Anki: Tools → Trilium Sync Settings
- Set your Trilium URL (default:
http://localhost:8080) - Paste your ETAPI Token
- Click Test Connection — you should see your Trilium version
- Install Ollama: https://ollama.com
- Pull a model:
ollama pull llama3 - In Settings: check Ollama (Local AI), set URL + model name
- Click Test Ollama Connection
- Tools → Sync from Trilium Notes
- Search notes by keyword, or filter by label (e.g.
#ankior#study) - Select one or more notes from the list
- Choose generation mode:
- Manual — note title becomes the Front, content becomes the Back
- AI (Ollama) — Ollama generates smart Q&A cards automatically
- Click ⚙ Generate Preview — review and edit cards in the table
- Click ✅ Import to Anki
- Tag notes in Trilium with
#ankito easily filter them for import - Cards are deduplicated — re-importing won't create duplicates
- All imported cards get a
triliumtag (configurable in Settings) - The preview table is fully editable before importing
- Works with Trilium running locally or on a server (update URL accordingly)
| Problem | Fix |
|---|---|
| "No Trilium token set" | Go to Settings and paste your ETAPI token |
| Connection refused | Make sure Trilium is running; check port/URL |
| Ollama timeout | Model might be slow; try a smaller model like phi3 or mistral |
| Cards not appearing | Check the deck name in Settings matches exactly |
| JSON parse error from Ollama | Try a different model; some handle JSON better (llama3, mistral) |
- Anki 2.1.50+
- Trilium Notes 0.50+ (for ETAPI support)
- Python 3.9+ (bundled with Anki)
- Ollama (optional, for AI mode): https://ollama.com