n4nAI

Topic

NestJS LLM API Integration

12 posts on nestjs llm api integration — part of api integration on the n4n AI blog.

API integrationHow-to

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.

2 min read
API integrationHow-to

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.

3 min read
API integrationGuide

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.

2 min read
API integrationHow-to

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.

3 min read
API integrationHow-to

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.

2 min read
API integrationTutorial

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.

2 min read
API integrationGuide

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.

3 min read
API integrationGuide

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.

3 min read
API integrationHow-to

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.

4 min read
API integrationHow-to

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.

3 min read
API integrationHow-to

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.

2 min read
API integrationTutorial

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.

2 min read