ollama
The official Python client for Ollama.
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and installs with minimal friction. It is the official client for Ollama and is well-suited for any Python project that needs to call local or cloud LLMs. Install it if you are already running Ollama or plan to; if you have no Ollama server, it is not useful on its own.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Ollama must be installed and running locally (or accessible at a configured host), and a model must be pulled beforehand (e.g., `ollama pull gemma3`).
- Low install friction with only two runtime dependencies (httpx and pydantic).
- Actively maintained with a recent release on 2026-04-29 and steady commit activity; the repository shows strong community engagement with 10407 stars.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
last release 2026-04-29 (107 days) · last repo commit 2026-08-12 · 10,407 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 19,885,974 downloads/mo, #1,052 on PyPI
Alternatives
Verify before relying
pip install ollama
from ollama import chat
response = chat(model='gemma3', messages=[{'role': 'user', 'content': 'Why is the sky blue?'}])
print(response.message.content)- Whether the package supports Python versions beyond 3.8 despite the requirement stating >=3.8.
- Performance characteristics and latency for streaming responses under typical loads.
- Compatibility guarantees with specific Ollama server versions.
What it is and what it does
Ollama is the official Python client library for interacting with Ollama, a system for running large language models locally or via cloud. It wraps Ollama's REST API into a straightforward Python interface, letting you send chat messages, generate text, create embeddings, and manage models without dealing with HTTP calls directly. The library supports both synchronous and asynchronous workflows, streaming responses for real-time output, and custom client configuration via httpx.
The package is designed for developers who want to integrate local or cloud-hosted LLMs into Python applications. It handles the common patterns—chat conversations, single-prompt generation, batch embeddings, and model lifecycle operations—with minimal boilerplate. Dependencies are light (httpx for HTTP, pydantic for response validation), and the API closely mirrors Ollama's REST endpoints, so the learning curve is shallow if you're already familiar with the server.
Use it for
- Build a chatbot or conversational AI feature in a Python application by sending user messages to a local Ollama instance and streaming responses back.
- Generate text embeddings for semantic search or similarity comparisons without calling an external API.
- Automate model management tasks—pulling, creating, copying, or deleting models—as part of a larger data pipeline.
- Prototype LLM-powered features locally during development before deploying to cloud models via Ollama's cloud API.
- Create an async worker that processes chat or generation requests concurrently using AsyncClient.
- Integrate Ollama cloud models (e.g., gpt-oss, deepseek-v3.1) into Python code by authenticating with an API key.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and installs with minimal friction. It is the official client for Ollama and is well-suited for any Python project that needs to call local or cloud LLMs. Install it if you are already running Ollama or plan to; if you have no Ollama server, it is not useful on its own.
Install
ollama on PyPI
Before you install
Low install friction with only two runtime dependencies (httpx and pydantic). Actively maintained with a recent release on 2026-04-29 and steady commit activity; the repository shows strong community engagement with 10407 stars.
Ollama must be installed and running locally (or accessible at a configured host), and a model must be pulled beforehand (e.g., `ollama pull gemma3`).
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install ollama
from ollama import chat
response = chat(model='gemma3', messages=[{'role': 'user', 'content': 'Why is the sky blue?'}])
print(response.message.content)
Verify before relying
- Whether the package supports Python versions beyond 3.8 despite the requirement stating >=3.8.
- Performance characteristics and latency for streaming responses under typical loads.
- Compatibility guarantees with specific Ollama server versions.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packageshttpxpydantic |
| Maintenance | Actively maintained 107 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 19,885,974 / month, #1,052 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: ollama-0.6.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “ollama python client”
- ollamaProvides a Python client to interact with Ollama, a local or…
- opentelemetry-instrumentation-ollamaAdds distributed tracing to Ollama Python client calls, capturing…
- agent-framework-ollamaIntegrates Ollama LLM provider support into Microsoft Agent…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also llama-index-llms-ollama · xinference-client · text-generation · gigachat · llama-index-llms-openai · llama-index-llms-azure-openai · g4f · llama-index-embeddings-ollama · llm · npmai