AI Flashcards is a Python CLI tool that converts study notes into Anki-compatible flashcards using Google's Gemini models.
- Generates structured question/answer flashcards from local note files.
- Uses Gemini 3 Flash Preview by default (
gemini-3-flash-preview). - Outputs Anki-ready tab-separated text and keeps raw model CSV for traceability.
- Supports configurable model and runtime settings via environment variables and CLI flags.
- Python 3.10+
- A Google Gemini API key
Install dependencies:
pip install -r requirements.txt- Export your API key:
export GEMINI_API_KEY="your_api_key_here"-
Add one or more note files to
./notes/. -
Run the generator:
python src/main.pyYou can pass configuration at runtime (recommended for CI/CD and one-off runs):
python src/main.py \
--model gemini-3-flash-preview \
--temperature 0.2 \
--max-output-tokens 8192 \
--notes-dir ./notes \
--instructions-path ./src/instructions.txt \
--output-dir ./output \
--logs-dir ./logs \
--log-level INFO--model(default fromGEMINI_MODELorgemini-3-flash-preview)--temperature(default fromGEMINI_TEMPERATUREor0.2)--max-output-tokens(default fromGEMINI_MAX_OUTPUT_TOKENSor8192)--notes-dir(default fromNOTES_DIRor./notes/)--instructions-path(default fromINSTRUCTIONS_PATHor./src/instructions.txt)--output-dir(default fromOUTPUT_DIRor./output/)--logs-dir(default fromLOGS_DIRor./logs)--log-file(default fromAPP_LOG_FILEoraiflashcard.log)--log-level(default fromAPP_LOG_LEVELorINFO)
output/flashcards.txt— Anki import file (tab-separated).logs/response.csv— Raw model output before formatting.aiflashcard.log— Detailed application logs.