ollama
Run and manage local LLMs via Ollama REST API — text generation, chat completions, embeddings, tool calling, structured output, and model management. Use when code imports ollama, references localhost:11434, or user asks about local LLM inference.
Best use case
ollama is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Run and manage local LLMs via Ollama REST API — text generation, chat completions, embeddings, tool calling, structured output, and model management. Use when code imports ollama, references localhost:11434, or user asks about local LLM inference.
Teams using ollama should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ollama/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How ollama Compares
| Feature / Agent | ollama | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Run and manage local LLMs via Ollama REST API — text generation, chat completions, embeddings, tool calling, structured output, and model management. Use when code imports ollama, references localhost:11434, or user asks about local LLM inference.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Ollama API Reference (v0.20.7)
Ollama runs large language models locally. It exposes a REST API on `http://localhost:11434` for text generation, chat, embeddings, model management, and more.
## Key Concepts
- **Model names** follow `model:tag` format (e.g., `llama3.2:latest`, `orca-mini:3b-q8_0`). Tag defaults to `latest`.
- **Streaming** is enabled by default on generation endpoints. Disable with `"stream": false`.
- **Durations** are returned in nanoseconds.
- **Tokens/sec** = `eval_count / eval_duration * 10^9`.
- **keep_alive** controls how long a model stays loaded in memory (default `5m`). Set to `0` to unload immediately, `-1` to keep loaded indefinitely.
- **Thinking models** support `"think": true` (or `"high"`, `"medium"`, `"low"`) to enable chain-of-thought reasoning.
- **Structured output** via `"format"` parameter: set to `"json"` for JSON mode, or pass a JSON Schema object.
- **Tool calling** is supported in `/api/chat` by providing a `tools` array.
- **Modelfile** is a blueprint for creating custom models (FROM, PARAMETER, TEMPLATE, SYSTEM, ADAPTER, LICENSE, MESSAGE instructions).
## API Endpoints
| Method | Path | Description |
|--------|------|-------------|
| `POST` | `/api/generate` | Generate text completion (streaming) |
| `POST` | `/api/chat` | Chat completion with message history (streaming) |
| `POST` | `/api/embed` | Generate embeddings (single or batch) |
| `POST` | `/api/embeddings` | Generate embeddings (legacy, deprecated) |
| `GET` | `/api/tags` | List locally available models |
| `POST` | `/api/show` | Show model details and metadata |
| `POST` | `/api/create` | Create a model from Modelfile, GGUF, or safetensors |
| `POST` | `/api/pull` | Pull/download a model from registry |
| `POST` | `/api/push` | Push a model to registry |
| `POST` | `/api/copy` | Copy/clone a model locally |
| `DELETE` | `/api/delete` | Delete a model |
| `GET` | `/api/ps` | List currently loaded/running models |
| `HEAD` | `/api/blobs/:digest` | Check if a blob exists |
| `POST` | `/api/blobs/:digest` | Upload a blob (for GGUF/safetensors creation) |
| `GET` | `/api/version` | Get Ollama server version |
## Quick Start
```bash
# Pull a model
curl http://localhost:11434/api/pull -d '{"model": "llama3.2"}'
# Generate text
curl http://localhost:11434/api/generate -d '{
"model": "llama3.2",
"prompt": "Why is the sky blue?",
"stream": false
}'
# Chat
curl http://localhost:11434/api/chat -d '{
"model": "llama3.2",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": false
}'
# Embeddings
curl http://localhost:11434/api/embed -d '{
"model": "all-minilm",
"input": "Why is the sky blue?"
}'
```
## Model Options (passed via `options` field)
These runtime parameters can be passed in the `options` object of generate/chat/embed requests:
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `num_ctx` | int | 2048 | Context window size |
| `num_batch` | int | 512 | Batch size for prompt processing |
| `num_gpu` | int | -1 (auto) | Number of layers to offload to GPU |
| `main_gpu` | int | 0 | Main GPU index |
| `use_mmap` | bool | (auto) | Use memory-mapped files |
| `num_thread` | int | 0 (auto) | Number of threads |
| `num_keep` | int | 4 | Number of tokens to keep from initial prompt |
| `seed` | int | -1 | Random seed (-1 = random) |
| `num_predict` | int | -1 | Max tokens to generate (-1 = infinite) |
| `top_k` | int | 40 | Top-K sampling |
| `top_p` | float | 0.9 | Top-P (nucleus) sampling |
| `min_p` | float | 0.0 | Min-P sampling |
| `typical_p` | float | 1.0 | Typical-P sampling |
| `repeat_last_n` | int | 64 | Lookback for repeat penalty (0=disabled, -1=num_ctx) |
| `temperature` | float | 0.8 | Sampling temperature |
| `repeat_penalty` | float | 1.1 | Repetition penalty |
| `presence_penalty` | float | 0.0 | Presence penalty |
| `frequency_penalty` | float | 0.0 | Frequency penalty |
| `stop` | string[] | [] | Stop sequences |
## Detailed References
- [Generation and Chat API](references/api-generation.md) -- `/api/generate` and `/api/chat` with all fields, streaming, tool calling, structured output, thinking, images
- [Model Management API](references/api-models.md) -- `/api/tags`, `/api/show`, `/api/create`, `/api/pull`, `/api/push`, `/api/copy`, `/api/delete`, `/api/ps`, blobs, version
- [Embeddings API](references/api-embeddings.md) -- `/api/embed` and legacy `/api/embeddings`
- [Modelfile Reference](references/modelfile.md) -- FROM, PARAMETER, TEMPLATE, SYSTEM, ADAPTER, LICENSE, MESSAGE instructions
- [Workflow Examples](references/workflows.md) -- Complete curl/code examples for common tasksRelated Skills
rocm
AMD ROCm GPU computing stack for HIP kernel development and GPU-accelerated library usage. Use when: writing HIP kernels (.hip files), using rocBLAS/rocFFT/rocRAND/rocSOLVER/rocSPARSE/hipBLAS/hipBLASLt/hipTensor/hipSPARSELt/rocALUTION compute libraries, profiling with rocProfiler or rocprof, porting CUDA code to HIP, building CMake/Makefile projects targeting AMD GPUs, using HIP Graphs for low-overhead kernel replay, or debugging GPU code with rocGDB.
powergridmodel
Python library for steady-state distribution power system analysis (power flow, state estimation, short-circuit calculations). Use when working with the power-grid-model library to: (1) perform load flow or Newton-Raphson/iterative calculations on electrical grids, (2) run state estimation with sensor data, (3) compute IEC 60909 short-circuit currents, (4) execute batch/time-series or N-1 contingency simulations, or (5) work with grid component types (node, line, transformer, source, sym_load, etc.) and numpy structured arrays.
pandapower
Power systems analysis and optimization library (pandapower v3.4.0). Use when working with electric power networks: building network models (buses, lines, transformers, loads, generators), running AC/DC power flow, optimal power flow (OPF), short circuit calculations (IEC 60909), state estimation, time series simulations, network topology analysis, or visualizing power grids in Python.
opencl
OpenCL SDK (Khronos Group) for cross-platform GPU/CPU parallel computing in C and C++. Use when writing OpenCL kernels, managing devices/contexts/queues, allocating and transferring buffers or images, building and executing programs, or using the C++ wrapper (opencl.hpp / cl::CommandQueue, cl::Buffer, cl::KernelFunctor). Covers OpenCL C API, C++ bindings, and SDK utility libraries (OpenCLUtils, OpenCLSDK).
llamacpp
Complete llama.cpp C/C++ API reference covering model loading, inference, text generation, embeddings, chat, tokenization, sampling, batching, KV cache, LoRA adapters, and state management. Triggers on: llama.cpp questions, LLM inference code, GGUF models, local AI/ML inference, C/C++ LLM integration, "how do I use llama.cpp", API function lookups, implementation questions, troubleshooting llama.cpp issues, and any llama-cpp or ggerganov/llama.cpp mentions.
greycat
Build, run, and edit GreyCat projects. GreyCat is a statically-typed language plus runtime for graph-persistent, time-series-aware applications. Use when reading or writing `.gcl` source, when the user mentions GreyCat / project.gcl / nodeTime / nodeList / nodeIndex / nodeGeo / @expose / @library, or when the task involves running `greycat <command>`, deploying a project, or reasoning about gcdata/, lib/, files/, webroot/.
greycat-c
GreyCat C API and GCL Standard Library reference. Use for: (1) Native C development with gc_machine_t context, tensors, objects, memory management, crypto, I/O; (2) GCL Standard Library modules - std::core (Date/Time/Tuple/geospatial types), std::runtime (Scheduler/Task/Logger/User/Security/System/OpenAPI/MCP), std::io (CSV/JSON/XML/HTTP/Email/FileWalker), std::util (Queue/Stack/SlidingWindow/Gaussian/Histogram/Quantizers/Random/Plot); (3) Plugin development patterns - lifecycle hooks, type configuration, nativegen, module-level and type-level function linking, global state, thread safety, conditional logging. Keywords: GreyCat, GCL, native functions, tensors, task automation, scheduler, plugin development.
ggml
C tensor computation library for ML inference and training. Use when working with ggml graphs, GGUF model files, backend scheduling, quantization, or implementing low-level ML ops in C/C++.
cuda
NVIDIA CUDA parallel computing platform — use when writing .cu kernels, using cuBLAS/cuDNN/cuFFT/cuSPARSE/cuRAND/cuSolver, Thrust, or Cooperative Groups for GPU-accelerated computing
blas_lapack
Complete CBLAS and LAPACKE C API reference (LAPACK v3.12.1) covering 1284 functions for numerical linear algebra: BLAS Level 1/2/3 vector and matrix operations, linear system solvers (LU, Cholesky, LDL), eigenvalue/eigenvector computation, singular value decomposition, least squares, QR/LQ factorizations, and auxiliary routines. Triggers on: BLAS/LAPACK questions, CBLAS/LAPACKE code, linear algebra in C/C++, matrix operations, numerical computing, scientific computing, HPC, linking BLAS/LAPACK.
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
langchain-ollama
LangChain Ollama integration — run local LLMs with ChatOllama (chat completions, tool calling, structured output, reasoning/thinking mode), OllamaLLM (raw text completions), and OllamaEmbeddings. Connects to a local Ollama server at localhost:11434.