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

@cortiqa/sdk

v0.1.1

Published

Official TypeScript & JavaScript client library for Cortiqa AI & Falin Foundation Models

Readme

Cortiqa AI TypeScript & JavaScript SDK

npm version License: MIT TypeScript

Official TypeScript and JavaScript client library for Cortiqa AI and Falin Foundation Models. Built for modern full-stack web applications, edge runtimes, Next.js, and autonomous AI agents.


⚡ Installation

npm install @cortiqa/sdk

Or using pnpm / yarn / bun:

pnpm add @cortiqa/sdk
# or
yarn add @cortiqa/sdk
# or
bun add @cortiqa/sdk

🚀 Quickstart

Set your API key in your environment:

export CORTIQA_API_KEY="sk-cortiqa-your-api-key"

Option A: Anthropic-Style (client.messages.create)

import Cortiqa from "@cortiqa/sdk";

const client = new Cortiqa();

const message = await client.messages.create({
  model: "falin-01",
  max_tokens: 1024,
  messages: [
    { role: "user", content: "Explain quantum computing in two sentences." }
  ],
});

console.log(message.content);

Option B: OpenAI-Style (client.chat.completions.create)

import Cortiqa from "@cortiqa/sdk";

const client = new Cortiqa();

const completion = await client.chat.completions.create({
  model: "falin-01",
  messages: [
    { role: "system", content: "You are an AI assistant by Cortiqa." },
    { role: "user", content: "Hello!" }
  ],
});

console.log(completion.choices[0].message.content);

🌊 Real-Time Streaming

Effortlessly stream tokens using the built-in textStream() helper:

import Cortiqa from "@cortiqa/sdk";

const client = new Cortiqa();

const stream = await client.messages.stream({
  model: "falin-01",
  messages: [{ role: "user", content: "Write a poem about Mumbai." }],
});

for await (const token of stream.textStream()) {
  process.stdout.write(token);
}

const finalMessage = stream.getFinalMessage();
console.log(`\nTokens used: ${finalMessage.usage?.total_tokens}`);

🛠️ Tool Calling (Function Calling)

Cortiqa Falin models support structured tool execution:

import Cortiqa, { Tool } from "@cortiqa/sdk";

const client = new Cortiqa();

const tools: Tool[] = [
  {
    type: "function",
    function: {
      name: "get_weather",
      description: "Get temperature for a city",
      parameters: {
        type: "object",
        properties: {
          city: { type: "string" },
        },
        required: ["city"],
      },
    },
  },
];

const response = await client.messages.create({
  model: "falin-01",
  messages: [{ role: "user", content: "What is the weather in Delhi?" }],
  tools,
});

if (response.choices[0].message.tool_calls) {
  console.log("Tool requested:", response.choices[0].message.tool_calls);
}

🌐 Runtime Support

The SDK uses standard Web APIs (fetch, AbortController, ReadableStream) and runs out-of-the-box on:

  • Node.js (18+)
  • Next.js (App Router & Server Actions)
  • Vercel Edge Functions
  • Cloudflare Workers
  • Bun & Deno
  • Browsers

⚙️ Configuration

const client = new Cortiqa({
  apiKey: "sk-cortiqa-...",              // Defaults to process.env.CORTIQA_API_KEY
  baseURL: "https://api.cortiqa.co",     // Defaults to https://api.cortiqa.co
  timeout: 60_000,                       // 60 seconds
  maxRetries: 2,                         // Retries on 429/5xx errors
});

🛡️ Error Handling

import Cortiqa, { AuthenticationError, RateLimitError, APIError } from "@cortiqa/sdk";

const client = new Cortiqa();

try {
  const response = await client.messages.create({
    model: "falin-01",
    messages: [{ role: "user", content: "Hi" }],
  });
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error("Invalid API Key!");
  } else if (error instanceof RateLimitError) {
    console.error("Rate limit hit! Back off requests.");
  } else if (error instanceof APIError) {
    console.error(`API Error ${error.status}: ${error.message}`);
  }
}

📄 Documentation Links


📄 License

MIT © Cortiqa AI