Ollama Python
A Python client connects applications to local Ollama models or Ollama's cloud service, with streaming responses and asynchronous requests.
Ollama Python is a client library for developers adding model conversations to Python applications. It connects to a running Ollama service for local use or to Ollama's cloud service for larger models.
- Streaming responses: Applications can display model output as it arrives rather than waiting for the full response.
- Async support: Synchronous and asynchronous clients suit ordinary scripts and applications that handle concurrent requests.
- Model access: Use models served by Ollama, such as gemma4, or cloud models including DeepSeek V3.1, gpt-oss, Kimi K2 and Qwen3-Coder.
The library is open source under the MIT license and supports Python 3.8 or later. Local use requires Ollama to be running. Cloud requests go to Ollama's servers, either through the local Ollama service with sign-in or directly through ollama.com with an API key.