AnkiDict is a programmable vocabulary card generator for Anki, powered by local LLMs.
It supports two complementary workflows:
- Interactive Mode – generate a single dictionary card while reading by selecting a word and pressing a global hotkey.
- Batch Mode – generate thousands of cards from any Python iterable using the provided batch API.
AnkiDict uses llama.cpp for local LLM inference, AnkiConnect for creating notes in Anki, and automatically generates pronunciation audio for every card using edge-tts.
- Features
- Requirements
- Installation
- Interactive Mode
- Pronunciation Audio
- Batch Mode
- Customization
- Related Projects
- License
- 📖 Dictionary-style vocabulary cards
- ⚡ Interactive hotkey workflow
- 🤖 Local LLM inference with
llama.cpp - 🔊 Automatic pronunciation audio using
edge-tts - 📦 Batch generation from arbitrary Python iterables
- 🎨 Flexible prompts and note templates
- 🔧 Easily customizable pipeline
Before using AnkiDict, install:
- Python 3.10+
- Anki
- AnkiConnect
llama.cpp- A GGUF model compatible with
llama.cpp
For the interactive workflow:
- Windows: AutoHotkey
- Linux: a desktop keyboard shortcut capable of running a shell command
git clone https://github.com/PrParadoxy/ankidict.git
cd ankidictOr you can download the whole project as a Zip file by clicking on Code > Local > Download Zip and extract the archive.
The Code green button can be found on top of the project.
pip install -r requirements.txtAnkiDict communicates with Anki through AnkiConnect.
- Open Anki.
- Go to Tools → Add-ons → Get Add-ons...
- Install the AnkiConnect add-on.
- Restart Anki.
Anki must be running while cards are being generated.
Download a prebuilt release of llama.cpp from:
https://github.com/ggml-org/llama.cpp/releases
Extract the archive and make sure the llama-server executable can be run from your command line.
- Windows: Add the folder containing
llama-server.exeto your systemPATH. - Linux: Add the directory containing
llama-serverto yourPATH(or place it somewhere already on yourPATH, such as/usr/local/bin).
Next, download a GGUF model of your choice.
Open
config.yaml
and set the MODEL_PATH to your GGUF model.
Refer to the comments in config.yaml for a description of all available configuration options.
Interactive Mode creates a single card from the currently selected word.
Internally, the workflow simply executes
python -m src.generate "<selected word>"The only platform-specific component is how the selected text is passed to this command.
The repository includes an AutoHotkey launcher.
- Install AutoHotkey:
- Run the provided AutoHotkey script
word_capture.ahk.
The default hotkey is
Ctrl + Alt + G
Selecting a word and pressing the shortcut opens a card editor populated with AI-generated content. You can review and modify any field before confirming, at which point the note is added to your chosen Anki deck.
Install xclip (X11)
sudo apt install xclipor wl-clipboard (Wayland)
sudo apt install wl-clipboardThen create a Custom Keyboard Shortcut in your desktop environment (GNOME, KDE, Xfce, etc.).
For X11, use the command
bash -lc 'cd /path/to/ankidict && python -m src.generate "$(xclip -o -selection primary)"'For Wayland, use
bash -lc 'cd /path/to/ankidict && python -m src.generate "$(wl-paste)"'Assign your preferred shortcut (for example Ctrl + Alt + G).
No terminal window will appear—the command is executed directly by your desktop environment.
Every generated note includes pronunciation audio created using edge-tts.
The TTS voice is configurable, making it easy to select different languages, accents, or voices depending on your target language.
Note
LLM inference is performed entirely locally using
llama.cpp. Pronunciation audio is generated throughedge-tts, which requires an Internet connection.
For generating many cards programmatically, use the batch API located in
src/batch.py
The batch API accepts arbitrary Python iterables, allowing cards to be generated from both small collections and very large datasets.
Typical use cases include
- frequency lists
- dictionaries
- subtitle vocabularies
- textbook vocabulary
- corpora
- custom datasets
A complete example is available in
example/derewo.py
which demonstrates generating the 10,000 most common German words from the DeReWo frequency list.
The DeReWo word list is not part of AnkiDict. It is included solely as an example dataset demonstrating how to use the batch API.
DeReWo is distributed by the Institut für Deutsche Sprache (IDS) under the Creative Commons Attribution–NonCommercial 3.0 (CC BY-NC 3.0) license.
AnkiDict is intended to be easily adapted to different languages and workflows.
You can customize:
- LLM prompts
- note templates (including HTML/CSS/JavaScript)
- generated fields
- TTS voice
- the interactive launcher
- the batch processing pipeline
Most configuration is performed through
config.yaml
Every configurable option is documented directly in the file with explanatory comments.
Among other things, you can configure:
- the
llama.cppexecutable path - the GGUF model path
- LLM generation parameters
- prompt templates
- Anki deck and note type
- field mappings
- the
edge-ttsvoice - output formatting
- generation options
For most users, config.yaml is the only file that needs to be edited to adapt AnkiDict to a different language, model, or Anki setup.
Custom Anki note types can be generated directly from the configuration by running
python src/template.pyThe generated note type reflects the fields, templates, and styling defined in config.yaml, making it easy to create custom card layouts without manually editing Anki note types. *.css and *.js files must be placed under asset folder. The template is generated by Ganki as an .apkg file which can be easily installed on Anki software.
A Rust implementation for LLM-powered Anki card generation.
Compared to AnkiDict:
- more mature project
- more strict workflow
- less flexible note template customization
- Written in Rust (AnkiDict is fully written in python)
Repository:
https://github.com/ospalh/anki-llm
A mature Model Context Protocol (MCP) server for Anki.
Compared to AnkiDict:
- general-purpose Anki API
- excellent for automation and AI assistants
- supports many Anki operations beyond vocabulary generation
If you are looking for a programmable interface to Anki rather than an out-of-the-box vocabulary generator, anki-mcp is likely the better choice.
Repository:
https://github.com/steven-kraft/anki-mcp
This project is licensed under the MIT License.
Contributions, suggestions, and pull requests are always welcome.
