NodeLLM
The Backend-First AI SDK

Open-source infrastructure for building production-grade agents in Node.js — provider-agnostic, database-backed, with zero dependency bloat.

Replace provider SDKs, prompt glue code, and ad-hoc agent state with a single, versioned backend API.

Get Started (5 mins) View on GitHub

Unified support for

OpenAI Anthropic Gemini DeepSeek Bedrock OpenRouter xAI Ollama Mistral

OpenAI · Anthropic · Gemini · DeepSeek · Bedrock · OpenRouter · xAI · Ollama · Mistral

🔌

Provider Agnostic

Switch between OpenAI, Anthropic, Gemini, Bedrock, and DeepSeek with zero code changes. A unified API for 540+ models.

⚡️

Backend First

Optimized for workers, CRON jobs, and microservices. Built for long-running stability, not just frontend streaming.

🔒

Agentic Zero Trust

The "Invisible Perimeter" for your agents. Automatic key redaction, PII masking, and guardrails included by default.

Actively maintained · Versioned releases · Clean, predictable architecture

One API. All Capabilities.

No more vendor-specific SDK boilerplate. Whether you're building streaming tools, vision-powered analytics, or reasoning agents, NodeLLM provides a single mental model.

const chat = NodeLLM.chat("gpt-4o");
await chat.withTool(DatabaseTool);

// Automates tools & real-time streaming
for await (const s of chat.stream("Supply...")) print(s.content);

// Multi-modal Senses: Image Gen & Audio
const art = await NodeLLM.paint("3D Logo");
const text = await NodeLLM.transcribe("memo.mp3");
import { z } from "zod";
const schema = z.object({ analysis: z.string(), risk: z.number() });

// Strictly typed JSON extraction
const res = await chat
  .withSchema(schema)
  .ask("Analyze risk");

console.log(res.data.analysis);
// Access CoT of Claude 3.7 or R1
const res = await chat
  .withThinking({ budget: 16000 })
  .ask("Security audit of Postgres");

// Internal reasoning & result
console.log(res.thinking.text); 
console.log(res.content);
import { createChat } from "@node-llm/orm";
import { NodeLLM } from "@node-llm/core";

// Auto-persisted history, costs, & tokens
const chat = await createChat(prisma, NodeLLM, { 
  model: "gpt-4o" 
});

// DB state is managed automatically
await chat.ask("Recall previous security scan");