Transform your notes into Anki flashcards at lightning speed
Project description
ankirai
暗記 (anki) · memorization · 雷 (rai) · lightning
Transform your notes into Anki flashcards at lightning speed using any LLM provider.
Installation
ankirai is available on PyPI. Requires Python 3.13+.
# Recommended — installs into an isolated environment managed by uv
uv tool install ankirai
# Or with pip
pip install ankirai
Or run directly from source:
git clone https://github.com/weavergoldman/ankirai
cd ankirai
uv run ankirai --help
Quick start
ankirai init # first-time setup: pick provider and enter API key
ankirai generate notes.pdf # generate an Anki deck (.apkg)
ankirai generate notes.pdf --review # review cards in the browser before exporting
Commands
ankirai init
Interactive setup. Stores your provider and API key in a platform config file (chmod 600). Run once before your first generate.
ankirai generate [OPTIONS] INPUTS...
Parse one or more input files and generate an Anki deck.
| Option | Description |
|---|---|
--deck, -d |
Deck name (default: first filename stem) |
--model, -m |
Model override |
--provider, -p |
Provider override (gemini, openai, openrouter, ollama) |
--api-key |
API key override |
--format |
Output format: apkg (default), csv, tsv |
--output, -o |
Output file path |
--batch-size |
Cards per LLM request |
--force |
Ignore manifest; reprocess all input files |
--tags |
Comma-separated tags to add to all cards |
--vision / --no-vision |
Override vision capability detection |
--parsing-model |
Use a separate model for image/PDF parsing |
--prompt |
Path to a custom prompt file |
--review |
Open browser review UI before exporting |
ankirai config show
Print current config with API keys redacted.
ankirai config set KEY VALUE
Update a single config value, e.g.:
ankirai config set openai.api_key sk-...
ankirai config set providers.default openrouter
ankirai prompt show
Print the currently active card-generation prompt.
ankirai prompt edit
Open the global prompt in $EDITOR.
ankirai prompt reset
Restore the built-in default prompt.
Providers
| Provider | Key name | Default model |
|---|---|---|
gemini |
GEMINI_API_KEY |
gemini-3.1-flash-lite |
openai |
OPENAI_API_KEY |
gpt-5.4-nano |
openrouter |
OPENROUTER_API_KEY |
google/gemini-3.1-flash-lite |
ollama |
(none) | llama4 |
Claude / Anthropic models: Use OpenRouter with
--provider openrouter --model anthropic/claude-haiku-4-5.
API keys can also be set via environment variables or a .env file in the working directory.
Config resolution
For each setting, the first value found wins:
- CLI flag
- Environment variable
.envfileconfig.toml(platform config dir)- Built-in default
Custom prompts
Prompt resolution order:
--prompt <file>flagankirai_prompt.mdin the current working directory- Global prompt file (
ankirai prompt edit) - Built-in default
The prompt should include {{notes}} where the chunk text will be substituted. Cards support LaTeX using MathJax syntax (\(...\) inline, \[...\] block). Cloze cards use {{c1::term}} syntax.
Review UI
--review launches a local web server at http://localhost:5173 and opens your browser.
Card view — keyboard shortcuts:
| Key | Action |
|---|---|
1 |
Accept |
2 |
Edit (inline) |
3 |
Reject |
[ or ← |
Previous card |
] or → |
Next card |
Bulk view — shows all cards in a paginated table (50 per page). Use the "View" button on any row to jump to that card. Use "Accept all pending" to approve everything at once.
The nav bar shows "Card view" when on the bulk page and "Bulk view" when reviewing card-by-card.
Only accepted cards are included in the exported deck.
Manifest
ankirai tracks which files have been processed in a ankirai_manifest.json in the working directory. Re-running generate on the same inputs skips unchanged files. Use --force to reprocess everything.
Supported input formats
Anything markitdown can parse: PDF, DOCX, PPTX, images (with vision-capable models), plain text, Markdown, and more.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ankirai-0.0.2.tar.gz.
File metadata
- Download URL: ankirai-0.0.2.tar.gz
- Upload date:
- Size: 198.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98ca4f18169768baf6c6a2132f8e104507f7c532567adfcc25bb6003f1a07cfd
|
|
| MD5 |
1f3ed4612ff46cfe357fb25aecc51f0b
|
|
| BLAKE2b-256 |
8850afe73adf5959d9ab7dfc5d31b588ddbdc9a94221c6544bed65e2c0bb5fc7
|
File details
Details for the file ankirai-0.0.2-py3-none-any.whl.
File metadata
- Download URL: ankirai-0.0.2-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86a9dc8be3684963fe6c0e32046b3ea0d331fd9c7f4568437a4cfea0146c8cad
|
|
| MD5 |
c030aa209012211f47b8a2a312a63d75
|
|
| BLAKE2b-256 |
be47f4da3a60a43f147df7e7e1213e9da7cb84fc749876a187f8e265528b9022
|