Skip to main content

ankinote

PyPI version Python versions License Codecov

AI-powered Anki card generator — vocabulary, phrases, sentences, and STEM concepts

📖 About

ankinote is an automated Anki flashcard generator that uses litellm to support a wide range of AI providers — Gemini, GPT, Claude, DeepSeek, and more — for generating definitions, examples, mnemonics, and images, then syncs directly with Anki through AnkiConnect.

✨ Features

  • 🤖 Multi-Provider AI - Powered by litellm, supporting Gemini, GPT, Claude, DeepSeek, and more for text and image generation
  • 🔊 Audio Generation - Text-to-Speech using Google Cloud TTS API
  • 🖼️ AI Image Generation - Automatic image generation via Google AI (Gemini)
  • 🔄 Direct Anki Sync - Seamless integration with Anki through AnkiConnect plugin
  • 📝 Dual-Direction Cards - Supports both word→definition and definition→word learning modes
  • 🎨 Beautiful Templates - Built-in Light/Dark mode responsive card templates
  • Batch Processing - Generate multiple cards from word lists efficiently
  • 🌐 Multi-Language - Japanese, English (US), and extensible for more languages
  • 🧮 STEM Concepts - Math, science, and programming concept cards with MathJax rendering

🚀 Quick Start

Prerequisites

  • Python 3.13+
  • uv package manager
  • Anki with AnkiConnect plugin installed
  • An API key for at least one AI provider (see Configuration below)

Installation

# Install from PyPI
uv pip install ankinote-ai

# Or install the CLI as an isolated uv tool
uv tool install ankinote-ai

# Configure API credentials
# Create a .env file in your working directory and add your API keys

Configuration

Create a .env file with your API keys. At minimum, you need one AI provider key and the Google TTS key:

# At least one AI provider (for text and image generation)
DEEPSEEK_API_KEY=your_deepseek_key
# GEMINI_API_KEY=your_gemini_key
# OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...

# Google Cloud TTS (for audio generation)
GOOGLE_TTS_KEY=your_tts_api_key

# AnkiConnect (defaults to http://localhost:8765)
ANKI_CONNECT_URL=http://localhost:8765

ankinote CLI - Usage Guide

Overview

The ankinote CLI is a powerful command-line tool for generating AI-powered Anki flashcards with automatic definitions, examples, pronunciations, audio, and images.

Commands

The CLI currently provides four card types. Run ankinote <type> --help or ankinote <type> <command> --help for the complete, current option list.

Word cards

# Create the word note type and deck in Anki
ankinote word init

# Add one word
ankinote word add serendipity

# Add multiple words, either as arguments or from a file
ankinote word batch serendipity ephemeral eloquent
ankinote word batch --file words.txt

Phrase cards

ankinote phrase init
ankinote phrase add "look after"
ankinote phrase batch "focus on" "call off"
ankinote phrase batch --file phrases.txt

Sentence cards

The sentence argument should be in the native language; the target-language version is generated for the card back.

ankinote sentence init
ankinote sentence add "我今天起晚了。"
ankinote sentence batch --file sentences.txt

STEM cards

ankinote stem init
ankinote stem add "What is a derivative?"
ankinote stem batch --file topics.txt

Common options

Language-learning commands accept --native, --target, and --llm. Batch commands also accept --file and --rpm. STEM commands accept --llm, and can additionally configure diagram generation with --image-model and --image-size.

For example:

ankinote word add serendipity --native English --target 'Chinese(Simplified)'
ankinote word batch --file words.txt --rpm 30
ankinote stem add "State Bayes' theorem" --image-size 1024

Troubleshooting

Error: "AnkiConnect not available"

  • Make sure Anki is running
  • Check that AnkiConnect add-on is installed
  • Verify AnkiConnect is listening on port 8765

Error: "No images found"

  • Some STEM topics may not need a generated diagram
  • Check the configured image model with ankinote stem add --help

Error: "API key not found"

  • Check your configuration file
  • Ensure environment variables are set
  • Verify API keys are valid

Getting Help

# General help
ankinote --help

# Command-specific help
ankinote word --help
ankinote phrase --help
ankinote sentence --help
ankinote stem --help
ankinote word batch --help

📦 Tech Stack

  • Language: Python 3.13+
  • Package Manager: uv
  • AI/ML: litellm (Gemini, GPT, Claude, DeepSeek, etc.)
  • TTS: Google Cloud Text-to-Speech API
  • Image Generation: Google AI (Gemini)
  • Anki Integration: AnkiConnect
  • Card Templates: HTML + CSS

🔧 API Services

AI Provider (via litellm)

  • Text generation for definitions, examples, and mnemonics
  • Image generation (Gemini) for card visuals
  • Supports Gemini, GPT, Claude, DeepSeek, Qwen, and more

Google Cloud TTS

  • High-quality audio generation
  • Multiple voice options

AnkiConnect

  • Direct communication with Anki
  • Real-time card creation
  • Deck management

📝 Usage Examples

Single Word

from ankinote import CardGenerator

generator = CardGenerator()
card = generator.generate("ephemeral")
generator.add_to_anki(card, deck="Vocabulary")

Batch Processing

words = ["ephemeral", "serendipity", "eloquent"]
for word in words:
    card = generator.generate(word)
    generator.add_to_anki(card)

🛠️ Development

# Clone the repository
git clone https://github.com/ignity21/ankinote-ai.git
cd ankinote-ai

# Install the project and development dependencies
uv sync

# Run tests
make test

# Format code
make format

# Type checking
make check

Documentation

📄 License

MIT License - see LICENSE file for details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ankinote_ai-0.2.0.tar.gz (187.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ankinote_ai-0.2.0-py3-none-any.whl (98.9 kB view details)

Uploaded Python 3

File details

Details for the file ankinote_ai-0.2.0.tar.gz.

File metadata

  • Download URL: ankinote_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 187.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ankinote_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 53cb6500749eb35a4b0423d9df4badc875484a7e2f64ed67b9997c732e4d2ef2
MD5 ca67888aac66a06b0761bac21a04d01c
BLAKE2b-256 127448aa68d3a9ccfe905ff1df9c2b93650abc34aa85770ba5b0f06cf3f0753b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ankinote_ai-0.2.0.tar.gz:

Publisher: publish.yml on ignity21/ankinote-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ankinote_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ankinote_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 98.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ankinote_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71a622a1e832f78af1b9fde4f40a554474a46ffe4ced760957b59f9e948c4020
MD5 f06b0610289e9d0e855c2ea17ec92774
BLAKE2b-256 77ccb64aa41f7790376a877a59426806d3a0daeaa48c0fae614fa2e79acab99c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ankinote_ai-0.2.0-py3-none-any.whl:

Publisher: publish.yml on ignity21/ankinote-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.1

2 files

0.5.0

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page