Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Local LLM in .NET: IChatClient + Ollama (Free Mini Course)
New
Rating: 4.0 out of 5(1 rating)
39 students

Local LLM in .NET: IChatClient + Ollama (Free Mini Course)

Run a model on your own machine, call it from C#, and measure what every answer really costs
Last updated 10/2026
English
English [Auto],

What you'll learn

  • Call a local LLM from C# with IChatClient and OllamaSharp, with no cloud account and no API bill
  • Read a ChatResponse: which model answered, why it stopped, input and output tokens, and provider extras
  • Stream answers to your users and measure the time to the first token
  • Keep a multi-turn chat history, and see why long chats get slower with every turn
  • Control answers with ChatOptions: max output tokens, temperature and seed
  • Spot hidden “thinking” tokens, detect leaked thinking, and choose between thinking and instruct models
  • Measure speed honestly with a warm-up call, repeated runs and the median (p50)
  • Register IChatClient with dependency injection, and add logging and caching with ChatClientBuilder
  • Switch the provider and the model from appsettings.json or the command line, without changing code

Course content

7 sections • 15 lectures • 1h 20m total length
  • Welcome & What You Will Learn1:26
  • Installation Ollama & Pulling Models3:29

Requirements

  • You’re comfortable with C# and .NET basics. This is a mid-level course, and .NET installation isn’t shown.
  • The .NET 10 SDK on your machine.
  • Windows, macOS or Linux with about 8 GB of free RAM and 6 GB of free disk space. A GPU helps, but it’s not required.
  • No AI or machine learning experience needed.

Description

In the very first lesson, I ask a model on my own machine a one-word question. It answers with one word. And that one word costs about two hundred tokens and almost seven seconds. Then I change only the model, and the same answer costs two tokens and a tenth of a second.

By the end of this course, you’ll know exactly why that happens, and you’ll be able to measure it yourself.

This is a short, practical course for .NET developers. We run a local language model with Ollama, and talk to it from C# through IChatClient, the standard interface from Microsoft.Extensions. AI. Because your code only talks to IChatClient, everything you learn here also works with cloud providers later. Only one line changes.

What we do, step by step

  • Install Ollama and two small models, and create a .NET 10 console app.

  • Send the first question, and open the response: model, finish reason, tokens, time.

  • Stream the answer, keep a real conversation, and control the answer with ChatOptions.

  • Find the hidden cost of “thinking” models, see what really happens when you try to turn thinking off, and choose the right model for the job.

  • Measure speed the honest way: warm-up, repeated runs, p50, and models that push each other out of memory.

  • Give the app the shape of a real .NET application: dependency injection, logging, caching, and a provider you choose in settings.

How the course works

Every lesson follows the same rhythm: we write a small piece of code, we run it, and we look at the real numbers. You’ll see my real measurements, and also the surprises and the mistakes I found while preparing the course, because those are often the most useful part.

What you need

Basic C# and .NET. No AI experience. Everything runs on your own machine. You don’t need an API key, a credit card or an internet connection after the setup.

Who this course is for:

  • .NET developers who want to start with LLMs on their own machine, without a cloud bill
  • Backend developers who need to keep data on their own machine or network
  • Developers who already call an AI API, but want to understand tokens, latency and what each answer really costs
  • .NET developers who plan to build RAG, tool calling or agents, and want a solid, measured base first