A 60-second sanity check that your .NET AI development environment actually works - against a free local model (Ollama) and the free cloud tier (GitHub Models), using the exact same C# code for both.
If you are about to start building AI features into a .NET app and want to confirm "base camp is solid" before writing real code, clone this, run it, and you will know in under a minute.
== provider-check: ollama ==
Endpoint: http://localhost:11434/
Model: llama3.2
You: In one sentence, what is an API?
AI: An API is a set of rules that lets one program request data or actions from another.
Success. Your 'ollama' setup works - you are ready to build.
This is the companion starter for Chapter 2 of the Coding Droplets course
AI-Powered APIs in .NET. The whole idea it
demonstrates: you write your code against Microsoft.Extensions.AI's IChatClient
interface, and the provider behind it - local Ollama, GitHub Models, OpenAI, Azure
OpenAI - becomes a one-line choice. Switching providers does not change your app.
Learn the whole stack: chat, structured outputs, RAG, tool calling, agents, MCP, security, evaluation, observability, and deployment - all in .NET, built one runnable project at a time. AI-Powered APIs in .NET →
- .NET 10 SDK
- For the local path: Ollama running, with a model pulled:
ollama pull llama3.2 - For the cloud path: a GitHub Models token
(free tier) with the
models:readpermission.
Clone and run the local check (the default):
git clone https://github.com/codingdroplets/provider-check.git
cd provider-check
dotnet run -- ollama
Check the cloud provider (GitHub Models free tier):
# PowerShell
$env:GITHUB_TOKEN = "your-token-here"
dotnet run -- github
# bash
export GITHUB_TOKEN="your-token-here"
dotnet run -- github
The defaults work out of the box. To point the checker at a different endpoint or model, set environment variables before running:
OLLAMA_ENDPOINT- defaulthttp://localhost:11434/OLLAMA_MODEL- defaultllama3.2GITHUB_TOKEN- required for thegithubprovider (models:readpermission)GITHUB_MODEL- defaultopenai/gpt-4o-miniGITHUB_MODELS_ENDPOINT- defaulthttps://models.github.ai/inference
| File | Job |
|---|---|
Program.cs |
Picks the provider from the command line, runs the check, prints a clear verdict. |
ChatClientFactory.cs |
The only provider-specific code - builds an IChatClient for Ollama or GitHub Models. |
ChatRunner.cs |
Sends one question and prints the answer. Provider-agnostic - it only sees IChatClient. |
That separation is the point: 95% of the code never knows which model answered.
Microsoft.Extensions.AI- the provider-agnosticIChatClientabstractionOllamaSharp-IChatClientover a local Ollama serverMicrosoft.Extensions.AI.OpenAI-IChatClientover OpenAI-compatible endpoints (GitHub Models, OpenAI, Azure OpenAI)
- Course: AI-Powered APIs in .NET - the full, structured guide this starter belongs to
- Blog: codingdroplets.com - keeping up with the fast-moving .NET AI stack
- More free starters: github.com/codingdroplets
MIT - free to use, modify, and build on.