Pierre Duverneix
Lead maintainer
A Moodle AI provider plugin that integrates Mistral AI into Moodle's AI subsystem, enabling text generation, text summarisation, text explanation, and image generation.
| Setting | Description |
|---|---|
| API key | Your Mistral API key from console.mistral.ai |
| Organisation ID | Your Mistral organisation ID (optional) |
Each action (generate text, summarise text, explain text, generate image) can be configured independently with:
| Setting | Description |
|---|---|
| Model | The Mistral model to use, fetched from the API |
| Endpoint | The Mistral API endpoint (pre-filled with the correct default) |
| System instruction | Custom system prompt (text actions only) |
| Extra parameters | Additional model parameters in JSON format (see bellow) |
{
"temperature": 0.7,
"max_tokens": 500,
"top_p": 0.95,
"safe_prompt": false
}
Refer to the Mistral API documentation for all supported parameters.
Text generation, summarisation, and explanation all use the Mistral chat completions API (/v1/chat/completions).
Image generation uses Mistral's agent API, which internally uses Black Forest Labs' Flux model. The flow is:
The image generation agent is created once and its ID is cached in Moodle's plugin config via set_config() to avoid hitting API rate limits. If the cached agent is deleted from Mistral Studio, it is automatically recreated on the next request.
Images are generated using Black Forest Labs' Flux aspect ratio:
| Moodle ratio | Size | Aspect |
|---|---|---|
| Square | 1024-1024 | 1:1 |
| Landscape | 1792-1024 | 7:4 |
| Portrait | 1024-1792 | 4:7 |
Developed by Fondation UNIT.