How to Set Up an AI Chatbot in Moodle: A Step-by-Step Guide
Apr 02, 2025
29 min read

Pavel
Backend Developer

In the modern world, artificial intelligence has ceased to be just a promising technology from the future – it is now a necessary tool for effective and profitable business. The benefits of AI are especially evident in the field of education, where automation and personalization of communication with students become the key to success.
Using AI-chatbot in the Moodle educational platform allows you to significantly save resources: reduce costs for technical support, free up the time of teachers and administrators for more important tasks, and provide prompt responses to student requests around the clock.
In the educational field, where it is important to respond quickly to requests from students and teachers, the AI assistant becomes an indispensable assistant.
Here are four main reasons why your business needs:
Reduced technical support costs
- You no longer need to maintain a large support staff. An AI bot can automatically answer user questions, relieving your team of workload and saving your budget.
24/7 work
- Unlike live operators, an AI chatbot is available 24/7. Students can receive instant answers to questions at any time of the day, even at night or on holidays.
Improving quality of service and response speed
- AI instantly analyzes the request and gives an accurate answer without making users wait. This increases student satisfaction and reduces the burden on teachers.
Easy scalability and flexibility
- Regardless of the number of students and teachers, the AI chatbot can process thousands of requests simultaneously without losing the quality of service. In addition, it can be adapted to specific courses, disciplines, and organizational objectives.
Artificial intelligence has long been used in various business areas, helping to automate processes and increase efficiency. In the field of education, AI chatbots have become a real breakthrough, as they make it possible to provide high-quality support to students without the constant participation of teachers.
What Types of AI Assistants are there?
AI can be divided into several categories depending on its tasks:
- Chatbots for user support – answer questions, help with site navigation, and solve technical problems.
- AI for personalized learning – analyzes the student’s level of knowledge and offers individual educational materials.
- Content generators – create text, graphic, or audio materials based on the request.
Why OpenAI?
There are many AI solutions on the market, but OpenAI takes a leading position thanks to the following advantages:
- High accuracy of answers: “OpenAI GPT models are trained on massive amounts of data and are capable of producing meaningful, detailed, and contextually relevant answers.
- Flexibility and customization – with OpenAI, you can customize the chatbot for specific business tasks, including supporting students in Moodle.
- Easy integration – API OpenAI allows you to quickly implement AI into any platform, including Moodle, with minimal technical knowledge.
- Constant development – OpenAI regularly updates its models to improve accuracy, functionality, and safety.
In this article, we will show how to quickly and easily set up an AI chatbot in Moodle so that tomorrow, you can use all the benefits of this technology in your educational institution.
This step-by-step guide will help you install and properly configure the AI plugin for Moodle, connect it to OpenAI, integrate it into courses, and provide each student with access to knowledge 24/7. You no longer need to worry that students will be left without answers to important questions – intelligent assistants are always in touch, ready to help at any time of the day or night.
The AI chatbot will take over 24/7 assistant, answering student questions about courses, helping them understand the materials, and reducing the burden on faculty and administrative staff. This effective solution makes the learning process more convenient and accessible.
Do you Want a Ready-Made Solution Without the Hassle?
We know that navigating APIs, Moodle settings, and AI integrations isn’t always easy. One mistake, and the chatbot won’t connect, the API key won’t work, and students will be left without help.
Imagine: your Moodle bot is already working, helps students, is integrated into your courses and automatically answers questions. You don’t need to waste time on complex settings, testing the API, or understanding the code – everything is already set up perfectly.
If you want to quickly and without headaches implement an AI assistant into your educational platform, contact us. We will help you launch an AI chatbot in Moodle, customize it to suit your tasks and make sure it works stably without extra costs.
Ready to get started? Then let’s move on to setup!

