Skip to main content

Typescript Library


🚧 Cortex is under construction.

Cortex provides a robust Typescript client library designed as a direct substitute for OpenAI's Node.js/Typescript library, enabling easy integration and streamlined workflows.


Install the package via npm with the following command in your project:

npm install @janhq/cortex-node


Transitioning to the Cortex Client Library from the OpenAI Client Library involves minimal changes, mostly updating the import statement.

  1. Replace the OpenAI import with Cortex in your application:

- import OpenAI from 'openai';
+ import { Cortex } from '@janhq/cortex-node';

  1. Modify the initialization of the client to use Cortex:

- const openai = new OpenAI({
+ const cortex = new Cortex({
baseURL: ['BASE_URL'], // The default base URL for Cortex is 'http://localhost:1337'
apiKey: process.env['OPENAI_API_KEY'], // This can be omitted if using the default

Example Usage

import { Cortex } from "@janhq/cortex-node";
const cortex = new Cortex({
baseURL: ["http://localhost:1337"],
apiKey: process.env["cortex"],