Feedback

Chat Icon

Local AI Engineering with Ollama

Run, understand, customize, fine-tune, and build agentic apps on your own hardware

72%

Building a Management CLI for Ollama Using the SDK

So far you've talked to Ollama through the CLI and through raw HTTP with curl. Both are useful and worth knowing, but when you want to create applications or integrate Ollama into your own code, you need an SDK. There are different SDKs for different languages (e.g., Golang, JS). We'll focus on Python here.

The Ollama Python SDK is a thin client over the same HTTP API from the previous chapters. It hits the same endpoints (/api/chat, /api/generate, /api/pull, /api/show, /api/ps, /api/tags), with the same options, returning the same data.

What it gives you on top is three things:

  1. Typed response objects. response.message.content and response.eval_count instead of response.json()["message"]["content"]

Local AI Engineering with Ollama

Run, understand, customize, fine-tune, and build agentic apps on your own hardware

Enroll now to unlock all content and receive all future updates for free.