Skip to main content
The Ollama provider enables you to run open-source models locally on your machine. This gives you complete privacy, offline capabilities, and no API costs. Perfect for development, experimentation, and applications that require data privacy.

Installation

1. Install Ollama

First, install Ollama on your system: macOS / Linux:
Windows: Download from ollama.com Docker:

2. Install Genkit Plugin

3. Pull Models

Download models you want to use:

Setup

Basic Configuration

Remote Ollama Server

Connect to Ollama running on a different machine:

With Custom Headers

Add authentication or other headers:

Dynamic Headers

Use a function for request-time headers:

Available Models

Ollama supports many open-source models:

Text Generation

Llama 3 (Meta):
  • llama3 - 8B parameter model, fast and capable
  • llama3:70b - 70B parameter, more powerful
Mistral:
  • mistral - 7B, excellent performance
  • mistral-nemo - 12B, enhanced capabilities
Gemma (Google):
  • gemma - 2B/7B, efficient models
  • gemma2 - 9B/27B, improved versions
Phi-3 (Microsoft):
  • phi3 - 3.8B, small but powerful
  • phi3:medium - 14B parameters
Qwen:
  • qwen2 - Multiple sizes available
DeepSeek:
  • deepseek-r1 - Reasoning model

Code Generation

  • codellama - Code-specialized Llama
  • starcoder2 - Code generation
  • codegemma - Google’s code model

Embeddings

  • nomic-embed-text - High-quality embeddings
  • mxbai-embed-large - Large embedding model
  • all-minilm - Lightweight embeddings

Vision Models

  • llava - Llama + vision
  • bakllava - Alternative vision model
See the full list at ollama.com/library

Usage Examples

Basic Text Generation

Using Model References

Streaming Responses

Function Calling

Tool calling is only supported on models configured with type: 'chat' (the default). Not all Ollama models support tools - test with your specific model.

Multimodal (Vision)

Text Embeddings

For embedders, you must specify the dimensions in the plugin configuration.

Using Different Model Sizes

Using in a Flow

Configuration Options

Model Configuration

Model Types

Ollama supports two API types:
Chat API (default):
  • Multi-turn conversations
  • Function calling support
  • System messages
Generate API:
  • Simple text completion
  • No conversation history
  • No tool support

Model Capabilities

Specify what features a model supports:

Managing Models

Pull Models

List Models

Remove Models

Show Model Info

Create Custom Models

Create a Modelfile:
Then create the model:
Use in Genkit:

Performance Optimization

GPU Acceleration

Ollama automatically uses GPU if available:
  • NVIDIA GPUs: CUDA
  • AMD GPUs: ROCm
  • Apple Silicon: Metal

Model Quantization

Use quantized models for faster inference:

Concurrent Requests

Ollama handles multiple requests efficiently:

System Requirements

Minimum Requirements

  • RAM: 8GB (for 7B models)
  • Disk: 5GB per model
  • CPU: Modern multi-core processor
  • RAM: 16GB+ (for 13B+ models)
  • RAM: 32GB+ (for 70B models)
  • GPU: 8GB+ VRAM for acceleration

Model Size Guide

Troubleshooting

Ollama Server Not Running

Solution:

Model Not Found

Solution:

Out of Memory

Solution:
  • Use a smaller model (e.g., llama3:7b instead of llama3:70b)
  • Use quantized version (e.g., llama3:8b-q4_0)
  • Close other applications
  • Increase system swap/virtual memory

Slow Performance

Solutions:
  • Use GPU acceleration
  • Use quantized models
  • Use smaller models
  • Reduce maxOutputTokens
  • Increase system resources

Connection Refused

Solution:

Best Practices

  1. Start with smaller models - llama3:8b is a good default
  2. Use quantized models for production to balance speed and quality
  3. Monitor system resources - watch RAM and GPU usage
  4. Keep models updated - ollama pull <model> regularly
  5. Use appropriate model sizes for your hardware
  6. Enable GPU acceleration if available
  7. Cache frequently-used models in memory
  8. Test locally before deploying

Privacy Benefits

Complete Data Privacy:
  • All processing happens locally
  • No data sent to external APIs
  • No internet required (after model download)
  • Full control over model versions
Ideal For:
  • Healthcare applications (HIPAA compliance)
  • Financial services
  • Legal document processing
  • Internal corporate tools
  • Sensitive data analysis

Comparison: Ollama vs Cloud Providers

Next Steps