@cognipeer/console-sdk
v1.1.0
Published
TypeScript SDK for Cognipeer Console - Multi-tenant AI services platform
Readme
Cognipeer Console SDK
Official TypeScript/JavaScript SDK for Cognipeer Console - A multi-tenant SaaS platform for AI and Agentic services.
Features
- 🤖 Chat Completions - OpenAI-compatible chat API with streaming support
- 🧑✈️ Agents - Invoke Console-managed agents via the OpenAI Responses API
- 📊 Embeddings - Text vectorization for semantic search
- 🗄️ Vector Operations - Manage vector databases (Pinecone, Chroma, Qdrant, etc.)
- 📁 File Management - Upload, download, and manage files with markdown conversion + file providers
- 🎙️ Audio - OpenAI-compatible STT, translation, and TTS
- 📄 OCR - Document text extraction with layout/table/KV features
- 🕸️ Crawler - Scheduled and ad-hoc web crawling jobs
- ⚙️ Automations - Trigger and pause built-in scheduled jobs
- 🧪 JS Sandbox - Execute JavaScript inside a managed isolate
- 🔀 Rerankers - Cohere-compatible reranking
- 🛰️ MCP - Talk to the built-in Console MCP server and tenant-configured MCP servers
- 🌐 Browser Automation - Manage browser profiles, drive live sessions, and expose per-browser MCP endpoints
- 🔍 Agent Tracing - Streaming + bulk ingest, OTLP/HTTP JSON, plus OpenTelemetry exporter
- 🧠 Memory Stores - Persist, search, and recall scoped memories
- 🛡️ Guardrails - Evaluate content with tenant guardrail policies
- 🔒 Type-Safe - Full TypeScript support with comprehensive types
- ⚡ Modern - ESM and CommonJS support, works in Node.js and browsers
Installation
npm install @cognipeer/console-sdkyarn add @cognipeer/console-sdkpnpm add @cognipeer/console-sdkQuick Start
import { ConsoleClient } from '@cognipeer/console-sdk';
// Initialize the client
const client = new ConsoleClient({
apiKey: 'your-api-key',
baseURL: 'https://your-console.example.com', // Optional, defaults to https://api.cognipeer.com
});
// Chat completion
const response = await client.chat.completions.create({
model: 'gpt-4',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Hello!' },
],
});
console.log(response.choices[0].message.content);
// Streaming chat
const stream = await client.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Tell me a story' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
// Create embeddings
const embeddings = await client.embeddings.create({
model: 'text-embedding-3-small',
input: 'Hello, world!',
});
console.log(embeddings.data[0].embedding);
// Vector operations
await client.vectors.upsert('my-provider', 'my-index', {
vectors: [
{
id: 'vec1',
values: [0.1, 0.2, 0.3],
metadata: { text: 'Hello world' },
},
],
});
const results = await client.vectors.query('my-provider', 'my-index', {
query: {
vector: [0.1, 0.2, 0.3],
topK: 5,
},
});
// File upload
const file = await client.files.upload('my-bucket', {
fileName: 'document.pdf',
data: 'data:application/pdf;base64,JVBERi0xLjQK...',
convertToMarkdown: true,
});
// Memory
const store = await client.memory.stores.create({
name: 'Support Memory',
vectorProviderKey: 'pinecone-main',
embeddingModelKey: 'text-embedding-3-small',
});
await client.memory.add(store.key, {
content: 'User prefers concise billing explanations.',
scope: 'user',
scopeId: 'user_123',
tags: ['billing', 'preferences'],
source: 'manual',
});
const recall = await client.memory.recall(store.key, {
query: 'user communication preferences',
scope: 'user',
scopeId: 'user_123',
});
console.log(recall.context);Documentation
Full documentation is available at cognipeer.github.io/console-sdk
If you need the platform itself, deployment guidance, tenant architecture, provider setup, or raw HTTP API semantics, use the Cognipeer Console docs.
- Getting Started
- Working with Console
- Console API Mapping
- Chat API
- Embeddings API
- Audio API
- OCR API
- Crawler API
- Automations API
- JS Sandbox API
- Rerankers API
- MCP API
- Guardrails API
- Memory API
- Vector API
- Files API
- Tracing API
- Examples
API Reference
Client Configuration
const client = new ConsoleClient({
apiKey: string; // Required: Your API token
baseURL?: string; // Optional: API host root (default: https://api.cognipeer.com).
// Legacy URLs ending in /api/client/v1 are normalised automatically.
timeout?: number; // Optional: Request timeout in ms (default: 60000)
maxRetries?: number; // Optional: Max retry attempts (default: 3)
fetch?: typeof fetch; // Optional: Custom fetch implementation
});Available Methods
Chat
client.chat.completions.create(params)- Create chat completion (streaming supported)
Embeddings
client.embeddings.create(params)- Create embeddings
Vectors
client.vectors.providers.list(query?)- List vector providersclient.vectors.providers.create(data)- Create vector providerclient.vectors.indexes.list(providerKey)- List indexesclient.vectors.indexes.create(providerKey, data)- Create indexclient.vectors.indexes.get(providerKey, indexId)- Get index detailsclient.vectors.indexes.update(providerKey, indexId, data)- Update indexclient.vectors.indexes.delete(providerKey, indexId)- Delete indexclient.vectors.upsert(providerKey, indexId, data)- Upsert vectorsclient.vectors.query(providerKey, indexId, query)- Query vectorsclient.vectors.delete(providerKey, indexId, ids)- Delete vectors
Files
client.files.buckets.list()- List bucketsclient.files.buckets.get(bucketKey)- Get bucket detailsclient.files.providers.list(query?)- List storage providersclient.files.providers.create(data)- Create a storage providerclient.files.list(bucketKey, query?)- List filesclient.files.upload(bucketKey, data)- Upload fileclient.files.get(bucketKey, objectKey)- Get file metadataclient.files.delete(bucketKey, objectKey)- Delete a fileclient.files.download(bucketKey, objectKey)- Download file bytes (Uint8Array)
Audio
client.audio.transcriptions.create(params)- Speech-to-text (OpenAI-compatible)client.audio.translations.create(params)- Translate audio to Englishclient.audio.speech.create(params)- Synthesize speech (returns binary)
OCR
client.ocr.extract(params)- Extract text/tables/layout from a document
Crawler
client.crawler.list(query?)- List crawlersclient.crawler.create(data)- Create a crawlerclient.crawler.get(idOrKey)- Get a crawlerclient.crawler.update(idOrKey, data)- Update a crawlerclient.crawler.delete(idOrKey)- Delete a crawlerclient.crawler.run(idOrKey, options?)- Trigger a crawler runclient.crawler.crawlWithCrawler(idOrKey, options)- Crawl a fixed URL list using a crawler's configclient.crawler.runAdhoc(options)- Run a one-off crawl without a persistent crawlerclient.crawler.listUrls / addUrls / removeUrls(...)- Manage container URLsclient.crawler.jobs.list(query?)- List crawl jobsclient.crawler.jobs.get(jobId)- Get crawl jobclient.crawler.jobs.listResults(jobId, query?)- List crawled pagesclient.crawler.jobs.getResult(jobId, resultId)- Fetch a single pageclient.crawler.jobs.cancel(jobId)- Cancel a running job
Automations
client.automations.list()- List automationsclient.automations.get(key)- Get an automationclient.automations.run(key)- Trigger immediatelyclient.automations.pause(key)/resume(key)- Pause / resume
JS Sandbox
client.jsSandbox.runtimes.list(query?)- List JS runtimesclient.jsSandbox.runtimes.get(idOrKey)- Get a JS runtimeclient.jsSandbox.execute(data)- Execute a snippet
Rerankers
client.rerankers.list()- List rerankersclient.rerankers.get(key)- Get a rerankerclient.rerankers.run(key, params)- Run a reranker (Cohere-compatible response)
MCP
client.mcp.console.listTools / execute / initialize / callTool / callJsonRpc(...)- Built-in Console MCP serverclient.mcp.console.getSseUrl() / getMessageUrl(sessionId) / getConnectionInfo(apiKey)client.mcp.server(serverKey)- Same interface for a tenant-configured MCP server
Browsers
client.browsers.create(data)- Create a browser profileclient.browsers.list(query?)- List browser profilesclient.browsers.get(idOrKey)- Get browser profile detailsclient.browsers.update(idOrKey, data)- Update a browser profileclient.browsers.delete(idOrKey)- Delete a browser profile
Browser Sessions
client.browserSessions.create(data)- Create a browser session under a browser profileclient.browserSessions.list(query?)- List browser sessionsclient.browserSessions.get(sessionId)- Get browser session detailsclient.browserSessions.listEvents(sessionId, query?)- List session event historyclient.browserSessions.action(sessionKey, action)- Execute a browser actionclient.browserSessions.extract(sessionKey, input)- Extract text, HTML, or attributesclient.browserSessions.snapshot(sessionKey)- Capture the current aria snapshotclient.browserSessions.screenshotLive(sessionKey, query?)- Fetch a raw viewport screenshotclient.browserSessions.screenshot(sessionKey, input?)- Persist a screenshot artifactclient.browserSessions.pdf(sessionKey, input?)- Export a PDF artifactclient.browserSessions.close(sessionKey)- Close a live sessionclient.browserSessions.delete(sessionId)- Delete a stored session record
Browser MCP
client.browserMcp.getConnectionInfo(browserKey)- Build SSE/message endpoint URLs for MCP clientsclient.browserMcp.getSseUrl(browserKey)- Get the SSE endpoint for a browser MCP serverclient.browserMcp.getMessageUrl(browserKey, sessionId)- Build the JSON-RPC message URLclient.browserMcp.initialize(browserKey)- Read the MCP server metadataclient.browserMcp.listTools(browserKey)- List Browser Use MCP tools
Standalone client.browserAgents management has been removed. To give a Console-managed agent browser capabilities, configure the Browser Use system tool in Console. Use client.browserSessions or client.browserMcp for direct browser automation from the SDK.
Prompts
client.prompts.list(query?)- List prompt templatesclient.prompts.get(key, options?)- Get prompt (supportsversion/environment)client.prompts.render(key, options?)- Render prompt with dataclient.prompts.listVersions(key)- List version historyclient.prompts.getDeployments(key)- Get environment deployment states and historyclient.prompts.deploy(key, options)- Runpromote/plan/activate/rollbackclient.prompts.compare(key, fromVersionId, toVersionId)- Compare two versions
Tracing
client.tracing.ingest(data)- Ingest a full tracing sessionclient.tracing.startStream(sessionId, data?)- Open a streaming sessionclient.tracing.appendEvent(sessionId, event)- Append a single eventclient.tracing.endStream(sessionId, data?)- Close a streaming sessionclient.tracing.ingestOtlp(payload)- Submit OTLP/HTTP JSON spans directly
Memory
client.memory.stores.list(query?)- List memory storesclient.memory.stores.create(data)- Create a memory storeclient.memory.stores.get(storeKey)- Get store detailsclient.memory.stores.update(storeKey, data)- Update a memory storeclient.memory.stores.delete(storeKey)- Delete a memory storeclient.memory.add(storeKey, data)- Add a memory itemclient.memory.addBatch(storeKey, memories)- Add memory items in batchclient.memory.list(storeKey, query?)- List memory itemsclient.memory.get(storeKey, memoryId)- Get a memory itemclient.memory.update(storeKey, memoryId, data)- Update a memory itemclient.memory.delete(storeKey, memoryId)- Delete a memory itemclient.memory.deleteBulk(storeKey, query?)- Delete memory items by scope, scopeId, or tagsclient.memory.search(storeKey, data)- Semantic search within a storeclient.memory.recall(storeKey, data)- Build compact context from stored memories
OpenTelemetry Integration
import { CognipeerOTelSpanExporter } from '@cognipeer/console-sdk';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
const exporter = new CognipeerOTelSpanExporter({
apiKey: process.env.COGNIPEER_API_KEY!,
baseURL: process.env.COGNIPEER_BASE_URL || 'https://api.cognipeer.com',
});
const provider = new NodeTracerProvider();
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register();The exporter forwards spans to /api/client/v1/traces using OTLP/HTTP JSON.
Guardrails
client.guardrails.evaluate(data)- Evaluate text against a guardrail
Examples
Check out the examples directory for more detailed usage:
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
MIT © Cognipeer
Support
- 📧 Email: [email protected]
- 📖 Documentation: cognipeer.github.io/console-sdk
- 🐛 Issues: GitHub Issues
