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

kronoslabs

v1.1.2

Published

Official JavaScript/TypeScript client for Kronos Labs API

Downloads

9

Readme

Kronos Labs JavaScript/TypeScript Client

Official JavaScript/TypeScript client for the Kronos Labs API.

Installation

npm install kronoslabs
# or
yarn add kronoslabs

Quick Start

JavaScript (CommonJS)

const { KronosLabs } = require("kronoslabs");

// Initialize the client
const client = new KronosLabs({ apiKey: "your-api-key-here" });

// Non-streaming chat completion
async function chat() {
  const response = await client.chat.completions.create({
    prompt: "Hello, how are you?",
    model: "hyperion", // or "hermes"
    temperature: 0.7,
    isStream: false,
  });

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

chat();

TypeScript

import { KronosLabs } from "kronoslabs";

const client = new KronosLabs({ apiKey: "your-api-key-here" });

async function chat() {
  const response = await client.chat.completions.create({
    prompt: "Hello, how are you?",
    model: "hyperion", // or "hermes"
    temperature: 0.7,
    isStream: false,
  });

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

chat();

Streaming

const client = new KronosLabs({ apiKey: "your-api-key-here" });

async function streamChat() {
  const stream = await client.chat.completions.create({
    prompt: "Tell me a story",
    model: "hyperion", // or "hermes"
    temperature: 0.8,
    isStream: true,
  });

  for await (const chunk of stream) {
    if (chunk.choices[0]?.delta?.content) {
      process.stdout.write(chunk.choices[0].delta.content);
    }
  }
}

streamChat();

Features

  • Simple and intuitive API similar to OpenAI's ChatGPT client
  • Full TypeScript support with type definitions
  • Support for multiple models: hyperion and hermes
  • Support for both streaming and non-streaming responses
  • Automatic handling of API authentication
  • Comprehensive error handling
  • Works in Node.js environments
  • Tool calling (coming soon)

API Reference

Initialize Client

const client = new KronosLabs({
  apiKey: "your-api-key",
  baseUrl: "https://kronoslabs.org", // optional
});

Chat Completions

const response = await client.chat.completions.create({
  messages: [], // Optional: array of message objects
  prompt: "Your prompt here", // Required: the prompt text
  model: "hermes", // Optional: "hyperion" or "hermes" (default: "hyperion")
  temperature: 0.7, // Optional: controls randomness (0.0-2.0)
  isStream: false, // Optional: enable streaming
  tool: false, // Optional: enable tool usage (Work in Progress - not yet functional)
});

Parameters

  • messages (array, optional): Array of message objects with role and content properties
  • prompt (string, required): The prompt text to send to the model
  • model (string, optional): Model to use - either "hyperion" or "hermes". Default: "hyperion"
  • temperature (number, optional): Controls randomness in the response (0.0-2.0). Default: 0.7
  • isStream (boolean, optional): Enable streaming responses. Default: false
  • tool (boolean, optional): Work in Progress - Tool calling functionality is currently under development and not yet available. Default: false

Response Format

Non-streaming response:

{
  id: string;
  object: 'chat.completion';
  created: number;
  model: string;
  choices: [{
    index: number;
    message: {
      role: 'assistant';
      content: string;
    };
    finish_reason: string;
  }];
  usage: {
    prompt_tokens: number;
    completion_tokens: number;
    total_tokens: number;
  };
}

Streaming response (async iterable of chunks):

{
  id: string;
  object: 'chat.completion.chunk';
  created: number;
  model: string;
  choices: [{
    index: number;
    delta: {
      role?: 'assistant';
      content?: string;
    };
    finish_reason: string | null;
  }];
}

Error Handling

import { KronosLabs, KronosLabsError } from "kronoslabs";

const client = new KronosLabs({ apiKey: "your-api-key" });

try {
  const response = await client.chat.completions.create({
    prompt: "Hello",
  });
} catch (error) {
  if (error instanceof KronosLabsError) {
    console.error("API error:", error.message);
    console.error("Status code:", error.statusCode);
  }
}

Examples

See the examples directory for more usage examples:

  • basic-chat.js - Simple non-streaming chat
  • streaming-chat.js - Streaming responses
  • chat-with-history.js - Maintaining conversation history
  • error-handling.js - Handling errors

License

MIT License