The Gemini API Provider plugin integrates Google's Gemini AI models into Moodle's AI framework, enabling powerful AI capabilities across your learning management system. This plugin supports text generation, image generation, and text summarization using Google's state-of-the-art AI models.
- Change selection of endpoint URLs based on selected models: The plugin now dynamically updates the API endpoint URLs according to the chosen Gemini or Imagen models, ensuring optimal performance and compatibility.
- Text Generation: Generate creative and informative text responses using Gemini models
- Image Generation: Create images from text prompts using Google's Imagen models
- Text Summarization: Automatically summarize long text content for better comprehension
- Multiple Model Support: Choose from various Gemini models (Pro, Flash, Flash-Lite) and Imagen models
- Rate Limiting: Configurable global and per-user rate limiting to manage API usage
- Privacy-First: No personal data is stored locally; user identification is anonymized
- Flexible Configuration: Customizable system instructions and API endpoints
- Moodle Integration: Seamlessly integrates with Moodle's core AI framework
- Moodle 4.5+
- PHP 8.0 or higher
- Valid Google AI Studio API key
-
Download the Plugin
- Download the plugin from the Moodle plugins directory
- Or clone from the GitHub repository
-
Install the Plugin
- Extract the plugin to your Moodle installation's
/ai/provider/directory - The final path should be:
/ai/provider/aiprovider_gemini/
- Extract the plugin to your Moodle installation's
-
Install via Moodle Admin
- Log in to your Moodle site as an administrator
- Navigate to Site administration > Notifications
- Follow the installation prompts
-
Configure the Plugin
- Go to Site administration > Plugins > AI providers > Gemini API provider
- Enter your Google AI Studio API key
- Configure rate limiting settings as needed
-
Get a Google AI Studio API Key
- Visit Google AI Studio
- Create a new API key
- Copy the key to your clipboard
-
Configure in Moodle
- Navigate to Site administration > Plugins > AI providers > Gemini API provider
- Paste your API key in the "Gemini API key" field
- Save changes
The plugin supports two types of rate limiting:
- Enable: Check "Set site-wide rate limit"
- Limit: Set maximum requests per hour for the entire site
- Default: 100 requests/hour
- Enable: Check "Set user rate limit"
- Limit: Set maximum requests per hour per user
- Default: 10 requests/hour
- Default:
gemini-2.5-flash - Available: All Gemini models (Pro, Flash, Flash-Lite variants)
- System Instructions: Customizable prompts for consistent AI behavior
- Default:
imagen-4.0-generate-001 - Available: All Imagen models
- Features: High-quality image generation from text prompts
- Default:
gemini-2.5-flash - Features: Intelligent text summarization with configurable instructions
-
Enable AI Features
- Navigate to Site administration > Plugins > AI providers
- Enable the Gemini API provider
- Configure global settings
-
Monitor Usage
- Check rate limiting status in the admin interface
- Monitor API usage through Google AI Studio dashboard
- Access AI Features
- AI features are available in supported activities and resources
- Look for AI-powered options in content creation tools
- Problem: "You need to insert API key before"
- Solution: Verify your API key is correctly entered in the plugin settings
- Problem: "Rate limit exceeded" errors
- Solution: Check your rate limiting settings and increase limits if necessary
- Problem: Models not appearing in dropdown
- Solution: Verify your API key has access to the required models
Enable debugging in Moodle to get detailed error information:
- Go to Site administration > Development > Debugging
- Enable debugging and set appropriate levels
- Check the debug output for detailed error messages
- Documentation: This README and inline help in Moodle
- Issue Tracker: GitHub Issues
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This plugin is licensed under the GNU General Public License v3.0.
- Developer: Andrea Bertelli (andrea.bertelli@unife.it)
- Institution: University of Ferrara, Italy
- Copyright: 2025 University of Ferrara, Italy