Anki Ai Automation

AnkiWeb addon 1186735228

Uses your OpenAI API key to batch transform Anki note fields from Browser selections or saved workflows, supporting cleanup, rewriting, tagging, and field generation.
AI-generated summary; may contain mistakes.

ainote-management

Open on AnkiWeb GitHub Ask about alternatives

AnkiWeb

Rating
1 (πŸ‘ 1 Β· πŸ‘Ž 0)
Updated
2026-04-20
Anki versions
25.09.2~
Description language
en

Maintenance

active

  • Last update or commit was 164 days before the snapshot (2026-04-20).

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
25.0925.09.2+2026-04-20
History across monthly snapshots

Loading…

Similar addons

AI Explainer

Generates concise, exam-focused AI explanations for existing Anki cards during review or batch, using OpenAI or Gemini, writing to a chosen field.

card-creationainote-managementobsolete

Rating 0 πŸ‘ 0 Β· πŸ‘Ž 0 ⭐ 3 Anki 23.10~ Updated 2026-01-11
AI Card Translator

Translates Anki cards into another language while preserving originals, using OpenAI or Gemini, with single-card and batch workflows and configurable fields.

card-creationaidictionary

Rating 0 πŸ‘ 0 Β· πŸ‘Ž 0 ⭐ 0 Anki 23.10~ Updated 2025-12-15
AINotePro: AI Text and Audio for Anki

Generates AI text and MP3 audio from note fields via configurable OpenAI-compatible providers and Edge TTS, supporting prompt templates, vision OCR, batch notes, and local settings storage.

card-creationai

Rating 1 πŸ‘ 1 Β· πŸ‘Ž 0 ⭐ 2 Anki 26.05~ Updated 2026-06-27

README

AI Automation

<p align="center"> <a href="https://buymeacoffee.com/moritzowitsch"> <img src="https://img.shields.io/badge/Buy%20Me%20a%20Coffee-FFDD00?style=for-the-badge&logo=buymeacoffee&logoColor=000000" alt="Buy Me a Coffee" /> </a> <a href="https://github.com/moritzvitt"> <img src="https://img.shields.io/badge/GitHub-moritzvitt-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub moritzvitt" /> </a> </p>

AI Automation is an Anki add-on for updating note fields with OpenAI from the Browser or from saved workflows. It is intended for batch cleanup, rewriting, tagging, transformation, and field generation tasks where the input can be rendered from note data.

What It Does

  • runs AI-powered note transformations from Browser selections
  • saves reusable workflows for repeated collection queries
  • supports single-field and multi-field output targets
  • includes prompt, preset, and workflow management dialogs
  • supports startup and query-based workflow triggers

Typical Uses

  • rewrite or clean imported note fields
  • generate new content from existing fields
  • append AI output into dedicated target fields
  • standardize note formatting across a deck

Installation

Install the add-on from AnkiWeb if a release is available, or install it manually from a packaged .ankiaddon file.

This add-on requires your own OpenAI API key.

Related Add-ons

If you want a more polished and consistent look across my add-ons, you can also install my Global Styling add-on. It lets you apply a shared design on top of supported add-ons without changing their functionality.

Links

  • Demo video: https://youtu.be/80O47uk6LCI
  • AnkiWeb: https://ankiweb.net/shared/info/1186735228
  • Technical details: ARCHITECTURE.md
ai-automation/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ addon.py
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ config.py
β”‚   β”œβ”€β”€ config_models.py
β”‚   β”œβ”€β”€ config_parsing.py
β”‚   β”œβ”€β”€ config_prompt_library.py
β”‚   β”œβ”€β”€ automation_files.py
β”‚   β”œβ”€β”€ processing.py
β”‚   β”œβ”€β”€ processing_models.py
β”‚   β”œβ”€β”€ processing_support.py
β”‚   β”œβ”€β”€ processing_text.py
β”‚   β”œβ”€β”€ prompt_files.py
β”‚   β”œβ”€β”€ prompting.py
β”‚   β”œβ”€β”€ usage_stats.py
β”‚   β”œβ”€β”€ workflow_engine.py
β”‚   └── workflow_triggers.py
β”œβ”€β”€ services/
β”œβ”€β”€ scripts/
β”œβ”€β”€ prompt_library/
β”œβ”€β”€ ui/
β”œβ”€β”€ docs/
β”œβ”€β”€ tools/
β”œβ”€β”€ user_data/
└── CHANGELOG.md

