Skip to content
Esc
↑↓navigate↵open⌘Jpreview
Start
On this page

Ollama

Run open-source models on your own hardware with Ollama. Autohand sends model requests to your local Ollama server.

What is the Autohand Ollama integration?

The Autohand Ollama integration connects the coding agent to an Ollama server and a locally installed model. The model runs on your hardware, Autohand sends requests to your Ollama server, and no cloud model API key is needed.

Status Available
Requires A running Ollama server, an installed model, and enough local compute and memory for that model.
Configure with Start Ollama, pull a compatible model, set ollama.baseUrl when the server is not at http://localhost:11434, and select the ollama provider.
Best for Running open-source models on your own hardware.

Overview

Ollama provides a simple way to run large language models locally. When integrated with Autohand, you get:

  • Models run on your own hardware
  • Model requests go to your Ollama server, not a cloud model API
  • No API costs - run unlimited queries at no charge
  • Low latency - responses come from your local hardware
  • Model flexibility - choose from dozens of open-source models

Installation

Install Ollama on your operating system to get started with local models.

macOS

Download and install Ollama using Homebrew or the official installer:

# Using Homebrew (recommended)
brew install ollama

# Or download from ollama.com
curl -fsSL https://ollama.com/install.sh | sh

# Verify installation
ollama --version

Start the Ollama service:

# Start Ollama server (runs in background)
ollama serve

# Or run as a macOS service
brew services start ollama

Linux

Install Ollama using the official install script:

# Download and install
curl -fsSL https://ollama.com/install.sh | sh

# Verify installation
ollama --version

# Start the service
sudo systemctl start ollama

# Enable on boot
sudo systemctl enable ollama

For manual installation or specific distributions:

# Ubuntu/Debian
sudo apt update
sudo apt install -y curl
curl -fsSL https://ollama.com/install.sh | sh

# Fedora/RHEL
sudo dnf install -y curl
curl -fsSL https://ollama.com/install.sh | sh

# Arch Linux (AUR)
yay -S ollama

Windows

Download the Windows installer from the Ollama website or use winget:

# Using winget
winget install Ollama.Ollama

# Or download the installer from:
# https://ollama.com/download/windows

After installation, Ollama runs as a Windows service automatically. Verify by opening PowerShell:

# Check Ollama is running
ollama --version

# List available models
ollama list

Pull your first model

The CLI’s Ollama default is llama3.2:latest, for general use. For coding, start with Qwen2.5-Coder 7B, or try 14B if your machine has enough memory:

# Pull a coding-optimized model
ollama pull qwen2.5-coder:7b

# Or use Llama 3.2 for general tasks
ollama pull llama3.2

# Verify the model is available
ollama list

CLI configuration

Configure Autohand to use Ollama as your model provider in ~/.autohand/config.json:

{
  "provider": "ollama",
  "ollama": {
    "baseUrl": "http://localhost:11434",
    "model": "qwen2.5-coder:7b"
  }
}

Or choose the provider and model for one run. AUTOHAND_PROVIDER overrides the configured provider; the server address still comes from ollama.baseUrl, because the CLI does not read OLLAMA_HOST or AUTOHAND_MODEL for Ollama:

AUTOHAND_PROVIDER=ollama autohand --model qwen2.5-coder:7b

Configuration options

Option Description Default
baseUrl Ollama server URL http://localhost:11434
model Model name to use llama3.2:latest
contextWindow Context window in tokens, when the model metadata does not provide one Model metadata

Keep-alive, GPU layers and the generation context size (num_ctx) are Ollama server or Modelfile settings, not Autohand config keys.

Tool calling depends on the model and server. An OpenAI-compatible endpoint alone does not guarantee usable tool calls. Confirm that the selected model, its chat template and your server support the tools your task needs. Memory use also grows with context size; these examples are starting points, not performance guarantees.

Available models

Ollama supports a wide range of open-source models. Here are the recommended ones for coding tasks:

Coding models

Model Parameters Starting point
qwen2.5-coder:7b 7B Start here for local coding
qwen2.5-coder:14b 14B Try when your machine has more memory available

General-purpose models

Model Size RAM Best for
llama3.2:3b 2.0GB 4GB Quick responses
llama3.2:latest 4.7GB 8GB General tasks
mistral:7b 4.1GB 8GB Efficient reasoning
mixtral:8x7b 26GB 48GB Expert-level tasks

Pull and switch models

# Pull multiple models
ollama pull qwen2.5-coder:7b
ollama pull qwen2.5-coder:14b
ollama pull llama3.2

# List installed models
ollama list

# Switch models in Autohand
autohand config set ollama.model "qwen2.5-coder:14b"

# Or open the model picker in a session
/model

GPU acceleration

GPU acceleration significantly improves inference speed. Ollama automatically detects and uses available GPUs.

macOS (Apple Silicon)

Apple Silicon Macs use Metal for GPU acceleration automatically. No additional configuration needed.

# Verify Metal is being used
ollama run llama3.2 --verbose

# Check GPU memory usage
sudo powermetrics --samplers gpu_power -i 1000 -n 1

Linux (NVIDIA)

Install NVIDIA drivers and CUDA toolkit:

# Ubuntu/Debian
sudo apt install nvidia-driver-535 nvidia-cuda-toolkit

# Verify CUDA is available
nvidia-smi

# Ollama will automatically use CUDA
ollama run llama3.2 --verbose

