Topic
C# / .NET LLM API Integration
13 posts on c# / .net llm api integration — part of api integration on the n4n AI blog.
Unit testing LLM API integrations in C# with Moq
Learn how to unit test LLM API integrations in C# using Moq to isolate HTTP calls, mock responses, and verify behavior without hitting live endpoints.
System.Text.Json vs Newtonsoft.Json for LLM responses
A pragmatic head-to-head comparison of System.Text.Json vs Newtonsoft.Json for parsing, streaming, and serializing LLM responses in C# .NET apps.
Streaming LLM responses in .NET with IAsyncEnumerable
Step-by-step guide to dotnet iasyncenumerable streaming llm integration in C#, with runnable code and verification for production-grade apps.
Semantic Kernel vs raw HTTP for .NET LLM integration
Compare Semantic Kernel vs raw HTTP dotnet for production LLM apps: capabilities, cost, latency, ergonomics, ecosystem, limits, and which to choose.
Polly retry policies for OpenAI API calls in .NET
Implement resilient LLM calls in C# using Polly retry policies for OpenAI API failures, with step-by-step code for transient error handling.
NuGet setup for an OpenAI-compatible C# client
Install and configure a NuGet OpenAI-compatible C# client for .NET apps: package setup, base URL, auth, and a test chat call to verify.
IHttpClientFactory best practices for LLM API clients
Practical patterns for using IHttpClientFactory in .NET to build resilient LLM API clients, covering pooling, streaming, retries, and metering.
Handling 429 rate limits in .NET LLM clients
Practical steps to handle dotnet 429 rate limit llm errors in C# clients with retry, backoff, and fallback to keep LLM calls resilient.
Dependency injection for LLM clients in .NET 8
Learn to implement a dotnet 8 dependency injection llm client using OpenAI-compatible endpoints, resilient provider fallbacks, and testable service layers.
Azure OpenAI SDK vs OpenAI-compatible REST in .NET
Head-to-head comparison of Azure OpenAI SDK vs OpenAI-compatible REST in .NET: capabilities, cost, latency, ergonomics, ecosystem, limits, and verdict.
Async/await patterns for concurrent LLM calls in C#
Hands-on guide to c# async await concurrent llm calls: use Task.WhenAll, SemaphoreSlim, and proper cancellation to build resilient .NET LLM integrations.
Calling the OpenAI API from C# with HttpClient
Learn how to call the OpenAI API from C# using HttpClient with a hands-on tutorial covering auth, requests, streaming, and error handling.
Building a minimal API wrapper for n4n in ASP.NET Core
Hands-on tutorial: build an ASP.NET Core minimal API wrapper for the n4n LLM gateway using its OpenAI-compatible endpoint with C#.
More topics in api integration
- Function Calling Fundamentals27
- Structured Outputs & JSON Mode19
- cURL LLM API Cookbook15
- Integrating GPT-5, Claude Opus 4.8, Gemini 3, Llama 4 & More via One API15
- Next.js AI Chat Integration (App Router + Vercel AI SDK)15
- FastAPI LLM Backend Integration14
- Go net/http LLM API Client14
- LangChain + OpenAI-Compatible Gateway Integration14
- Node.js OpenAI-Compatible SDK Integration14
- Python + OpenAI-Compatible SDK Integration14
- Rate Limits, Retries & Backoff Strategies14
- React Streaming Chat UI Patterns14