Hans Jarett Ong
Lab Note2026

Anki LLM Field Filler

An Anki desktop add-on that automatically populates target card fields via OpenAI-compatible LLM APIs right as notes are mined with Yomitan and AnkiConnect.

PythonAnki Add-onLLMYomitanJapanese Study

While actively advancing my Japanese study with Yomitan and AnkiConnect, I wanted newly mined vocabulary cards to automatically include natural example sentences, pitch/nuance notes, and short mnemonics—without running an extra local proxy server, risking port conflicts, or hacking Yomitan templates.

Anki LLM Field Filler solves this by hooking directly into Anki’s native anki.hooks.note_will_be_added lifecycle event inside the desktop client.

Anki LLM Field Filler architecture diagram showing Yomitan, AnkiConnect, note_will_be_added hook, batched JSON-mode LLM call, and populated target fields

How It Works

  1. Zero-Conflict Hook Pipeline: When Yomitan sends a freshly mined card through AnkiConnect, Anki fires note_will_be_added just before writing the note to the collection—eliminating extra servers or port conflicts.
  2. Rule-Based Prompt Templates: Matches enabled rules by note type and target field, skips already-populated fields by default (overwrite_if_not_empty optional), and substitutes {FieldName} placeholders from the card’s existing fields.
  3. Single Batched JSON-Mode Call: All matching target fields for a note are filled in one structured JSON-mode request across OpenAI, Google Gemini, OpenRouter, Local Ollama, or any custom OpenAI-compatible endpoint.
  4. Visual Qt Settings & Release Automation: Ships with a native Qt settings dialog featuring clickable {FieldName} chips, dynamic /models refresh, a live Test Prompt preview, a pytest unit test suite, and GitHub Actions workflows that package versioned .ankiaddon releases.