Topic
NestJS LLM API Integration
12 posts on nestjs llm api integration — part of api integration on the n4n AI blog.
Validate chat completion requests with NestJS DTOs
Learn how to implement nestjs dto chat completion validation for LLM APIs using class-validator and NestJS pipes, with step-by-step code and verification.
Unit testing a NestJS OpenAI client with Jest mocks
Learn how to build a nestjs jest mock openai client to unit test your LLM service without network calls, covering chat, streaming, and errors step by step.
Type-safe NestJS controllers for streaming chat
A practical guide to building a nestjs typed streaming chat controller with TypeScript, SSE, and OpenAI-compatible APIs—covering pitfalls and patterns.
Retry and timeout logic for NestJS OpenAI API calls
Implement production-grade NestJS OpenAI API retry and timeout logic with Axios: step-by-step setup, exponential backoff, idempotency, and tests.
Rate limit LLM calls in NestJS with @nestjs/throttler
Learn how to implement nestjs throttler llm rate limiting in a NestJS app to protect LLM proxy routes from abuse, upstream limits, and cost spikes.
Queue long LLM completions with NestJS and BullMQ
Learn how to build a robust NestJS BullMQ LLM queue to offload long-running completions, with step-by-step code and real output for production.
NestJS microservice pattern for multi-provider LLM routing
Practical guide to implementing a NestJS microservice pattern for multi-provider LLM routing with fallback, metering, and cache control.
NestJS dependency injection for pluggable LLM providers
Practical guide to building pluggable LLM providers in NestJS using dependency injection, with interfaces, factories, and runtime selection.
Log token usage with a NestJS interceptor
Learn how to build a NestJS interceptor to log LLM token usage from OpenAI-compatible responses, with step-by-step code and verification tips for observability.
Stream LLM responses in NestJS using server-sent events
Learn how to implement nestjs server-sent events llm streaming end to end, from controller setup to OpenAI-compatible client and verification.
Handle OpenAI 429 rate limit errors in NestJS
Practical guide to nestjs openai 429 error handling: implement retries, exponential backoff, global exception filters, and provider fallback in production NestJS apps.
Build an OpenAI-compatible chat endpoint in NestJS
Hands-on tutorial to build a nestjs openai compatible chat endpoint with NestJS: request DTOs, provider proxying, streaming, and curl tests.
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