Docs/AI SDK

AI

Cencori SDK

Last updated April 17, 2026

The official Cencori SDK for Node.js and TypeScript. Simple, type-safe API for chat, images, embeddings, memory, and more.

Installation

Codetext
npm install cencori

Initialization

Codetext
import { Cencori } from 'cencori';
 
const cencori = new Cencori({
  apiKey: 'csk_...',
});

Chat Completions

Codetext
const response = await cencori.ai.chat({
  model: 'gpt-4o',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'Hello!' },
  ],
});
 
console.log(response.content);
console.log(response.usage); // { promptTokens, completionTokens, totalTokens }

Streaming

Codetext
const stream = cencori.ai.chatStream({
  model: 'claude-opus-4',
  messages: [{ role: 'user', content: 'Tell me a story' }],
});
 
for await (const chunk of stream) {
  process.stdout.write(chunk.delta);
}

Image Generation

Codetext
const response = await cencori.ai.generateImage({
  prompt: 'A futuristic city at sunset',
  model: 'gpt-image-1.5',
  size: '1024x1024',
  quality: 'hd',
});
 
console.log(response.images[0].url);

Embeddings

Codetext
const response = await cencori.ai.embeddings({
  model: 'text-embedding-3-small',
  input: 'Hello world',
});
 
console.log(response.embeddings[0]);

Memory (Context Store)

Codetext
await cencori.memory.store({
  namespace: 'docs',
  content: 'Refund policy allows returns within 30 days',
  metadata: { category: 'policy' },
});
 
const results = await cencori.memory.search({
  namespace: 'docs',
  query: 'what is our refund policy?',
  limit: 5,
});
 
const response = await cencori.ai.rag({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Refund policy?' }],
  namespace: 'docs',
});

Available Methods

MethodDescription
cencori.ai.chat()Chat completions
cencori.ai.chatStream()Streaming chat
cencori.ai.generateImage()Image generation
cencori.ai.embeddings()Vector embeddings
cencori.ai.rag()RAG with memory search
cencori.memory.store()Store memory
cencori.memory.search()Semantic search
cencori.telemetry.reportWebRequest()Report web traffic to dashboard