It’s easy to become overwhelmed when it comes to artificial intelligence (AI). New AI tools seem to be everywhere. Organizations are finding ways to introduce AI tools offering additional services to their clients including customer service, content generation, and marketing. Moodle 4.5 offers AI abilities with the introduction of the new AI subsystem giving organizations a way to connect Moodle to an AI API. Once you add an API, you can enable various abilities such as text/image generation in the text editor and the ability to summarize content. What does this all mean? How does one take their first AI steps? 

Individuals can interface directly with a number of AI tools like ChatGPT and Claude, but when you need to connect AI abilities to another system, you need what’s called an API, or Application Programming Interface. Moodle currently works with Microsoft Azure and OpenAI. More APIs are coming in the near future. Your first AI step begins with identifying an API vendor.

Understanding how APIs work

You need an account with an AI vendor in order to connect this service with Moodle and other applications. Most AI vendors offer free accounts. Once you have an account, you access an API and copy the key to integrate with other tools such as Moodle. Before you can use it, you must have credit on your account. APIs do not produce results for free.

AI API’s funding model is based on tokens. A token is a fundamental unit of data that is processed by algorithms. Before an API can process a request, the information shared must be broken down into tokens. AI services charge based on the number of tokens processed including both input tokens such as your prompt and output tokens based on the given response. Vendors use token-based pricing such as $0.01 per 1,000 tokens. A 75-word response could equal 100 tokens. 

It can be difficult to predict how many tokens your organization will need when starting out with AI. Various AI API providers will offer set prices for committing to a set amount of tokens. Start small and scale up based on your needs. Some providers offer pay-as-you-go models. Most AI APIs provide their clients with services like data dashboards to help you monitor usage and predict future costs.

AI vendors can provide different types of information including non-generative and generative. Non-generative AI information does not generate new content. Instead, it’s connected to existing information. Generative AI information, in contrast, does generate new content based on the prompt.

AI Vendors:

Microsoft Azure: Set up free account and pricing information.

OpenAI: Set up free account and pricing information.

To understand the costs of AI in Moodle, here is a sample use of AI in Moodle and how the costs were displayed in the OpenAI dashboard.

Sample search:  

  • Generate text using a 10-word prompt in the text editor and regenerate for a second result
  • Generate an image using a 10-word prompt in the text editor
  • Request a summary of a 2-paragraph announcement and generate a second summary.
  • Request a summary of a 5-paragraph Moodle page

The text and summary requests combined were less than .01 cent. The image request was .12 cents.

Here is an example of how that was displayed in the OpenAI dashboard. Image source: Moodle Image
Here is an example of how that was displayed in the OpenAI dashboard. Image source: Moodle

Using an AI API in Moodle

Once you sign up with an AI service, you are ready for your next step – connecting your API to your Moodle site. Link to AI providers here.

Site Administration > General > AI providers > Settings

Product screenshot. Image source: Moodle Image
Product screenshot. Image source: Moodle

Setting up your API requires knowing your API key and endpoint (Azure) or organizational ID (OpenAI). You can find this information on your AI Dashboard. Set limits in the dashboard for either site-wide or user rate limits to help you manage your budget.

Product screenshot. Image source: Moodle Image
Product screenshot. Image source: Moodle

Your organization can make decisions about what abilities to enable in Moodle such as generating text and images in the text editor and summarizing text.

Product screenshot. Image source: Moodle. Image
Product screenshot. Image source: Moodle.

Where to find AI options in Moodle courses

Once you have added the AI provider information to Moodle, your next step is to dictate where AI actions are available. AI placements link here.

Your options include:

  • Course Assistance Placement – When enabled, the summarize button can be used in any course page to summarize the text. It appears on pages, quizzes, discussions, etc.
  • HTML Text Editor Placement – When enabled, users can generate text and images by selecting the Generate AI content icon. Users will be asked to describe the text they want AI to create. For images, users can choose standard or high quality images and square, landscape, or portrait shapes. Select “Next” to start the process to search for text or images. Regenerate if you want to change the search.

Once you have turned on AI abilities in Moodle, your next step is to identify what roles in Moodle need access to AI abilities.

Who has AI abilities?

Your organization can turn off access to specific AI functionality by editing role permissions. For example, if you want teachers to have the ability to generate text, but not students, edit the student role.

Site Administration > Users > Define roles > Student > Use the filter option to search for AI.

Product screenshot. Image source: Moodle Image
Product screenshot. Image source: Moodle

First use of AI in Moodle

The first time the user attempts to interact with AI, that user will be presented with an AI usage policy that they must accept. If a user does not accept, the user cannot use the AI features. Once they accept, they will not be asked again. The AI usage policy can be edited via a language pack customization to match your organization’s AI policy.

Want to learn how to choose the best API provider for your organization? This article offers valuable insights to help you make an informed decision.