OpenAI API provider
Moodle LMS’s integration with OpenAI provides access to AI Actions such as generate text, generate image or summarise course content.
More information about OpenAI can be found at https://platform.openai.com.
Requirements:
An OpenAI account with access to a paid API key.
When setting up an OpenAI account with an API key, although keys can be generate by both free and paid accounts, API usage is restricted based on the paid tokens available on the account. Access to the API used by the Moodle LMS integration requires a subscription to one of OpenAI’s paid API plans (such as pay-as-you-go). Access, usage limits and pricing tiers are dependent on the model used, so it is best to check the OpenAI API pricing page for the latest information.
Configuring OpenAI API Provider settings
- Go to Site administration -> General -> AI -> AI providers.
- Enable the "OpenAI API Provider" by clicking on the “Enabled” toggle.
- Click on the "OpenAI API Provider" settings link.
- In the “Settings” area proceed to configure the following:
- OpenAI API key: You can get the key from your OpenAI account / API Keys (OpenAI API keys).
- OpenAI organization ID: You find this in your OpenAI account / Organization settings page (OpenAI account). (This is a required field for Moodle LMS 4.5.0, but will be optional from 4.5.1.)
- Set site-wide rate limit: An optional feature to limit the number of requests that the OpenAI API Provider can receive across the entire site every hour.
- Maximum number of site-wide requests can be configured after enable “Set site-wide rate limit”.
- Set user rate limit: An optional feature to limit the number of AI requests each user can make to this provider each hour.
- Maximum number of requests per user can be configured after enable “Set user rate limit”.
- In the “Actions” area you can control which available Actions are enabled and configure further Action settings.
Configuring OpenAI API Provider actions
The following Action settings are available for the OpenAI Provider.
Generate text: You can configure the following settings:
- AI model: OpenAI API is powered by a diverse set of models with different capabilities and price points. There is more information about at OpenAI Models. By default, the model is set to “GPT-4o”, but this can be configured to any other compatible model. For more details, see your organization's settings and limits information.
- API endpoint. Please ensure your API endpoint is compatible with your selected model. For more information, visit Model endpoint compatibility.
- System instruction: There are default system instructions in place to help direct the expected response format from the AI, but these can be customised to suit your specific needs. These are used to ensure a smooth user experience where only the requested text generation is returned, with no salutations, repetition of the request etc. It is therefore recommended these are not modified unless you are confident the change is absolutely necessary.
Summarise text: The required configuration is the same as for the Generate text Action.
Generate image: You can configure the following settings:
- AI model: The default is set to “dall-e-3” but it can be changed to any other image generation compatible model. For more details, visit: DALL-E Models.
- API endpoint: Please ensure your API endpoint is compatible with your selected model.
With all of the above enabled and configured, the OpenAI Provider can be used for all of the AI Placements available in your Moodle LMS instance; Course Assistance and HTML Text Editor Placements. Don't forget to also enable and configure AI Placements settings.