Installation

  1. Install the add-on folder into Anki's add-ons directory.
  2. Install the official OpenAI client into Anki's Python environment.
  3. Open Anki, go to Tools -> Add-ons -> AI Automation -> Config, and use the settings window to set your API key, choose a model, and open the dedicated Browser and workflow settings dialogs.

To run reusable query-based rules, open Tools -> AI Automation: Workflow Configuration.

If you need to install the dependency manually, use Anki's bundled Python. The exact path varies by platform, but the command is equivalent to:

/path/to/anki/python -m pip install openai

Configuration

The add-on is configured through config.json or Anki's built-in add-on config storage.

In Anki itself, clicking Config opens a structured core settings dialog instead of raw JSON. From there, you can jump into the dedicated Browser settings and workflow settings windows.

The model selector in that dialog loads a curated flashcard-writing shortlist from OpenAI's GET /v1/models endpoint using your API key and labels models with rough cost tiers such as Very cheap, Cheap, Moderate, Expensive, and Very expensive. The note type rules are edited in a small dedicated UI instead of a raw field_mappings JSON block.

Important keys:

  • openai_api_key: your OpenAI API key
  • use_chat_completions_api: toggles Chat Completions vs Responses API for generation
  • model: the default model used for generation
  • prompt_template: the default user prompt with placeholders like {{Front}}
  • system_prompt: the default system prompt
  • field_mappings: per-note-type input and output field rules
  • max_retries and request_timeout_seconds: safety controls for batch processing
  • batch_size: how many notes are processed per outer batch
  • max_parallel_requests: limits how many note requests can run at the same time
  • show_tooltips: enables or disables hover help across the UI
  • show_estimate_before_sending: enables the confirmation popup with estimated tokens and cost
  • estimated_output_tokens_per_note: used to forecast output tokens before the request is sent
  • model_pricing: optional overrides for cost estimation when you use a model not covered by built-in pricing
  • saved_prompts, saved_system_prompts, processing_presets: reusable building blocks for Browser runs and workflows
  • workflows, workflow_groups: reusable automations and group organization

Example mapping:

{
  "note_type": "Basic",
  "output_fields": ["Back"]
}

The prompt can reference any field that exists on the note, plus {{NoteType}}. If a referenced field does not exist on a selected note, the add-on will show a clear error for that note instead of sending a broken request.

How It Works

  1. Select cards or notes in the Anki Browser.
  2. Right-click and choose Transform with AI.
  3. The add-on resolves the selected rows to note IDs, then lets you choose a target field or preset, prompt/system prompt, and write mode.
  4. A prompt is rendered from the note fields and sent to OpenAI.
  5. Returned content is written back to the chosen field or fields and saved to the collection.

For rule-based runs:

  1. Open Tools -> AI Automation: Workflow Configuration.
  2. Create workflows with a name, optional Anki query, prompts, target field settings, optional presets, groups, and optional trigger conditions.
  3. Use Refresh Count while editing to preview how many notes the query currently matches.
  4. Run one workflow or an entire group in the stored execution order, or launch them directly from the Browser on the current selection.

Open Tools -> AI Automation Usage to review tracked totals and recent runs. These spend figures are local add-on estimates based on model pricing, not billing-invoice truth.

The same menu also attempts to fetch official OpenAI spend for today, last 7 days, and this month through OpenAI's organization Costs API. That endpoint typically requires an organization admin key; regular project API keys may not have access.

Packaging

To build a .ankiaddon archive manually:

python3 tools/package_ankiaddon.py

The packaging script excludes local user_data, meta.json, and all files under prompt_library/user_prompts/, while still creating an empty prompt_library/user_prompts/ directory inside the archive.

Docs