Before integrating the AI chatbot into Moodle, we need to get access to the OpenAI API, which will process requests and generate responses. To do this, you need to follow a few simple steps:
Registration in OpenAI
To integrate an AI chatbot into Moodle, the first step is to register with OpenAI API. Without this, you will not be able to obtain an API key and use the chatbot. Follow the instructions below to register quickly. Registration is free, but to use the API, you will need to top up your balance.
- Go to the OpenAI site and press Sign Up
- Selecting a registration method
You have several options:
- Register by email.
- Login via Google, Microsoft, or Apple.
Recommendation: use Google or Microsoft – it’s safer and more convenient since you don’t have to remember a new password. For example, let’s log in through Google – just select an account and click Continue.
Next step: OpenAI will ask you to provide information about yourself:
- Full name – You can use your real name or a company name.
- Date of birth – needed to confirm age.
This data is used to personalize your account but does not affect anything critical.
OpenAI will ask you to select your level of technical knowledge:
- Very technical – for developers who know how to work with APIs and programming.
- Somewhat technical – if you have basic technical knowledge, but the API is not familiar to you.
- Not technical – if you are not a developer but want to use OpenAI.
Recommendation: If you don’t plan to understand the code deeply, choose Not technical – this will make your future work easier.
- OpenAI will offer to invite the team to your project, but this step can be skipped if you work alone.
- At this point, OpenAI will create an API key, which is needed to connect to Moodle.
But to show where you can create a key later, we’ll skip this step.
The next step is to top up your balance with $5 – this is enough for the first requests. Later, the balance can be replenished as needed.
You can also skip this step to show where to top up your account manually.
Congratulations, you now have an account with OpenAI!
Top up your balance.
After registering for the AI chatbot to work in Moodle, you need to top up your balance in the OpenAI API. The minimum amount for testing – $5, after which you can use the API to make requests.
- Log in to OpenAI API and click on the gear icon ⚙ in the upper right corner.
- From the menu that appears, select Billing.
If you have just joined the platform, OpenAI can give you test tokens. However, availability may vary depending on current promotions and your location.
Before paying, check if you have free credits – this can be done in the section Billing > Credit Grants.
In the Billing section, click Add to credit balance. Select your payment method (credit card). Enter the replenishment amount (we recommend $5 for testing).
Ready! Your account is now replenished
Additional Billing settings
- IN Payment Methods can add or delete payment cards.
- IN Billing History, payment history is displayed.
- IN Preferences You can manage payment settings, including bank details.
Creating an API Key
- Go to Dashboard OpenAI.
- From the left side menu, select API Keys.
- Click the button Create new secret key
- Settings API key

- Name – You can name the key Bot AI so as not to get confused if there are several keys.
- Project – we leave the Default project if you have no other projects.
- Permissions – choose All to give full access to the API.
Click Create secret key. Important! Copy and save the API key since watching it again is forbidden.
- IN Dashboard OpenAI select Assistants in the left menu.
- Click the button Create Assistant.
- Fill in the details:
Basic assistant settings
- Name – Give your AI assistant a meaningful name, e.g., AI-Assistant.
- System Instructions – This is an introductory description that explains to the bot how it should work. For example:
Below is a conversation between a student and an AI-powered virtual assistant for an educational platform. The assistant provides 24/7 support, promptly answers common student questions, and offers personalized recommendations to help students successfully complete their courses.
This text gives the bot a context – it will work as an AI assistant in the educational system.
- Model – Select one of the OpenAI models. For example:
- GPT-3.5-turbo-16k – good for fast and cost-effective queries.
- GPT-4-turbo – more powerful, better understands complex queries, but more expensive.
- GPT-3.5-turbo-16k – good for fast and cost-effective queries.
- Additional settings (optional):
- File Search – if you want the bot to work with downloaded files.
- Code Interpreter – if the AI must execute the code.
- Functions – to connect additional features.
- File Search – if you want the bot to work with downloaded files.
Click Save – now your assistant is ready to work!
Prices for Using OpenAI API
OpenAI uses the system tokens, where each request consumes a certain number of tokens, depending on the length of the text and the model used.

