I built a new tool to automate the tedious parts of creating Anki flashcards. I wrote anki-api. It is a minimal CLI and web tool that lets AI agents draft cards for you from almost any source material. It integrates directly with your local Anki database while keeping you firmly in control of the final review.
Keeps you in the driver seat
It automates content acquisition. It scrapes websites. It downloads YouTube transcripts. It parses DOCX files. It also automates the logistics of orchestrating processes and managing JSON state.
But it deliberately does not automate quality judgment. Agents propose. Humans approve.
I replaced arbitrary heuristic validation rules with a 384-line cognitive science document. The framework is based on the EAT principles (Encoded, Atomic, Timeless). Agents must read this document before generating a single card. The prompt maps database normalization theory directly to flashcard design. First normal form means atomicity. Third normal form means no contextual shortcuts.
Agent-native
I was inspired by the Agent-Native Architecture guide from Every. I wanted feature parity between the human user and the AI.
Whatever you can do through the UI, the agent can achieve through tools. Both use the exact same atomic primitives. You can use the CLI to add, edit, or delete cards. Therefore, your agent can also use those exact same hooks to manage your decks, beyond just adding new cards. You bring your own agent subs, no API keys or per-usage cost beyond what you have already.
No heavy frameworks
I wanted a minimal stack. There is no LangChain. There is no LlamaIndex. The heavy lifting is done with boring, well-understood libraries like requests, click, and pydantic.
The entire process lifecycle is managed by roughly 60 lines of Python calling tmux commands. You do not need Docker. You do not need systemd.
When you run anki-api up, it simply spawns a detached tmux session with your FastAPI backend on top and your Vite dev server on the bottom.
The Web UI and MathJax
I originally built this purely for the terminal. Later, I tested Anthropic’s UI generation to prototype a web frontend. The result was a surprisingly clean React interface, so I made it a permanent part of the project.
You can trigger a full pipeline with a single command passing URLs or local file paths:
anki-api flow [https://example.com/article]
This checks if Anki is running, spawns a Claude agent, launches the web stack via tmux, and opens your browser. If you pass a youtube URL, it’ll get the transcript automatically and generate from it.
The web UI streams the agent’s thought process in real time over WebSockets. You watch the agent think, scrape, and reason about the EAT principles. Then it drops you into a clean review interface to approve or skip the drafted cards.
I also added MathJax support recently. I am studying linear algebra and needed perfectly formatted matrices. The formatting aligns precisely with Anki standards, so the web interface previews exactly how your equations will look in the desktop app.
Running it yourself
If you have Anki Desktop running with the AnkiConnect plugin, you can try this right now. The code is completely open source.
You will need Python 3.11+ and uv installed.
# Clone the repo and sync dependencies
uv sync
# Generate cards from any URL or file path and launch the review UI
uv run anki-api flow [https://youtube.com/watch?v=example]