Stackline AI 0.0.2 · AI UI 0.0.4

Provider-neutral AI apps, without leaking keys to the browser.

Stackline AI gives you backend contracts, a safe HTTP handler, provider adapters, optional RAG/memory, and a drop-in AI Studio web component.

@stackline/ai @stackline/ai-server @stackline/ai-ui @stackline/ai-ollama @stackline/ai-memory-sqlite @stackline/ai-rag-postgres

Install By Scenario

Core only:

npm install @stackline/ai

Backend API with Ollama:

npm install @stackline/ai @stackline/ai-server @stackline/ai-ollama

Full UI with Ollama:

npm install @stackline/ai @stackline/ai-server @stackline/ai-ollama @stackline/ai-ui
npm install -D vite

Complete stack:

npm install @stackline/ai @stackline/ai-server @stackline/ai-ollama @stackline/ai-ui @stackline/ai-memory-sqlite @stackline/ai-rag-postgres
npm install -D vite

Do not install only @stackline/ai-ui unless your backend already exposes compatible models and chat routes.

Backend First

The Studio component calls GET /api/ai/models and POST /api/ai/chat. Create and test those routes before rendering the web component.

import { createStacklineAIServer } from "@stackline/ai/server";
import { createStacklineAIHttpHandler } from "@stackline/ai-server";
import { ollamaProvider } from "@stackline/ai-ollama";

const ai = createStacklineAIServer({
  provider: ollamaProvider({
    target: process.env.OLLAMA_TARGET || "http://127.0.0.1:11434",
    apiKey: process.env.OLLAMA_API_KEY,
    model: process.env.OLLAMA_MODEL || "auto",
  }),
  rag: false,
  memory: false,
});

export const handleAI = createStacklineAIHttpHandler({
  server: ai,
  basePath: "/api/ai",
});

Then Render The Studio

import "@stackline/ai-ui";
<stackline-ai-studio
  endpoint="/api/ai/chat"
  models-endpoint="/api/ai/models"
  model="llama3.1"
></stackline-ai-studio>

Extensible Language Picker

The Studio ships with en, pt, fr, and es, and applications can register any additional language.

const studio = document.querySelector("stackline-ai-studio");

studio.setLanguages([
  { id: "en", label: "EN", nativeName: "English" },
  { id: "pt", label: "PT", nativeName: "Português" },
  { id: "de", label: "DE", nativeName: "Deutsch" }
]);

studio.setTranslationPacks({
  de: {
    placeholder: "Schreiben Sie Ihre Nachricht...",
    send: "Senden"
  }
});

studio.setLanguage("de");

What The Live Demo Uses

Local Provider

A tiny demo provider returns deterministic responses.

Local RAG

RAG contexts come from an in-memory public document array.

No Secrets

No Ollama key, no PostgreSQL, no SQLite memory, no private data.