Moodle AI with a self-hosted Ollama server: when to keep prompts in your own infrastructure
If a compliance or IT lead wants Moodle's AI features without sending prompts to a cloud provider, the Ollama provider is the route to check first. Moodle's Ollama provider (aiprovider_ollama) connects Moodle's AI subsystem to an Ollama server, and it supports the generate text, summarise text and explain text actions. When the Ollama server runs in your own data center or cloud accounts, the prompts Moodle sends for those actions travel to infrastructure you control rather than to a third-party AI service. This choice suits organizations whose data residency rules, contracts or internal policies rule out external model providers for student or staff content, and teams that already operate GPU or CPU capacity and can run a model service with an owner.
The provider is configured in Moodle with an API endpoint, optional basic authentication, a model for each action and extra parameters in JSON. Ollama's own documentation says that local runs do not expose your prompts or data to Ollama, and that cloud features can be turned off with OLLAMA_NO_CLOUD=1 or the server configuration file. Confirm that setting on the exact Ollama release you deploy, because the answer depends on how the server is configured and not only on the provider in Moodle. Ollama also binds to 127.0.0.1 on port 11434 by default, so a Moodle server on another host needs a deliberate bind address and a controlled route, which is a network decision to make before any model is chosen.
This page covers the configuration steps, model choice per action, GPU and capacity sizing, the authentication and network controls you should put around the endpoint, and the limits to confirm against Moodle's Ollama provider and the Ollama version you run. Ollama's documented local API has no built-in authentication, so the endpoint must be protected by network placement or a reverse proxy. Treat the model list, the output quality for your languages and the feature gaps compared with cloud providers as items to test in a pilot environment, not as settled facts.
How a Moodle AI request reaches Ollama and where it stops
The request starts with a user action in Moodle, such as a summarise or explain request in course assistance. The Moodle AI subsystem hands it to the Ollama provider, which calls the API endpoint you configure, optionally with basic authentication. Inside your network, the Ollama server runs the chosen model and returns the result. Check that the endpoint stays inside your trust boundary, that any reverse proxy in front of Ollama enforces authentication, and that the cloud branch is off unless you have decided to use it.
Request path from a Moodle user action to a self-hosted Ollama server.
Moodle AI with a self-hosted Ollama server: which provider settings to choose and when each fits
This table compares each Ollama provider setting in Moodle, from the API endpoint to extra JSON parameters, and states when each choice fits and what your team must confirm before a pilot. Read it top to bottom as a checklist for the endpoint and model decisions, then use the proxy row to decide where traffic should terminate.
| Setting | Choose it when | What to confirm before go-live |
|---|---|---|
| API endpoint (local) | Moodle and Ollama run on the same host or private network segment, and prompts should never leave your servers | Ollama listens on 127.0.0.1 port 11434 by default, so Moodle must be able to reach that address from the web or cron host |
| API endpoint (remote or behind a proxy) | Ollama runs on a separate GPU server and Moodle reaches it over your internal network | The OLLAMA_HOST bind address is changed deliberately, and the path through the proxy is restricted to the Moodle servers only |
| Optional basic authentication | A reverse proxy in front of Ollama enforces username and password checks before requests reach the model | Ollama's local API does not require authentication by itself, so the credential must be enforced at the proxy, and the secret is stored and rotated under your policy |
| Model for generate text | You want drafting actions to use a larger or more capable model than the other actions | The model is already pulled onto the Ollama server, and its size fits the GPU or CPU memory you plan to use |
| Model for summarise text | Summaries are frequent and you want a smaller model to keep response times and memory use down | Summary quality is tested on course content that matches your subjects and languages |
| Model for explain text | Students will ask explanations in course assistance and you need consistent tone across the platform | The chosen model produces acceptable answers for the subjects in scope and does not expose content from other courses |
| Extra parameters (JSON) | You need to pass provider-specific options that Moodle does not expose as separate fields | The JSON is valid, the parameters are documented for your Ollama version, and changes are recorded in your configuration management |
| Cloud features switched off | Your policy requires that no request is routed to ollama.com, the setup must stay local | OLLAMA_NO_CLOUD=1 or the equivalent server configuration is set and verified, since cloud models need an API key sent as a Bearer token |
| Ollama cloud endpoint (not used here) | Rarely appropriate for this topic because it sends prompts to a hosted service | Your data processing terms, retention and key handling are reviewed before any use, and the setup is no longer self-hosted |
Sizing GPU and concurrency for Moodle AI traffic
Moodle AI load depends on how many people trigger actions at the same time, not on how many users the site has. A course assistance summary requested by one student and a batch of teacher summaries run during a marking week are very different loads, even on the same site. Ollama handles this with queues. OLLAMA_NUM_PARALLEL sets how many requests a model serves at once, and the default is 1 per model. OLLAMA_MAX_LOADED_MODELS controls how many models stay in memory, and OLLAMA_MAX_QUEUE sets how many requests may wait, with a default of 512. Requests beyond the queue limit fail, so the queue size is a decision about how long users will wait before they see an error.
Hardware sizing follows from those settings. The main drivers are the size of each model you load, the memory it needs, the number of parallel requests you allow, and how many models must be resident at once. Each parallel slot needs room for its own context, so raising OLLAMA_NUM_PARALLEL raises memory use even when the model file stays the same size. If several models are loaded, they compete for the same GPU or CPU memory. Running on CPU only is possible for light, infrequent use, but response times grow with model size and request volume. Ask your hardware provider and Ollama's own documentation for the memory figures for each model you intend to use, and confirm them before you buy or reserve capacity.
Do not size from estimates alone. Benchmark each candidate model on the hardware you plan to use, with prompts that match your real actions (summarise text, explain text and generate text) and a peak load taken from your course calendar, such as assignment deadlines or exam weeks. Record response times, queue depth and any rejected requests at several concurrency levels, then choose the parallelism and queue settings that keep waits acceptable for your users. Repeat the test after any Ollama upgrade, because the defaults and behaviour can change between releases. Run this benchmark as part of the pilot described in the placement and rollout sections so that the results reflect the courses that will use the feature.
How Ollama compares with cloud AI providers for Moodle
The first question for most data protection teams is where prompts and generated text are processed. With a self-hosted Ollama server, the model runs on hardware you operate. Ollama states in its FAQ that when it runs locally it does not see your prompts or data. Cloud providers process requests on their own infrastructure, so region, subprocessors and retention are set by the provider agreement.
- Local inference: Moodle sends requests to the endpoint you configure, which in a typical setup is a server inside your network.
- Cloud features off: Setting
OLLAMA_NO_CLOUD=1or the equivalent entry in the server configuration file disables cloud features on the server. - Cloud providers: Prompts leave your network for the provider's infrastructure, so location and retention become contract questions.
- Vendor statement: Ollama's statement covers its local runtime. Confirm that it applies to the version you deploy and to any proxy or logging you add.
Check the endpoint in the Moodle provider settings, then run a test action while monitoring outbound traffic from the Moodle and Ollama hosts.
Access control differs more than most teams expect. The local Ollama API at localhost:11434 does not require authentication, so the protection comes from where the server listens and who can reach it. Direct cloud inference at Ollama's API endpoints requires an API key sent as a Bearer token, as described in Ollama's authentication documentation. Moodle's Ollama provider accepts optional basic authentication, which is usually enforced by a reverse proxy placed in front of Ollama.
- Default bind: Ollama listens on 127.0.0.1 port 11434 unless you change the
OLLAMA_HOSTvariable. - Basic authentication: The provider can send basic credentials, so the proxy in front of Ollama should reject requests that lack them.
- Bearer keys for cloud: Cloud API keys need storage, rotation and removal when staff leave, in the same way as other production secrets.
- Network rules: Firewall rules that limit which Moodle servers can reach port 11434 stay necessary, because the local API does not authenticate.
Confirm which credential scheme your Moodle version sends, and test that an unauthenticated request to the proxy is refused.
Ollama's pricing page states that running models on your own hardware is always unlimited. Cost for a self-hosted server therefore moves to hardware, power, hosting and the staff who run the platform. Cloud usage is paid: the page lists Pro at $20 per month ($200 per year), Max at $100 per month, Team at $500 per month, and Enterprise at custom pricing. Cloud providers bill under their own terms, so compare those terms with your expected action volume.
- Local hardware: Model runs are unlimited, so the cost is the capacity you own or rent, which is a one-time purchase or a recurring hosting charge.
- Staff time: Your team or a partner maintains the server, model updates, monitoring and capacity planning, which recurs.
- Cloud subscriptions: Plans are monthly or yearly, and Enterprise is quoted per contract.
- Enterprise controls: Enterprise adds cost budgets per user or API key and model access controls, which matter when cloud models are in use.
Ask any partner to price hardware, staffing and support separately, so the quote can be compared with a cloud provider's per-usage terms.
Moodle's Ollama provider declares three text actions: generate text, summarise text and explain text, as shown in the provider language strings. Which actions and placements each provider supports depends on your Moodle version and the provider plugins installed. Support for image generation and for particular placements differs between providers, so do not assume that a feature offered for one provider is available for another.
- Text actions: Generate, summarise and explain text are the actions the Ollama provider declares.
- Model per action: You can select a model for each action, so a smaller model may suit summaries while a larger one handles generation.
- Extra parameters: The provider accepts extra parameters in JSON, and their effect varies by model, so test them before a pilot.
- Image generation: Confirm whether the Ollama provider supports image generation in your Moodle version before promising it to editors.
Confirm each action and placement in the provider settings of your own Moodle version before you describe the feature to teachers or students.
Setting up the Ollama endpoint for Moodle, step by step
This sequence takes you from a bare server you control to a tested Moodle AI provider that sends each action to a model on that server, with the endpoint reachable only from the Moodle web tier. Each step ends with a check you can repeat before moving on.
Install Ollama on hardware you control
The platform or infrastructure team installs Ollama on a server in your data center, private cloud or virtual network, using the installer for the operating system in use. Confirm the hardware, operating system and GPU driver stack with the vendor documentation before installation, since model speed depends on them. Record the installed version so later upgrades can be compared against it. The step is done when the service starts and the server answers a local request on port 11434 from the host itself.
Set the bind address for the Moodle web tier
By default Ollama listens only on 127.0.0.1, so Moodle on another host cannot reach it. If the Moodle web tier must connect directly, the platform team sets OLLAMA_HOST in the service environment to a private interface address and port, then restarts the service. Keep the address on a private network segment and avoid 0.0.0.0 on a host with other interfaces. The check is to run a socket listing on the Ollama host and confirm the listener is on the intended interface and not on a public address.
Place an authenticating reverse proxy in front
Ollama's local API does not require authentication, so the platform team puts a reverse proxy such as Nginx in front of it, keeps Ollama bound to a loopback or private address, and enforces basic authentication or client certificates at the proxy. The proxy should accept traffic only from the Moodle web server address and should block cloud routes the deployment does not need. Ask the vendor to confirm the endpoint paths your Moodle version calls. The check is a request from an unapproved host being refused and a request from the Moodle server with valid credentials being accepted.
Move model storage if needed
If the root disk is too small for the planned models, the platform team sets OLLAMA_MODELS to a dedicated volume with enough free space and correct ownership for the Ollama service user. Default locations differ by operating system, so check the Ollama FAQ for the path on your platform before changing anything. Confirm that the service account can write to the new directory and that the volume is included in your backup scope. The check is that the directory is empty or contains expected files after restart and that the service reports the new path in its logs.
Pull the models chosen for each action
The AI administrator and the platform team agree on which models will serve generate text, summarise text and explain text, based on the model sizes that fit the GPU or CPU memory available. They pull each model onto the server with the ollama pull command, then list the installed models to confirm the exact tags. Record each tag, because Moodle needs the name exactly as Ollama reports it. The check is that every planned tag appears in the model list and a short test prompt returns a response from the server.
Configure the Moodle Ollama provider endpoint
A Moodle administrator enables the Ollama AI provider and enters the endpoint URL of the reverse proxy, the basic authentication username and password, and any extra parameters in JSON that the chosen models require. Store the password in the site's configuration with the access rights your change process requires, and restrict who can view it. Ask the vendor to confirm which parameters the installed Moodle release accepts. The check is that the provider's connection test succeeds from the Moodle web server and that the proxy log shows the request arriving from that host.
Assign a model to each action
In the AI provider settings, the administrator assigns one model per action, such as a smaller model for summaries and a larger one for text generation if the hardware allows. Keep the assignments documented alongside the model tags and the hardware they were tested on, so a later model change can be reviewed. Enable only the placements the pilot needs. The check is that the saved configuration displays the intended model for each action without errors.
Test each action and retain the results
A tester signs in as a pilot user with the AI capabilities granted and runs generate text, summarise text and explain text in a test course, recording the time to first response, the output quality and any error messages. Check the Ollama server logs and the proxy logs for each request to confirm that prompts went only to the approved endpoint. Repeat the tests after any change to models, parameters or proxy rules. The check is a signed test record showing each action succeeded from the intended path and no request reached an unexpected address.
Security controls for a self-hosted Ollama endpoint used by Moodle
The Moodle Ollama provider sends prompts to whatever endpoint you configure, so the endpoint is part of your AI data path. These six controls work together: limit where the API listens, put authentication and TLS in front of it, restrict which hosts can reach it, switch off cloud features, and keep records you can review.
Bind Ollama to a private address
Ollama binds to 127.0.0.1 on port 11434 by default. If Moodle runs on a separate server, set OLLAMA_HOST to a private interface address rather than opening every interface. Confirm with a listening-socket check on the Ollama host that the API is reachable only on the address you intended, and that it is not reachable from public networks.
Ollama FAQFront Ollama with a TLS proxy
Ollama's local API has no authentication, so the Moodle provider's basic authentication setting only protects traffic if a proxy enforces it. Place Nginx or a similar proxy in front of the API, require basic authentication, and terminate TLS so credentials and prompts are not sent in clear text. Test that an unauthenticated request is refused and that the Moodle endpoint URL points at the proxy, not the raw port.
Allow-list the Moodle web servers
Restrict the proxy and any firewall rules so that only the Moodle web or cron servers can connect to the Ollama endpoint. Include the outbound addresses of every Moodle node in a cluster, and check that cron-driven tasks run from those same hosts. Test from an address outside the list to confirm the connection is refused.
Disable cloud features
Set OLLAMA_NO_CLOUD=1 in the Ollama environment or in the server configuration file so that the runtime cannot use cloud models. Cloud inference at ollama.com requires an API key sent as a Bearer token, which is a separate data path from your own hardware. Verify after restart that only locally stored models are listed and that no outbound calls to Ollama cloud endpoints occur.
Review access logs on the proxy
Ollama itself does not give you per-user accountability for Moodle requests, so the proxy access log is the main record. Log timestamp, source address, path, status code and the authenticated identity, and keep logs for the period your data protection policy requires. Review them regularly for unexpected sources, failed authentication and request volumes that do not match Moodle usage.
Confirm credential rotation and ownership
The basic authentication credential is stored in Moodle's provider settings, so anyone with Moodle site administration rights can read or change it. Assign a named owner for the proxy credential, record who can change it, and define a rotation process that updates both the proxy and the Moodle configuration in one step. Confirm that the same credential is not reused for other services.
Operating model storage, updates and capacity after go-live
Once the Ollama server is serving Moodle, the ongoing work is keeping the runtime current, managing model files and watching capacity. Ollama ships frequent releases, so treat each upgrade as a change to test rather than a routine patch. Release v0.40.5 was published on 14 October 2026 and v0.40.6 followed as a pre-release on 16 October 2026. Run the candidate version against a staging copy of the Moodle AI configuration, send the three actions (generate text, summarise text and explain text) and compare outputs and response times before you change production. Read the Ollama GitHub releases notes for each version, and pin the version you have tested so an unplanned update cannot change behavior overnight.
Model files live in the storage path for the operating system, which is /usr/share/ollama/.ollama/models on Linux unless you moved it with the OLLAMA_MODELS variable. Decide who owns that directory, size its volume for the models you intend to keep, and record which model and tag each Moodle action uses. Removing or pulling a model changes what Moodle receives, so review the per-action model settings in the Ollama provider after every model change, and confirm that the extra parameters JSON still matches the model you selected. Monitor queue depth and response times against OLLAMA_NUM_PARALLEL, OLLAMA_MAX_LOADED_MODELS and OLLAMA_MAX_QUEUE, because a full queue shows up in Moodle as slow or failed AI actions for students and teachers.
Confirm the Moodle release pairing before any upgrade of Moodle or the Ollama host. Check the PHP version, the database engine and the minimum starting version in the release notes for the Moodle version you run, for example the Moodle 5.1 release notes and the Moodle 5.3 release notes, and confirm them with your own environment rather than assuming an earlier table still applies. Plan these as separate change windows: Moodle upgrades, Ollama upgrades and model changes each have their own test evidence and rollback step. Record the versions in your operations runbook so auditors and the AI governance group can see what ran on which date.
Limits to confirm before a Moodle AI pilot with Ollama
A self-hosted Ollama provider keeps prompts in your infrastructure, but it also moves capacity, model quality and policy questions onto your team. The cards below list what to confirm in your own environment and with the vendor before any students or teachers use the feature.
Moodle version and AI actions
Confirm which Moodle release on your upgrade path includes the Ollama provider, and which actions it exposes on that release. The provider's language strings list generate text, summarise text and explain text, so check those against the placements you plan to enable. Test the exact build you will run in production, not a development branch, and record the result in your pilot notes.
Provider language stringsImage generation placement support
Ask whether the Ollama provider supports the image generation placement in the text editor. The supported actions listed for the provider do not include image generation, so do not promise editor images to teachers until a test on your Moodle build shows it works. If editor images matter, plan a second provider for that placement and document the data path it creates.
Open model quality per action
Choose candidate open models for each action separately, because summarising course material and explaining a concept place different demands on a model. Build a small test set from your own course content, score the outputs with teaching staff, and check how each model handles your languages and reading levels. Keep the model name and version pinned so results stay comparable across pilot phases.
GPU supply and hardware lead times
Ask your hardware vendor for current delivery dates for the accelerators you need, and confirm the memory each candidate model requires at the quantisation you plan to run. Lead times and supply change, so a quote from last quarter may not hold. Include spare capacity and a replacement path in the plan, since one failed card can take the whole AI feature offline during term.
Endpoint behaviour under peak load
Ollama queues requests per model, and the parallel and loaded-model limits set how many students can be served at once. Measure response times and queue depth with a realistic burst, such as a class starting an assignment together, before you set limits. Confirm how Moodle reports timeouts to users, and decide who watches the endpoint during the first weeks of use.
Ollama FAQPlan and policy fit
Confirm whether your policy allows a cloud plan or only local inference, and whether cloud features are disabled on your servers. Ollama states that local runs do not expose your prompts, and cloud features can be turned off, but your security team should verify this on the version you run. Check the Enterprise plan terms only if you plan to use cloud models, and ask the vendor in writing which features apply to your setup.
Ollama pricingQuestions buyers ask about Moodle AI with a self-hosted Ollama server
What does it cost to run Ollama on our own hardware compared with a paid cloud plan?
Running models on your own hardware carries no per-token or per-seat licence from Ollama. Ollama's pricing page states that running models on your own hardware is always unlimited, while its paid plans apply to cloud models: Pro at $20 per month ($200 per year), Max at $100 per month, Team at $500 per month and Enterprise at custom pricing. Your self-hosted cost is therefore the hardware or cloud compute you provision, its power and cooling or hosting fees, storage for model files, and the staff time to run it. Those costs recur, and they grow with the number of GPUs, the model sizes and the concurrency you need. Ask any partner for a quote that separates one-time setup from recurring operating costs and names each line item.
How long does it take to configure Moodle AI with a self-hosted Ollama server?
The Moodle side is a short configuration: you set the API endpoint, optional basic authentication, a model for each action and any extra parameters in JSON for the Ollama provider. The longer work sits around it. Duration depends on whether an Ollama server already exists, how many models you need to evaluate, how GPU capacity is provisioned, whether traffic is restricted to a private network, how access is limited by course and role, and how many test cycles your academic and data protection teams require before a pilot. Ask for a written scope with a timeline that lists each of these as a separate phase, and confirm the exact sizing decisions with your hardware vendor.
What does our team need to provide for this work?
Plan to provide access to the Moodle site and its administrator account, a named owner for the Ollama host, network rules that let Moodle reach the endpoint, and the list of courses and roles that may use AI. You also need someone who can approve which models are allowed, where model files are stored and how long prompts and logs are kept. Your security team should confirm whether the Ollama port is reachable only from the Moodle server, and your data protection lead should review what Moodle records. Agree on these inputs in writing before work begins so that the scope and quote reflect them.
Can our internal staff set this up without outside help?
Yes, if you have people who already run Moodle administration and Linux server operations. The Moodle provider configuration is a settings task for a site administrator, and Ollama's local API at its default address does not require authentication, which keeps the first test simple. The risk is in the areas around configuration: binding Ollama to an address other than 127.0.0.1 port 11434 through OLLAMA_HOST, placing a reverse proxy such as Nginx in front of it with basic authentication, disabling cloud features with OLLAMA_NO_CLOUD=1, and tuning OLLAMA_NUM_PARALLEL and OLLAMA_MAX_QUEUE for real load. If none of these skills exist in-house, a partner can carry them, but an internal owner should still operate the result.
Do we need a consultant for GPU sizing and a security review?
Sizing and review are the two places where an outside check pays off most, because each choice changes both cost and exposure. GPU sizing depends on the models you pick, their memory needs, how many requests run in parallel and how many models stay loaded at once, which Ollama controls through OLLAMA_MAX_LOADED_MODELS. The security review should cover the exposed endpoint, the basic authentication setup, the firewall rules, log retention in Moodle and on the proxy, and how model files are stored under OLLAMA_MODELS. DeployOpen can plan and implement the Moodle and Ollama deployment in infrastructure you control and prepare the evidence your compliance team asks for. It does not issue audit reports or certifications; independent auditors and certification bodies do that.
How do Ollama Enterprise access controls and budgets differ from running it ourselves?
Ollama's Enterprise plan adds model access controls, cost budgets per user or API key, a dedicated support channel and custom security options on top of the Team plan's features, and its price is set individually. Those controls govern Ollama's cloud service. A self-hosted server has no per-user budget or model entitlement unless you build those controls yourself, for example through the reverse proxy, Moodle role capabilities and course-level access rules. Self-hosting keeps prompts on your infrastructure and removes the per-user metering, but you take on the access and spend governance. Ask any vendor to show exactly which controls apply to prompts that stay on your network.
How DeployOpen scopes and delivers a self-hosted Ollama setup for Moodle AI
DeployOpen treats the Ollama provider as one part of a wider Moodle AI rollout inside your own infrastructure. We agree the endpoint, authentication, model choices and access rules in writing, then build, test, document and hand over the setup so your security and compliance teams can review it.
How we scope
- We confirm where the Ollama server runs, which network path Moodle uses to reach it, and whether it stays on a private segment.
- We list the Moodle AI actions to enable, such as generate text, summarise text and explain text, and the model assigned to each.
- We agree the written scope, deliverables and timeline before work starts, since engagements are fixed-scope and quoted from that scope.
How we build
- We install and configure Ollama with OLLAMA_HOST, a reverse proxy, basic authentication and model storage on hardware you control.
- We set the Moodle Ollama provider endpoint, credentials, per-action models and extra parameters, then test each action in a staging Moodle site.
- We check that cloud features are disabled where required, using OLLAMA_NO_CLOUD=1 or the server configuration file, and record the result.
How we hand over
- We deliver a configuration record covering endpoints, network rules, model list, concurrency settings and the owner of each component.
- We document the data flow from Moodle to Ollama so your data protection and security teams can review what leaves the Moodle server.
- We walk your administrators through model updates, log review and the steps to change a model or rotate credentials.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, covering Ollama version changes and Moodle release upgrades.
- We can retest the endpoint, authentication and access settings after changes to the proxy, firewall or Moodle AI configuration.
- We recommend confirming with your Moodle and Ollama release notes before each upgrade, and we plan the change window with your team.

