Skip to main content
The Ollama provider enables running local language models on your machine using Ollama.

Configuration

string
required
Set to "ollama"
string
Ollama server URL. Defaults to http://localhost:11434
string
required
Model name: llama3.2, mistral, qwen2.5-coder, etc.
number
Sampling temperature (0.0-2.0). Defaults to 0.7.

Example Configuration

Installation

  1. Install Ollama:
  2. Pull a model:
  3. Verify it’s running:

Supported Models

  • Llama 3.2: llama3.2, llama3.2:3b, llama3.2:1b
  • Llama 3.1: llama3.1:70b, llama3.1:8b
  • Qwen: qwen2.5-coder, qwen2.5, qwen2.5:32b
  • Mistral: mistral, mistral-nemo, mistral-large
  • Vision: llava, llava:13b, bakllava
  • Code: codellama, deepseek-coder, starcoder2
Browse all models at ollama.ai/library

Capabilities

Tool Call Handling

Ollama models sometimes produce tool calls in quirky formats. The provider auto-fixes these:

Pattern 1: Nested Wrapper

The provider unwraps this to {"name": "shell", "arguments": {"cmd": "ls"}}.

Pattern 2: Prefixed Names

  • tool.shellshell
  • tools.file_readfile_read

Pattern 3: Normal

Standard format is passed through unchanged.

Vision Support

Vision models (llava, bakllava) support image input:
Images are sent as base64-encoded data in the images array:
Note: Ollama only supports base64-encoded images, not URLs. HTTP URLs are automatically skipped.

Remote Ollama Server

To connect to a remote Ollama instance:

Code Example

From src/providers/ollama.zig:

Thinking-Only Responses

Some models produce “thinking” content without final output:
The provider returns a preview:

No Authentication

Ollama runs locally and does not require authentication. All requests are sent without credentials.

Performance Tips

  1. GPU Acceleration: Ollama automatically uses GPU if available (NVIDIA, AMD, Apple Metal)
  2. Model Size: Smaller models (3B, 7B) run faster on consumer hardware
  3. Context Window: Reduce num_ctx in Ollama for faster inference
  4. Quantization: Use quantized models (q4_0, q5_K_M) for better performance