The Ollama integration lets you run AI models locally on your own machine.
With a local installation your emails never leave your computer: no API key, no cloud services, no costs beyond your hardware.
An API key is only needed if you use Ollama's hosted API, or a server behind a proxy that requires authentication.
| API key required | Free option | Private / Local? | Best for |
|---|---|---|---|
| No (optional) | Yes (completely free, you use your hardware) | Yes (everything stays on your machine) | Privacy-conscious users, sensitive emails, offline use |
Prerequisites
- Ollama installed and running on your machine (or accessible on your local network)
- At least one model downloaded in Ollama
- Thunderbird with ThunderAI installed
Installing Ollama and downloading a model
If you haven't installed Ollama yet:
- Download it from ollama.com and follow the installation instructions for your OS
- Open a terminal and pull a model, for example:
ollama pull llama3
Other good options for email tasks:mistral,phi3,gemma2 - Verify Ollama is running:
ollama list
Configuring CORS
Thunderbird extensions run in a sandboxed environment, so Ollama needs to accept requests from them. There are two ways:
- Set the
OLLAMA_ORIGINSenvironment variable tomoz-extension://*and restart Ollama. - Or give ThunderAI the permission to access your Ollama server, with the Give permission to the current host button
in the ThunderAI settings (under "Problems setting CORS?"), or by accepting the request that appears when you test the connection.
For a server on
localhostor127.0.0.1, Thunderbird asks for access to all websites (<all_urls>).
For more detailed CORS configurations, see the Ollama CORS Information page.
Setup
The quickest way is the Setup Wizard: open it from the ThunderAI welcome page, the toolbar popup or the
settings page, choose Ollama API (Local LLM), enter the server address, choose a model and test the connection.
The wizard then lets you turn on the AI features you want.
To set it up by hand, follow the steps below.
1. Open the ThunderAI settings
In Thunderbird, go to Tools → Add-ons and Themes → ThunderAI → Preferences.
2. Select the Ollama integration
In the Connection Settings panel, choose Ollama API (Local LLM) in the Connection Type dropdown.
3. Set the server address
Enter the URL of your Ollama server in the Host Address field. The default is:
http://localhost:11434
If Ollama is running on another machine on your network, replace localhost with that machine's IP address.
Leave the Ollama API Key field empty for a standard local installation. It is only needed for the hosted API at
ollama.com, or for a self-hosted server behind a proxy that requires authentication.
4. Choose a model
Click Update list next to Ollama Models, then select the model you want to use from the list.
5. Test the connection
Settings are saved as soon as you change them: there is no Save button.
Click Test now in the bar below the connection settings and accept Thunderbird's permission request, if it appears
(see Configuring CORS). When everything is fine, the bar shows "Connected — Ollama API (Local LLM) reachable".
Then open any email, click the ThunderAI toolbar button and run a prompt.
Advanced options
Click Advanced options in the Connection Settings panel to show the settings below. They adapt to the selected model.
- System Prompt: sent at the start of every conversation, to give the model a role or standing instructions.
- Enable thinking: makes the model reason before answering. The available reasoning levels depend on the model and are listed once it is selected. Model default sends nothing and lets the model decide, which on some models means it reasons anyway: choose Off to turn the reasoning off.
- Temperature: higher values make the answers more creative. The default is 0.8; values between 0 and 1 are recommended.
- Number of context tokens: how much text the model can take into account. ThunderAI shows the maximum the selected model supports. Set 0 to use the server default.
- Keep model loaded: how long Ollama keeps the model in memory after a request, e.g.
5mor30m,-1to keep it loaded,0to unload it at once. Empty uses the server default (5 minutes). Raise it if Add Tags, the spam filter or the automatic summary run on incoming mail: otherwise the model is reloaded for every message. - Force JSON output: makes Ollama return valid JSON, with the models that support structured output.
- Extra options: additional parameters for Ollama, as a JSON object, e.g.
{"top_p": 0.9, "seed": 42}or{"num_predict": 512}.
You can also set these options on a single prompt, in the custom prompts page, and on each AI feature (Add Tags, Spam Filter, Summarize, Translate, Calendar Event, Task), with the Advanced options button of its specific connection.
Tips
- Performance depends on your hardware. A modern machine with at least 16 GB of RAM will handle models like
llama3ormistralcomfortably. A GPU significantly speeds things up. - Smaller models (7B parameters) are faster but less capable; larger models (13B, 70B) produce better results but require more resources.
- For email tasks,
mistralandllama3are popular choices offering a good balance of quality and speed. - If the automatic features (Add Tags, Spam Filter, Summarize, Translate) stop with a timeout on a slow model, increase Special command timeout (ms) in the ThunderAI settings.
Troubleshooting
"Failed to connect" or no response
Check that Ollama is actually running (ollama list in a terminal). Verify that the Host Address in the ThunderAI settings matches your Ollama setup.
CORS error
The OLLAMA_ORIGINS variable is either not set or Ollama was not restarted after setting it. Follow the steps in Configuring CORS again, or use the Give permission to the current host button instead.
Empty model list
Make sure you have pulled at least one model with ollama pull <modelname> and that Ollama is running.
The model reasons even if you do not want it to
Some models reason by default. Set Enable thinking to Off in the advanced options.