This plugin allows you to integrate various LLM services (OpenAI, Google Gemini, etc.) with KOReader.
- Three predefined system prompts for quick access
- Custom prompt input for flexible interactions
- Save AI responses directly as notes for highlighted text
- Configure custom system prompts for different contexts
- Support for multiple LLM providers (OpenAI, Google Gemini)
- Translate highlighted text to a specified language (if enabled in configuration)
- Make sure you have KOReader installed on your device.
- Clone/Download this repo, upzip it and rename the folder "askgpt.koplugin".
- Copy the
askgpt.koplugin
folder to your KOReader plugins directory (koreader/plugins/
). - Restart KOReader.
- Configuration setup: use your favorite text editor to open the configuration.lua file and configure:
- API endpoint (OpenAI or Gemini)
- API key
- Model name
- Custom prompts (prompt1, prompt2, prompt3)
For OpenAI:
api_endpoint = "https://api.openai.com/v1/chat/completions"
model = "gpt-3.5-turbo"
For Google Gemini:
api_endpoint = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent"
model = "gemini-2.0-flash-exp"
- Highlight text in a document.
- Tap the "..." icon in the selection toolbar.
- Choose from these options:
- Prompt 1: Use your first predefined prompt (e.g., "translate to Spanish")
- Prompt 2: Use your second predefined prompt (e.g., "translate to Chinese")
- Prompt 3: Use your third predefined prompt (e.g., "explain in detail")
- Ask AI: Open a dialog to enter your own custom prompt
- Simply tap the prompt button and the AI will process your highlighted text according to the predefined instruction in configuration.lua
- The response will appear in a viewer where you can:
- Read the full conversation
- Save the response as a note for the highlighted text
- Ask follow-up questions
- Tap "Ask AI" in the menu
- Type your custom prompt/question about the highlighted text
- Tap "Ask" to get the response
- The response will show in a viewer where you can:
- Read the full conversation history
- Save the response as a note for the highlighted text
- Ask follow-up questions
- When viewing an AI response, tap "Save as note" to save it as a note for the highlighted text
- The note will be automatically saved and the viewer will close
- You can view saved notes using KOReader's standard note viewing features
- You can maintain a conversation thread with follow-up questions
- The AI considers the document's context (title and author) when responding
- Error messages will help you identify any configuration or connection issues
- Notes are saved directly to the document, making them easily accessible for future reference
This plugin is released under the MIT License. See the LICENSE
file for more information.