I subscribed last week and want to try the Aider lesson but I cannot get Ollama and Aider to talk to each other. Where do I put the model name? Any help would be great.
@AUC_Guide_bot test drill: answering this so the thread has a reply.
Hi dean,
Welcome to the AUC lessons! Below is a simple, step‑by‑step guide for getting Aider to talk to a model that you’ve pulled with Ollama. The exact commands can vary a bit depending on your OS, so treat these as the general ideas – if something looks different on your machine, you can always ask a mentor in the #help‑channel.
1. Make sure Ollama is running and has the model you want
| Step | What to do |
|---|---|
| 1.1 | Open a terminal and start Ollama (usually ollama serve or just run the Ollama app). |
| 1.2 | Pull the model you’d like to use, e.g. ollama pull llama3 (replace llama3 with the model name you prefer). |
| 1.3 | Verify the model is available by running ollama list. You should see something like llama3 7B in the output. |
Tip: Keep the terminal where Ollama is running open – Aider will send HTTP requests to the local server (default
http://localhost:11434).
2. Install / update Aider (if you haven’t already)
pip install -U aider-chat
If you’re using a virtual environment, activate it first. If you run into any trouble installing, a mentor can walk you through the steps.
3. Tell Aider which Ollama model to use
Aider can receive the model name in two common ways:
Option A – Use the --model flag when you start Aider
aider --model ollama:llama3
- Replace
llama3with the exact name you saw inollama list. - The
ollama:prefix tells Aider to talk to an Ollama server.
Option B – Set an environment variable (so you don’t have to type the flag each time)
export AIDER_MODEL=ollama:llama3 # Bash / Zsh
# or
set AIDER_MODEL=ollama:llama3 # Windows CMD
After setting the variable, just run aider and it will pick up the model automatically.
4. Verify the connection
- Run
aider(with the flag or after setting the variable). - You should see a short welcome banner and then a prompt like
>>>. - Type a quick question, e.g.
>>> What is the capital of France? - If Aider returns an answer, the link is working!
If you get an error that mentions “connection refused” or “cannot reach Ollama”, double‑check that the Ollama server is still running and that the port (11434 by default) hasn’t been blocked by a firewall.
5. (Optional) Choose a different Ollama endpoint
If Ollama is listening on a non‑default port or a remote host, tell Aider the full URL:
aider --model ollama:http://my‑host:12345/llama3
or set:
export AIDER_MODEL=ollama:http://my‑host:12345/llama3
Quick checklist
- Ollama server running (
ollama serveor app open) - Desired model pulled (
ollama pull …) - Aider installed (
pip install -U aider-chat) - Model name supplied (
--model ollama:your_modelorAIDER_MODELenv var) - Tested with a simple prompt
If any of these steps give you an error, feel free to drop a reply here or ping a mentor. They can look at the exact error message and help you troubleshoot.
Good luck with the Aider lesson – it’s a great way to see how a local LLM can assist you while you code!
AI assists.