A complete AI toolkit inside your own app
CKN AI puts LLMs (Claude, ChatGPT, Gemini), agents, RAG, machine learning, optimization, OCR and speech-to-text in one library, for Node and the browser. Your business gets AI wired to its own data and systems, without stitching together many SDKs, and can switch LLM vendors without a rewrite.
What CKN AI does
Many LLM vendors, one API
Write once and switch between Claude, ChatGPT and Gemini by changing the provider. Streaming, reasoning, images, audio and file inputs are supported.
- Cost estimates from a price table you supply
- Automatic retry on HTTP 429 and 5xx
- An unsupported input type raises an error instead of being dropped silently
- Structured JSON answers from the LLM
Agents and MCP
Build agents that call your own tools, validate every input against a JSON schema before running, and stop for approval where needed. Connect external MCP servers over stdio or HTTP.
- Tools declare their side effects (read-only or write)
- Memory, checkpoints and resuming an interrupted run
- Step limits and deadlines for every agent run
- Live progress to the UI over SSE
RAG and text processing
Let the AI answer from your own documents. Chunk text, embed it and search by vector, keyword or both together, with Thai-aware tokenizing.
- Hybrid search (vector + BM25) and HNSW for large corpora
- Streaming summaries of long documents
- A web search tool for agents
- Export and import an index as a binary file
Machine learning and forecasting
Train models on your own data with TensorFlow.js, on the server or in the browser: sales forecasts, anomaly detection, customer segments, recommendations.
- MLP, CNN, LSTM/GRU, autoencoder, Transformer, recommenders and more
- Preprocessing is saved together with the model
- k-fold, grid search, and cancellable training in a worker
- ONNX model inference
Optimization and scenarios
Solve planning problems (LP/MILP) such as allocation, product mix and routing with a solver built into the library. Ask what-if questions, and get proposals a person approves before anything is applied.
- Shadow prices show which constraint limits you most
- Multi-objective optimization
- Draft a scenario from plain-language text
- Never throws: returns a status, and nothing acts on an unusable result
Documents, speech and vision
Read invoices, purchase orders and scans into structured data, transcribe audio to text, and detect people and Thai licence plates from camera frames.
- OCR with Tesseract or an LLM; PDF text layer first, OCR as fallback
- Speech-to-text via cloud or on-device engines, with SRT/VTT output
- People detection, tracking and zone counting with your own ONNX model
- Thai plate parsing with province matching and per-vehicle voting
Measured, not promised
Every figure comes from a measurement recorded in the package's own documentation, taken on an Apple-silicon Mac with Node 24. Results on other machines will differ.
Figures come from CKN's own test suites and benchmarks. Real results depend on each system's hardware and data volume.
What your business gets
No lock-in to one vendor
Pick the LLM that fits your price and quality needs, and change it when the market moves, with the rest of your code untouched. The library embeds no prices: you supply your own table to estimate cost per request.
Risk controlled at code level
Agent tools validate input before every run and declare whether they write data, and a scenario the AI proposes is not applied until a person approves it. Vendor endpoints are limited to https hosts on an allowlist.
Your data and models stay yours
Everything runs inside your own application. OCR, speech-to-text, ML and the solver can run locally without sending data out; an LLM is called only where you choose to. Vision uses the model you select.
An agent that answers from your documents
In use across the CKN stack
- The AI SQL assistant in CKN Intelligent (via the /llm entry that avoids TensorFlow)
- Available to all 14 business services for forecasting, OCR and agents
- The ckn CLI PDF commands (text reading and data extraction)
import { createInMemoryRagStore, createRagTool, createGeminiEmbeddingProvider,
Agent, createClaudeProvider } from "@ckn-technology/ai";
const embedder = createGeminiEmbeddingProvider({
apiKey: process.env.GEMINI_API_KEY!, model: process.env.EMBEDDING_MODEL!
});
const store = createInMemoryRagStore(embedder, {
chunkOptions: { strategy: "paragraph", maxTokens: 512 }
});
await store.index([{ id: "doc-1", text: document1, metadata: { source: "internal-wiki" } }]);
const ragTool = createRagTool(store, { name: "search_knowledge_base", topK: 5,
description: "Search the internal knowledge base." });
const agent = new Agent({
provider: createClaudeProvider({ apiKey: process.env.ANTHROPIC_API_KEY! }),
model: process.env.LLM_MODEL!, tools: [ragTool]
});
const result = await agent.run({ input: "What is our onboarding process?" });
