π€ Gemini Chat for Anki

An intelligent AI chat assistant seamlessly integrated into your Anki study sessions. Get instant help with grammar explanations, translations, examples, and custom questions while reviewing your cards.
π Overview
Gemini Chat for Anki brings AI-powered assistance directly into your Anki reviewer. Whether you need grammar explanations, translations, or want to ask custom questions about your cards, this add-on makes your study sessions more interactive and productive using Google's Gemini API.
β¨ Key Features
- π¬ Embedded Chat Window β Built directly into the Anki reviewer
- π― Context-Aware Responses β AI automatically receives your card content
- βοΈ Per-Deck Configuration β Different prompts for different decks
- π Multiple Note Type Support β Works with various card templates
- βοΈ Custom Prompts β Ask any question about your cards
- π§ Flexible API Support β Compatible with Gemini and other AI models
π Installation
Quick Install from AnkiWeb
- Open Anki
- Go to Tools β Add-ons β Get Add-ons...
- Enter code:
1725302966
- Click OK and restart Anki
AnkiWeb: https://ankiweb.net/shared/info/1725302966
Manual Installation
-
Clone or download this repository:
git clone https://github.com/YuValeryc/Anki-AI-assitant.git
-
Copy to your Anki add-ons directory:
- Windows:
%APPDATA%\Anki2\addons21\
- macOS:
~/Library/Application Support/Anki2/addons21/
- Linux:
~/.local/share/Anki2/addons21/
-
Restart Anki
βοΈ Initial Configuration
Step 1: Get Your Gemini API Key
- Visit Google AI Studio
- Sign in with your Google account
- Click Create API Key
- Copy the generated API key
Step 2: Configure the Add-on
- In Anki, go to Tools β Gemini Chat Config
- In the configuration window:
- Paste your API Key in the API Key field
- Leave the API Endpoint as default (or customize if needed)
- Click Save
π― Enabling Chatbot for a Deck
Follow these steps to configure the chatbot for a specific deck:
Step 1: Open Deck Configuration
- Go to Tools β Gemini Chat Config
- In the configuration window, you'll see:
- Deck Selector dropdown at the top
- Note Type Selector below it
- Prompt Configuration area
Step 2: Select Your Deck
- Click the Deck Selector dropdown
- Choose the deck you want to enable the chatbot for
- The add-on will scan for available note types in that deck
Step 3: Choose Note Type
- Click the Note Type Selector dropdown
- Select the note type you're using for your cards
- The add-on will display available fields for that note type
Step 4: Configure Prompts
You have two options:
Option A: Use Pre-defined Prompts
- In the Prompt Templates section, you'll see options like:
- Explain Grammar
- Translate Sentence
- Provide Examples
- Simplify Explanation
- Select the prompt that matches your study needs
- Click Save
Option B: Create Custom Prompt Template
- Select Custom Prompt from the dropdown
- In the text area, write your custom prompt template
- Use field placeholders like
{Front}, {Back}, {Word}, etc.
- Example custom prompt:
Explain the grammar structure of: {Sentence}
Also provide 2 example sentences using the same pattern.
- Click Save
Step 5: Test the Configuration
- Open your deck and start reviewing
- You should see a Chat button in the bottom-right corner
- Click it to test the chatbot
π Using Custom Prompts During Review
There are two ways to use custom prompts:
Method 1: Quick Custom Question (Recommended)
- While reviewing a card, click the Chat button
- In the chat window, select Custom Prompt from the dropdown
- The input field below will become enabled
- Type your question (the card fields are automatically included)
- Examples:
- "Can you give me 5 more example sentences?"
- "What's the difference between this word and its synonym?"
- "Explain this grammar point in simple terms"
- Click Send
Method 2: Pre-configured Custom Prompts
- Configure custom prompt templates in Tools β Gemini Chat Config
- Save multiple prompt templates for different purposes
- During review, select your saved template from the dropdown
- Click Send
π‘ Usage Examples
Example 1: Language Learning Deck
Deck: Japanese Vocabulary
Note Type: Basic
Fields: Word, Reading, Meaning, Example
Configuration:
Example 2: Medical School Deck
Deck: Anatomy
Note Type: Cloze
Fields: Text, Extra
Configuration:
Example 3: On-the-Fly Questions
While reviewing any card:
- Click Chat button
- Select Custom Prompt
- Type specific questions like:
- "What are common mistakes with this concept?"
- "Can you create a mnemonic to remember this?"
- "Give me a real-world application example"
π§ Advanced Configuration
Multiple Note Types in One Deck
If your deck contains multiple note types:
- Open Tools β Gemini Chat Config
- Select your deck
- Configure each note type separately:
- Set up prompts for Note Type 1
- Click Save
- Select Note Type 2 from dropdown
- Set up prompts for Note Type 2
- Click Save
- The add-on will automatically use the correct prompt based on the card's note type
Custom API Endpoints
To use a different AI model:
- Go to Tools β Gemini Chat Config
- Change the API Endpoint field
- Adjust the API Key accordingly
- Click Save
Field Mapping
The add-on automatically detects your card fields. You can use them in custom prompts:
- Use curly braces:
{FieldName}
- Common field names:
{Front}, {Back}, {Word}, {Sentence}, {Extra}
- If a field is missing, it's safely skipped
π οΈ Troubleshooting
Chat Button Not Appearing
- β
Ensure add-on is enabled: Tools β Add-ons
- β
Restart Anki after installation
- β
Make sure you're in the reviewer (not deck browser)
No Response from AI
- β
Check API key in Tools β Gemini Chat Config
- β
Verify internet connection
- β
Check API rate limits (Gemini has daily limits)
- β
Review console logs: Press
Ctrl + Shift + (Windows) orCmd + Shift + (macOS)
Incorrect or Empty Fields
- β
Open configuration and verify note type selection
- β
Check that field names match exactly (case-sensitive)
- β
Ensure the card has content in those fields
Custom Prompt Input Disabled
- β
Make sure you selected "Custom Prompt" from the dropdown
- β
The input field only activates when Custom Prompt is selected
- β
Try clicking the dropdown again to refresh
Configuration Not Saving
- β
Click Save button after changes
- β
Restart Anki
- β
Check file permissions in add-on directory
π Debug Logging
For detailed troubleshooting:
- Go to Tools β Gemini Chat Config
- Enable Log to Console and/or Log to File
- Reproduce the issue
- Check logs:
- Console:
Ctrl + Shift + (Windows/Linux) orCmd + Shift + (macOS)
- Log File: Located in the add-on directory
π€ Contributing
Contributions are welcome! Feel free to:
- π Report bugs via GitHub Issues
- π‘ Suggest new features
- π§ Submit pull requests
- π Improve documentation
π License
This project is open source and available under the MIT License.
π Acknowledgments
- Built for Anki β the powerful spaced repetition system
- Powered by Google Gemini API
- Made with β€οΈ for the Anki learning community
π Support
Happy Learning! π