npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@usecortex_ai/node

v0.5.4

Published

The official TypeScript SDK for the Cortex AI platform.

Downloads

716

Readme

Cortex AI TypeScript SDK

The official TypeScript SDK for the Cortex AI platform. Build powerful, context-aware AI applications in your Node.js or TypeScript projects.

Cortex is your plug-and-play memory infrastructure. It powers intelligent, context-aware retrieval for any AI app or agent. Whether you’re building a customer support bot, research copilot, or internal knowledge assistant - Cortex handles all!

Learn more about the SDK from our docs

Core features

  • Dynamic retrieval and querying that always retrieve the most relevant context
  • Built-in long-term memory that evolves with every user interaction
  • Personalization hooks for user preferences, intent, and history
  • Developer-first SDK with the most flexible APIs and fine-grained controls

Getting started

Installation

npm i @usecortex_ai/node
# or
yarn add @usecortex_ai/node
# or
pnpm add @usecortex_ai/node

Client setup

import { CortexAIClient } from "@usecortex_ai/node";

const client = new CortexAIClient({
  token: process.env.CORTEX_API_KEY,
});

Create a Tenant

You can consider a tenant as a single database that can have internal isolated collections called sub-tenants. Know more about the concept of tenant here

async function createTenant() {
  const tenantCreationResponse = await client.tenant.create({
    tenant_id: "my-company"
  });
  return tenantCreationResponse;
}

Index Your Data

When you index your data, you make it ready for retrieval from Cortex using natural language.

// Add to your knowledge base
import fs from 'fs';

const uploadResult = await client.upload.knowledge({
  files: [
    fs.readFileSync("a.pdf"),
    fs.readFileSync("b.pdf")
  ],
  tenant_id: "tenant_123",
  file_metadata: [
    {
      id: "doc_a",
      tenant_metadata: { dept: "sales" },
      document_metadata: { author: "Alice" },
      relations: false
    },
    {
      id: "doc_b",
      tenant_metadata: { dept: "marketing" },
      document_metadata: { author: "Bob" },
      relations: true
    }
  ]
});

// Index user memories
const result = await client.userMemory.add({
  memories: [
    {
      text: "User prefers detailed explanations and dark mode",
      infer: true,
      user_name: "John"
    }
  ],
  tenant_id: "tenant-01",
  sub_tenant_id: "",
  upsert: true
});

// Markdown content
const markdownResult = await client.userMemory.add({
  memories: [
    {
      text: "# Meeting Notes\n\n## Key Points\n- Budget approved\n- Launch date: Q2",
      is_markdown: true,
      infer: false,
      title: "Meeting Notes"
    }
  ],
  tenant_id: "tenant-01",
  sub_tenant_id: "",
  upsert: true
});

// User-assistant pairs with inference
const conversationResult = await client.userMemory.add({
  memories: [
    {
      user_assistant_pairs: [
        { user: "What are my preferences?", assistant: "You prefer dark mode and detailed explanations." },
        { user: "How do I like my reports?", assistant: "You prefer weekly summary reports with charts." }
      ],
      infer: true,
      user_name: "John",
      custom_instructions: "Extract user preferences"
    }
  ],
  tenant_id: "tenant-01",
  sub_tenant_id: "",
  upsert: true
});

For a more detailed explanation of document upload, including supported file formats, processing pipeline, metadata handling, and advanced configuration options, refer to the Ingest Knowledge.

Search

// Search across memories/knowledge base
const results = await client.recall.fullRecall({
  query: "Which mode does user prefer",
  tenantId: "tenant_1234",
  subTenantId: "sub_tenant_4567",
  alpha: 0.8,
  recencyBias: 0
});;

// List all the data (memories + knowledge base)
const allSources = await client.data.listData({
  tenant_id: "tenant_1234",
  sub_tenant_id: "sub_tenant_4567"
});

For a more detailed explanation of search and retrieval, including query parameters, scoring mechanisms, result structure, and advanced search features, refer to the Recall endpoint documentation.

SDK Method Structure & Type Safety

Our SDKs follow a predictable pattern that mirrors the API structure while providing full type safety.

Method Mapping : client.<group>.<functionName> mirrors api.usecortex.ai/<group>/<function_name>

For example: client.upload.uploadText() corresponds to POST /upload/upload_text

The SDKs provide exact type parity with the API specification:

  • Request Parameters : Every field documented in the API reference (required, optional, types, validation rules) is reflected in the SDK method signatures
  • Response Objects : Return types match the exact JSON schema documented for each endpoint
  • Error Types : Exception structures mirror the error response formats from the API
  • Nested Objects : Complex nested parameters and responses maintain their full structure and typing

This means you can rely on your IDE’s autocomplete and type checking. If a parameter is optional in the API docs, it’s optional in the SDK. If a response contains a specific field, your IDE will know about it. Our SDKs are built in such a way that your IDE will automatically provide autocompletion, type-checking, inline documentation with examples, and compile time validation for each and every method.

Just hit Cmd+Space/Ctrl+Space!

Links

Our docs

Please refer to our API reference for detailed explanations of every API endpoint, parameter options, and advanced use cases.

Support

If you have any questions or need help, please reach out to our support team at [email protected].