What is a token?
- 1 token ≈ 4 characters of English text or 0.75 words.
- For example, the word “hello” takes 1 token, and the phrase “How are you?” – about 4 tokens.
- The more text in the request and response, the more tokens are consumed.
Cost of operating models (price per 1 million tokens)
GPT-3.5-turbo
- Incoming tokens (Input): $0.50
- Output tokens: $1.50
GPT-4-turbo
- Incoming tokens: $10.00
- Outgoing tokens: $30.00
GPT-4 (standard version)
- Incoming tokens: $30.00
- Outgoing tokens: $60.00
GPT-4-32k (long contexts, large queries)
- Incoming tokens: $60.00
- Outgoing tokens: $120.00
Difference between OpenAI models
OpenAI offers different models, each of which has its own characteristics and cost.
GPT-3.5-turbo – the best balance of price and quality
- Fast, cheap, and great for basic AI chatbots.
- It can process 16k tokens in one request (approximately 12,000 words).
- Good for customer support, answers to questions, and teaching assistants.
GPT-4-turbo – powerful but expensive
- Works faster and is cheaper than regular GPT-4.
- Analyzes the context more deeply, gives more accurate and meaningful answers.
- Can understand difficult questions and work with scientific texts.
- Great choice for educational AI and, development of personalized assistants.
GPT-4 (regular version) – high accuracy but expensive
- The most powerful, but 2 times more expensive than GPT-4-turbo.
- Suitable for legal, medical, and analytical tasks where maximum accuracy is needed.
GPT-4-32k – for working with long texts
- Processes up to 32k tokens in one request (~24,000 words).
- Good for the analysis of large documents, scientific works, and coding.
More expensive than all other models, it is used only for specific tasks.
How to choose a model for your project?
- If you need a fast and cost-effective AI bot for Moodle → GPT-3.5-turbo
- If high accuracy of answers and complex dialogues are required → GPT-4-turbo
- If you need analytics, working with documents, complex tasks → GPT-4 or GPT-4-32k
The choice of model depends on the tasks and budget. For Moodle AI chatbot bot most often, it is enough GPT-3.5-turbo – it is fast, accessible, and does an excellent job of answering typical student questions.
Install the official OpenAI Chat Block Plugin in Moodle
Now that we have an API key and a configured assistant, let’s move on to connecting the chatbot in Moodle. For this we use the official plugin OpenAI Chat Block, available on the Moodle website.
Downloading the plugin
- Follow the link:
https://moodle.org/plugins/block_openai_chat - On the plugin page, click Download and download the ZIP archive.
Please note the Moodle version that you are using – the plugin must be compatible. For example, if you have Moodle 4.1, download a plugin that supports this version.
Placement in the project
Unzip the archive and copy the contents to your project folder:
/blocks/openai_chat/
Make all changes only on a test server to avoid breaking the main site. After all the tests, you can migrate to the main server.
Installation via the Moodle admin panel
- Go to Site administration.
- Moodle will automatically detect the new plugin and prompt you to update the database.
- Click “Upgrade Moodle database now”.
- After the successful update, click Continue.
- The plugin settings window will open the OpenAI Chat Block.
Set up OpenAI Chat Block and Add a Chatbot to Moodle
Congratulations! You’ve successfully installed the OpenAI Chat Block plugin – now it’s time to configure it and connect it to your courses. This is the final and most enjoyable stage – after all, after it, your AI assistant will start working and helping your students 24/7. Once installed, the plugin settings window will open. OpenAI Chat Block. It is important not to close it, as some settings will be lost. If you want to change the settings, you can do so via the Moodle admin panel. In the plugins section, in the blocks section.
Plugin setup OpenAI Chat Block
Here are the key fields that need to be filled out:
- API Key – paste your secret API key from OpenAI
- API Type – choose assistant.
- Restrict usage to logged-in users – leave it enabled (only authorized users will be able to use the bot).
- Assistant name – assistant name displayed in the UI (for example, AI Assistant).
- User name – what the user will be called in the dialogue (for example, Student).
- Enable logging – can be enabled for testing (if you want to save correspondence history).
- Completion prompt – This is an introductory description that explains to the bot how it should work. For example:
Below is a conversation between a student and an AI-powered virtual assistant for an educational platform. The assistant provides 24/7 support, promptly answers common student questions, and offers personalized recommendations to help students complete their courses.
This text gives the bot a context – it will work as an AI assistant in the educational system.
- Source of truth – this is an important field. Here, you can specify a list of typical questions and correct answers that the bot will use as a basis for training. If the AI doesn’t know the exact answer, it will try to find a suitable one from this list. It is recommended to add the most frequently asked questions that students may have in students on any course, especially general and universal.
Example:
Q: How do I submit an assignment?
A: Go to the “Assignments” section of your course and click “Submit Assignment”.
Q: How can I check my grades?
A: Visit the “Grades” page from the course navigation menu.
Q: Where can I find additional materials?
A: Check the “Course Resources” section.
Q: Who do I contact for technical issues?
A: Use the “Contact Support” link in the course footer or message your course administrator.
Q: When is the deadline for my assignment?
A: You can find all upcoming deadlines in the “Calendar” section of your dashboard.
Q: How do I join a live session?
A: Check the “Zoom Sessions” block or “Live Classes” section in your course.
Q: How do I change my password?
A: Go to “Preferences” > “Change password” in your user menu.
Q: Can I retake a quiz?
A: This depends on your instructor’s settings. Check the quiz description or contact your teacher.
Q: What if I miss a deadline?
A: Contact your teacher as soon as possible. Some courses allow late submissions with penalties.
Q: How do I access my course?
A: After login, go to “Dashboard” and select the course from your list.
Q: How do I message my teacher?
A: Go to the “Participants” list, find your teacher, and click the message icon.
- Model – select the desired model (gpt-3.5-turbo, gpt-4, gpt-4-turbo, etc.) gpt-3.5-turbo-16k – recommended for Moodle, because: Cheaper, supports long messages (up to 16,000 tokens), works stable and fast.
- Temperature – level of creativity of the model – recommended 0.5 – neutral style.
- Max length – maximum number of tokens per response – recommended 500. Enough for a detailed answer and does not spend a lot of credits
- Top P – how much the bot will use different answer options. – recommended – 1 – this way the bot will use the entire available vocabulary. If you set it less (for example, 0.7), it will become more “predictable”.
- Frequency penalty – recommended 0.5 – reduces repetition of the same words in the answer.
- Presence penalty – influences the model’s “desire” to talk about something new. Recommended 0.5 — the bot will add something new, but within reason.
Assistant binding and dialog management
After you have installed the plugin and connected it to OpenAI, you will see another page with additional parameters OpenAI Chat Block.
Assistant – select your assistant that you created earlier in OpenAI Assistants. It is he who will respond to users. Example: AI assistant.
Persist conversations – Enable this option (the checkbox is on by default) so that the bot saves the dialogue history when moving between pages of the same course. This is convenient for students – they can continue the conversation without starting over.

