Skip to content

Anknote

PyPI version Python 3.13+ License: MIT

Anknote is a command-line tool that automatically generates Anki flashcards from your markdown notes using AI models. Transform your study materials into effective spaced repetition cards with minimal effort.

Features

  • ๐Ÿค– AI-Powered Generation: Uses LiteLLM to support multiple AI models (OpenAI, Anthropic, Google, etc.)
  • ๐Ÿ“ Markdown Processing: Automatically processes markdown files and directories
  • โš™๏ธ Configurable: Flexible configuration via files, CLI arguments, and environment variables
  • ๐Ÿ”„ Batch Processing: Process multiple files at once with progress tracking
  • ๐Ÿ“Š TSV Output: Generates Anki-compatible TSV files for easy import
  • ๐Ÿ›ก๏ธ Robust: Built-in error handling, retry logic, and validation
  • ๐Ÿงช Well-Tested: Comprehensive test suite with 100% coverage

Quick Start

Installation

Recommended: Use uvx (uv tool) for the best experience:

uvx anknote --help

This runs Anknote without permanent installation. For regular use, you can also install with pip:

pip install anknote

Command Line Usage

Set up your AI API key first:

# For OpenAI (recommended for beginners)
export OPENAI_API_KEY="your-openai-api-key-here"

# Or for Anthropic Claude
export ANTHROPIC_API_KEY="your-anthropic-api-key-here"

Generate flashcards from a single markdown file:

# Using uvx (recommended)
uvx anknote my-notes.md

# Or if installed with pip
anknote my-notes.md

Process an entire directory of markdown files:

# Using uvx
uvx anknote notes/ -o flashcards/

# Or if installed with pip
anknote notes/ -o flashcards/

The generated .tsv files can be directly imported into Anki!

How It Works

  1. Extract Content: Anknote reads your markdown files and extracts the content
  2. AI Processing: The content is sent to an AI model with a carefully crafted prompt
  3. Parse Cards: The AI response is parsed to extract question-answer pairs
  4. Generate TSV: Cards are saved in Anki-compatible TSV format for import

Example

Given a markdown file like this:

# Python Basics

Python is a high-level programming language. It was created by Guido van Rossum
and released in 1991. Python emphasizes code readability and uses significant
indentation.

## Key Features
- Interpreted language
- Dynamic typing
- Object-oriented programming

Anknote generates flashcards like:

  • Q: What is Python? A: A high-level programming language created by Guido van Rossum
  • Q: When was Python released? A: 1991
  • Q: What does Python emphasize? A: Code readability and uses significant indentation

Next Steps