Tutorials Microsoft Agent Framework with Ollama Tutorial
Ollama REST API
Ollama REST API: free step-by-step lesson with examples, common mistakes, and interview tips — part of Microsoft Agent Framework with Ollama Tutorial on Toolliyo Academy.
On this page
Microsoft Agent Framework with Ollama Tutorial · Lesson 13 of 100
Ollama REST API
Foundations & Ollama → .NET & Agents → RAG & Ops → Projects
Foundations & Ollama · 1 — Local model · ~6 min · Ollama — Local Models
What is this?
Ollama exposes HTTP endpoints such as /api/chat and /api/generate. Your ASP.NET Core app calls these like any REST API.
Why should you care?
Semantic Kernel and custom agents both speak HTTP under the hood — knowing the raw API helps you debug.
See it live — copy this example
Run CLI steps in a terminal. Run C# samples in a .NET 8 console or Web API project with Ollama running on localhost:11434.
curl http://localhost:11434/api/chat -d "{
\"model\": \"phi3:mini\",
\"messages\": [{\"role\": \"user\", \"content\": \"Say hello in one line\"}],
\"stream\": false
}"
What happened?
- Port 11434 is Ollama’s default.
- messages is a chat array.
- stream:false returns one JSON object instead of a token stream.
Practice next
- Ensure Ollama is running and phi3:mini is pulled.
- Run the curl (or Invoke-RestMethod on Windows).
- Read the message.content field.
- Change the user content.
- Try /api/tags to list models via HTTP.
Remember
Ollama is an HTTP server. /api/chat is the main chat endpoint. stream controls response shape.
Smoke test before .NET
API works in curl but fails in C# — you compare payloads.
Outcome: Faster debugging.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!