Aimform

@aimform/ai

A single-package AI SDK that handles everything from real-time chat streaming to multi-layer memory persistence. Plug in your LLM, database, and transport — the rest is automatic.

Quick Start

pnpm add @aimform/ai
import { AI } from "@aimform/ai";
 
const ai = new AI({
  model: "deepseek-v4-flash",
  apiKeys: { deepseekApiKey: process.env.DEEPSEEK_API_KEY },
  db: dbAdapter,
  transport: transportAdapter,
});
 
const result = await ai.chat({
  runId: crypto.randomUUID(),
  conversationId: "conv-1",
  messages: [{ role: "user", content: "What can you do?" }],
  toolContext: { userId: "user-1", profileId: "profile-1", sessionId: "s1", env: {} },
});

Architecture

Every component is an adapter interface — swap providers at any level.

LayerInterfaceDefault Implementations
LLMLLMAdapterOpenAI, Anthropic, DeepSeek
DatabaseDatabaseAdapter (from @aimform/core)D1, Neon, Postgres
TransportChatTransportAdapterCloudflare Agents SDK, Raw DO
MemoryMemoryStorageDB-backed with 5-layer system
Plugins12 plugin interfaces25+ provider implementations

Sections

On this page