OpenAI API provider
Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.
Moodle integration with OpenAI provides a service that lets people use advanced AI tools like generate a text, generate an image or summarize a text.
More information about OpenAI can be found on the following link https://platform.openai.com
Requirements:
An OpenAI account with access to the API key (Usage limits and pricing tiers are dependent on the level of access and the volume of queries).
When setting up an OpenAI account with an API key, users can generate keys with both free and paid accounts, but API usage is restricted based on the account type and payment method. Access to the API requires a subscription to one of OpenAI’s paid plans, such as the Pay-as-you-go or Pro/Enterprise plan, which provide different levels of access depending on the selected pricing tier.
Configuring OpenAI API provider settings
- Go to Admin -> 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 can get it from your OpenAI account / Organization settings page (OpenAI account).
- Set site-wide rate limit: 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
- Maximum number of requests per user can be configured after enable “Set user rate limit”
- In the “Actions” area enable all actions by clicking on their “Enabled” toggle.
Configuring OpenAI API provider actions

Access to the Settings link on each action to configure them.
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 OpenAI models in the following link https://platform.openai.com/docs/models As default is set to “GPT-4o” but it can be change for any other compatible model, see your settings organization limits for more information (https://platform.openai.com/settings/organization/limits)
- API endpoint. Please ensure your API endpoint is compatible with your Model, see more information in the following link https://platform.openai.com/docs/models/model-endpoint-compatibility
- System instruction: There are some system instructions as default, but this can be adapted to your needs.
Summarise text:
The required configuration is the same as for the Generate text action.
Generate image:
You can configure the following settings:
- AI model: As default is set to “dall-e-3” but it can be changed for any other image generation compatible model. See more information in the following link https://platform.openai.com/docs/models/dall-e
- API endpoint: Please ensure your API endpoint is compatible with your Model.

Now we should be able to use OpenAI provider for the AI placements available in our Moodle instance: Course Assistance and HTML Text Editor Placements.
Don't forget to enable and configure AI Placements settings.