Adding a chatbot to the Moodle interface
Now, let’s add the chat itself to the interface of your site so that students can use it:
- Go to Dashboard (Moodle home page).
- Turn on Edit mode.
- At the bottom of the sidebar, click “Add a block”.
- From the list, select “OpenAI Chat Block”.
- A new block will appear on the page. You can move it to the desired location (for example, to the right, so that it is always at hand).
- Turn off editing mode and the chat is ready to use!

Check: does it work? Ask any question – for example, “How can I check my grades?” — and make sure your AI assistant is responsive. If you added a Source of truth, it will immediately use ready-made answers.
The Final Step: Your Educational Platform has Reached a New Level
If you’ve read this far, you’ve already done a lot more than most.
You:
- Registered on the OpenAI platform,
- We received and connected the API,
- Set up your assistant
- Installed the official plugin
- We integrated the AI chatbot into Moodle.
Now, your website is not just an online learning system. This is a modern space where every student receives instant support 24/7, without distracting teachers or requiring a separate technical support department.
AI assistant answers frequently asked questions, gives recommendations, helps you navigate the course, and makes the learning process easier, faster, and more comfortable.
- No more checking your email at night.
- No more need to hire expensive support.
- Once configured, the bot always works, saves your resources, and makes students happy.
Do you Want Everything to Work Perfectly and Look Professional?
We are in Smart App working with Moodle under lock and key, not limited to plugins:
- We customize Moodle to suit your goals – from basic installation to complex architecture
- We create modern design taking into account UX/UI
- We connect any modules — from OpenAI to SCORM and BigBlueButto.
- We are developing custom modules for the specific tasks of your business
- Optimizing performance and security
- We carry out testing so that everything works like a clock
- We consult and train the team to work with the system
- We take care of maintenance and updates
We’re not just helping with Moodle“.
We turn Moodle into your work tool that solves business problems – reliably, stably, and without pain.
Contact us, and we will create a Moodle for you that will work as it should.
No complications. No headache. No compromises.
You have already taken the first step. We’ll take care of the rest.