Back to directory

Ollama Python Library

A Python client library for Ollama that sends chat and generation requests to a local or cloud Ollama server, with support for streaming responses.

Ollama Python Library

The Ollama Python library is a client for integrating Python 3.8+ projects with Ollama. It requires Ollama to be installed and running locally, with at least one model pulled, and installs as a Python package.

A chat function sends messages to a named model and returns a response, with fields accessible either as dictionary keys or as object attributes; setting stream to true turns the same call into an incremental stream of response chunks. The library can also reach Ollama's cloud models, either by offloading from a local Ollama installation after a one-time sign-in, or by pointing a client directly at ollama.com with an API key, keeping the larger model off the local machine while using the same chat interface.

It is written in Python and released under the MIT license.

More in Libraries

See all 292
  • OpenDecision

    deepanwadhwa.github.io

    An open-source Python package that answers typed questions about application state or documents using a local natural-language-inference model, returning structured choice, score, yes/no or evidence-relation values instead of free text.

  • TradeCanvas

    bonguynvan.github.io

    A zero-dependency canvas charting engine for building TradingView-style trading charts in JavaScript, with 66 technical indicators, 24 drawing tools, 17 chart types, and real-time streaming.

  • 3d retro graphics

    3d-retro.com

    A free, CC0-licensed library of copy-paste retro 3D and demoscene graphics effects, such as plasma, raytracing, and voxel terrain, runnable as WebGL 1 or plain 2D canvas.