← all repositories
ollama/ollama-python

The official Python wrapper that saves you from hand-rolling HTTP

It exposes Ollama's REST API as typed Python functions so you don't have to manage another httpx client yourself.

10.5k stars Python Language Models
ollama-python
Not currently ranked — collecting fresh signals.
star history

What it does

The Ollama Python library is the project’s official client, translating the Ollama REST API into sync and async Python calls. It covers the full model lifecycle—chat, generate, embeddings, list, show, create, copy, delete, pull, push, and process inspection—returning typed response objects instead of raw JSON. The library also folds in Ollama’s cloud models, letting you run oversized variants like deepseek-v3.1:671b-cloud or kimi-k2:1t-cloud through the same interface either locally proxied or directly via ollama.com.

The interesting bit

This is fundamentally glue code, but honest glue code: it sits on top of httpx and forwards extra keyword arguments straight to the underlying client. That architectural transparency means you get custom headers, async support, and streaming generators without the library pretending to be a framework.

Key highlights

  • Sync Client and AsyncClient with streaming responses toggled by stream=True
  • Cloud model access through identical interfaces, including hosted variants up to 1T parameters
  • Typed responses (e.g., ChatResponse) accessible as dictionaries or objects
  • Full model management surface: chat, generate, embed (with batching), list, show, create, copy, delete, pull, push, and ps
  • Extra client kwargs pass through directly to httpx, so custom headers and transports work without extra configuration

Verdict

Import this if you run Ollama locally and want maintained, typed bindings instead of babysitting HTTP requests. If you need an LLM-agnostic SDK or don’t use Ollama, it has nothing to offer.

Frequently asked

What is ollama/ollama-python?
It exposes Ollama's REST API as typed Python functions so you don't have to manage another httpx client yourself.
Is ollama-python open source?
Yes — ollama/ollama-python is open source, released under the MIT license.
What language is ollama-python written in?
ollama/ollama-python is primarily written in Python.
How popular is ollama-python?
ollama/ollama-python has 10.5k stars on GitHub.
Where can I find ollama-python?
ollama/ollama-python is on GitHub at https://github.com/ollama/ollama-python.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.