Ollama Python SDK

Fully offline

Official Python SDK for Ollama. Async, streaming, typed — the right primitive for scripts.

Editorial verdict: “Foundational primitive for Python scripts against Ollama. Official, maintained, typed.

SDK / proxy
Free
MIT
4.5 / 5
GitHub ★ 5,500

Compatibility at a glance

Which runtime + OS combos this app works against. Source of truth for "will it run on my setup?"

§ Runtimes supported
ollama
§ OS / platform
linuxmacoswindows

What it is

For solo Ollama users writing Python scripts or small services, this is the SDK to reach for. It bridges directly to a local Ollama server with async, sync, and streaming support, plus typed responses that save you from guessing at dict keys. Fully offline by design — no API keys, no cloud dependency. Maintained by the Ollama team, so it stays current with vision, tools, and embeddings as they land. Just know it's Ollama-specific: if you need to swap in OpenAI or Anthropic backends later, LiteLLM is the better foundation. No batch endpoint helpers either, so you'll roll your own for bulk inference.

✓ Strengths

  • +Official + maintained by Ollama team
  • +Async + sync + streaming all work
  • +Typed responses

△ Caveats

  • Ollama-specific (use LiteLLM for multi-backend)
  • No batch endpoint helpers