Linux (AMD)

Install ROCm for AMD GPU support:

# Install ROCm
sudo apt install rocm-hip-libraries

# Set environment variable
export HSA_OVERRIDE_GFX_VERSION=10.3.0

# Run Ollama with ROCm
ollama run llama3.2 --verbose

Windows (NVIDIA)

Ollama on Windows automatically uses NVIDIA GPUs with CUDA support. Ensure you have the latest drivers installed.

# Check GPU is detected
nvidia-smi

# Ollama uses GPU by default
ollama run llama3.2 --verbose

Configure GPU layers

The number of model layers that run on the GPU is an Ollama server or Modelfile setting, not an Autohand config key. Ollama picks a value automatically; see the Ollama documentation to change it.

Commands

Use these commands to interact with Ollama through Autohand:

Switch to Ollama

# Start Autohand with Ollama
autohand --provider ollama --model qwen2.5-coder:7b

# Or open the model picker during a session
/model

Model management

# List available models
ollama list

# Show model details
ollama show qwen2.5-coder:7b

# Remove a model
ollama rm qwen2.5-coder:7b

# Copy/rename a model
ollama cp qwen2.5-coder:7b my-qwen-coder

Server management

# Start Ollama server
ollama serve

# Check server status
curl http://localhost:11434/api/tags

# List running models
curl http://localhost:11434/api/ps

Memory management

Optimize memory usage for your hardware configuration.

Context window

Larger context windows use more memory. The context size Ollama allocates is an Ollama server setting, not an Autohand config key. Set it when you start the server:

OLLAMA_CONTEXT_LENGTH=4096 ollama serve

Model persistence

Control how long models stay loaded in memory with Ollama’s own keep-alive setting (Autohand has no keepAlive key):

OLLAMA_KEEP_ALIVE=5m ollama serve
Value Behavior
0 Unload immediately after request
5m Keep loaded for 5 minutes
1h Keep loaded for 1 hour
-1 Keep loaded indefinitely

Unload models

# Unload all models from memory
curl -X POST http://localhost:11434/api/generate \
  -d '{"model": "qwen2.5-coder:7b", "keep_alive": 0}'

Remote Ollama server

Run Ollama on a remote machine with more powerful hardware.

Server setup

On the remote machine, configure Ollama to accept external connections:

# Set the host to listen on all interfaces
export OLLAMA_HOST=0.0.0.0:11434

# Or edit the systemd service
sudo systemctl edit ollama.service

# Add this content:
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"

# Restart the service
sudo systemctl restart ollama

Client configuration

Configure Autohand to connect to the remote server:

{
  "ollama": {
    "baseUrl": "http://192.168.1.100:11434",
    "model": "qwen2.5-coder:7b"
  }
}

Best practices

  • Match model to task: Start with Qwen2.5-Coder for coding tasks, then verify its changes with your project tests.
  • Size appropriately: Start with smaller models (7B) for quick responses, move to larger ones (13B+) for complex reasoning.
  • Manage memory: Set OLLAMA_KEEP_ALIVE on the Ollama server to unload models when not in use on memory-constrained systems.
  • Use GPU acceleration: GPU significantly speeds up inference. Prioritize VRAM over CPU RAM.
  • Pre-pull models: Download models before starting work to avoid wait times.
  • Monitor resources: Watch memory and GPU usage to avoid system slowdowns.

Start with the 7B coding model

{
  "ollama": {
    "model": "qwen2.5-coder:7b"
  }
}

Use the same model with GPU acceleration

{
  "ollama": {
    "model": "qwen2.5-coder:7b"
  }
}

Try the 14B coding model with more memory

{
  "ollama": {
    "model": "qwen2.5-coder:14b"
  }
}

Troubleshooting

Common issues

Issue Solution
Connection refused Start Ollama server: ollama serve
Model not found Pull the model: ollama pull <model>
Out of memory Use a smaller model or lower OLLAMA_CONTEXT_LENGTH on the server
Slow responses Enable GPU acceleration or use a smaller model
GPU not detected Install proper drivers (CUDA, ROCm, or Metal)

Check server status

# Test the API endpoint
curl http://localhost:11434/api/tags

# Check running models
curl http://localhost:11434/api/ps

# View Ollama logs (Linux)
journalctl -u ollama -f

Debug mode

Run with verbose output to diagnose issues:

# Run Autohand with debug logging
AUTOHAND_DEBUG=true autohand --provider ollama

# Run Ollama with verbose output
ollama run qwen2.5-coder:7b --verbose

Reset Ollama

# Stop the service
sudo systemctl stop ollama

# Clear the cache (Linux/macOS)
rm -rf ~/.ollama/models/.tmp

# Restart
sudo systemctl start ollama
How do I configure the Autohand Ollama integration?

Start Ollama, pull a compatible model, set ollama.baseUrl in ~/.autohand/config.json when the server is not at http://localhost:11434, and select the ollama provider. The CLI does not read OLLAMA_HOST; that variable only configures the Ollama server.

What does the Autohand Ollama integration require?

A running Ollama server, an installed model, and enough local compute and memory for that model.

What limitations should I know about?

Coding quality, tool support, context length, and latency depend on the selected model and local hardware.

Last updated on

Was this helpful?

Send Feedback

Help us improve this documentation page. Your feedback is valuable.

We'll only contact you if we need clarification