Skip to main content

AI-powered Anki deck generator: turn a CSV of word pairs into a multimedia .apkg with TTS and illustrations.

Project description

Anita — AI-Powered Anki Deck Generator

CI License: Apache 2.0 Python Ruff uv

Turn a plain CSV of word pairs into a rich, multimedia Anki deck with AI-generated native-like pronunciations and optional illustrations — in minutes, for any language pair.

Why Anita?

Language learners lose hours building decent flashcards by hand. Anita automates the tedious part — generating TTS audio (OpenAI or ElevenLabs) and optional DALL·E images — so you can focus on reviewing, not curating. Feed it a CSV, get back a .apkg you can import straight into Anki on desktop or mobile.

Table of contents

Features

  • CSV in, .apkg out — point it at a two-column CSV and get a ready-to-import Anki deck.
  • Pluggable TTS — OpenAI tts-1 by default, ElevenLabs multilingual v2 optional.
  • Optional illustrations — DALL·E 2 images auto-resized to 128×128 px for clean cards.
  • Local media cache — every generated asset is cached in a SQLite DB so repeat runs are free and fast.
  • Language-agnostic — works for any source → target language pair.
  • Clean card template — distraction-free front/back with audio playback and image.

Quickstart

# Install
uv tool install anita-anki  # or: pipx install anita-anki

# Set credentials
export OPENAI_API_KEY=sk-...
# Optional:
export ELEVENLABS_API_KEY=...

# Generate
anita generate examples/basics.csv my_deck.apkg --deck-name "My Vocabulary"

Import my_deck.apkg into Anki and start reviewing.

Installation

From PyPI (recommended)

uv tool install anita-anki
# or
pipx install anita-anki
# or
pip install anita-anki

The distribution is published as anita-anki on PyPI (the name anita was taken), but the import name and CLI are both anita.

From source (development)

git clone https://github.com/timpara/anita.git
cd anita
uv sync --all-extras
uv run anita --help

Usage

CLI

anita generate INPUT.csv OUTPUT.apkg [OPTIONS]

Common options:

Flag Default Description
--deck-name Anita Vocabulary Deck name shown inside Anki.
--tts openai TTS provider: openai or elevenlabs.
--images / --no-images --no-images Generate DALL·E illustrations per card.
--voice-id (elevenlabs preset) ElevenLabs voice ID.
--verbose false Enable debug logging.

Run anita generate --help for the full list.

Python API

from anita import AnkiDeckGenerator

generator = AnkiDeckGenerator(
    deck_name="Italian Restaurant",
    tts_provider="elevenlabs",
    generate_images=True,
)
generator.generate_deck("examples/restaurant.csv", "restaurant.apkg")

CSV format

Two columns: source word (prompt side) and target word (answer side). Header row is optional and auto-detected.

apple,mela
house,casa
book,libro
water,acqua

Working examples live in examples/.

Configuration

API keys are read from environment variables. A .env file in the working directory is auto-loaded if present.

Variable Required for
OPENAI_API_KEY OpenAI TTS, DALL·E
ELEVENLABS_API_KEY ElevenLabs TTS (optional)

Generated media is cached under your OS user-cache directory (via platformdirs) so re-running on the same words incurs zero API cost.

Cost estimate

Service Use case Model Approximate cost
OpenAI TTS tts-1 $0.015 / 1k characters
OpenAI Image generation DALL·E 2 $0.020 / image (256×256)
ElevenLabs Premium TTS v2 Per your subscription tier

A 500-word deck with audio-only (OpenAI) typically costs well under $0.50.

Contributing

Contributions welcome! See CONTRIBUTING.md for dev setup, coding style, and PR conventions. By participating you agree to the Code of Conduct.

To report a security issue, please see SECURITY.md.

License

Apache License 2.0 © 2024–present Anita contributors.

Acknowledgments

  • genanki — Anki deck construction.
  • OpenAI — TTS and image generation.
  • ElevenLabs — premium multilingual voices.

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

anita_anki-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

anita_anki-0.1.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file anita_anki-0.1.0.tar.gz.

File metadata

  • Download URL: anita_anki-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for anita_anki-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50f48f79771adb1bff0f7c309a984b59bd71d98475f8d1c2c0d0f8b9bf058786
MD5 0b9590610dbec8cf37dfc40d36cd6913
BLAKE2b-256 e93e0c1039ebbdd2178bac8081c1e02f947a49e4579f66546f5f6c4e878910f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for anita_anki-0.1.0.tar.gz:

Publisher: release.yml on timpara/anita

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

File details

Details for the file anita_anki-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: anita_anki-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for anita_anki-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ce7cdd70336fc1d2a5d8ccafc9a89956c739b37cae79e554b3fc6381179e7ed
MD5 045a96769e9e0fa67b743193ce4bcd16
BLAKE2b-256 9112ce9a4f6b911fc35e5be7edd12acf934925c1b218e298ca8d0db821f54ac8

See more details on using hashes here.

Provenance

The following attestation bundles were made for anita_anki-0.1.0-py3-none-any.whl:

Publisher: release.yml on timpara/anita

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page