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

@schmitech/chatbot-api

v2.1.6

Published

API client for the ORBIT MCP server

Readme

🤖 ORBIT Chatbot API Client

A TypeScript/JavaScript client for seamless interaction with the ORBIT server, supporting API key authentication and session tracking.

📥 Installation

npm install @schmitech/chatbot-api

⚙️ Basic Usage

Configuration

First, initialize the API client with your server details:

import { ApiClient } from '@schmitech/chatbot-api';

const client = new ApiClient({
  apiUrl: 'https://your-api-server.com',
  apiKey: 'your-api-key',
  sessionId: 'optional-session-id' // Optional, for conversation tracking
});

Streaming Chat Example

async function chat() {
  const stream = client.streamChat('Hello, how can I help?');
  
  for await (const response of stream) {
    console.log(response.text);
    if (response.done) {
      console.log('Chat complete!');
    }
  }
}

Local test in Node.js environment

First, verify you have Node.js and its package manager, npm, installed. Then create a new folder.

node -v
npm -v

Initialize a Node.js Project

npm init -y

Modify package.json

{
  "name": "orbit-node",
  "version": "1.0.0",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@schmitech/chatbot-api": "^0.5.0"
  }
}

Install chatbot api

npm install @schmitech/chatbot-api

Run this test

node test/test-npm-package.js "how many r are in a strawberry?" "http://localhost:3000" "my-session-123"

⚛️ React Integration

Here's how to use the API in a React component:

import React, { useState, useMemo } from 'react';
import { ApiClient } from '@schmitech/chatbot-api';

function ChatComponent() {
  const [messages, setMessages] = useState<Array<{ text: string; isUser: boolean }>>([]);
  const [input, setInput] = useState('');

  // Initialize client (memoize to avoid re-creation on every render)
  const client = useMemo(() => new ApiClient({
    apiUrl: 'https://your-api-server.com',
    apiKey: 'your-api-key',
    sessionId: 'user_123_session_456' // Optional
  }), []);

  const handleSubmit = async (e: React.FormEvent) => {
    e.preventDefault();
    if (!input.trim()) return;

    setMessages(prev => [...prev, { text: input, isUser: true }]);

    let responseText = '';
    const stream = client.streamChat(input);

    for await (const response of stream) {
      responseText += response.text;
      setMessages(prev => {
        const newMessages = [...prev];
        if (newMessages.length > 0 && !newMessages[newMessages.length - 1].isUser && responseText.startsWith(newMessages[newMessages.length - 1].text)) {
           // Update existing bot message if it's the last one
           newMessages[newMessages.length - 1] = { text: responseText, isUser: false };
           return newMessages;
        }
        return [...prev, { text: responseText, isUser: false }];
      });
      if (response.done) break;
    }
    setInput('');
  };

  return (
    <form onSubmit={handleSubmit}>
      <input 
        value={input} 
        onChange={(e) => setInput(e.target.value)} 
        placeholder="Type your message..."
      />
      <button type="submit">Send</button>
    </form>
  );
}

📱 Mobile Usage

React Native Example

import { configureApi, streamChat } from '@schmitech/chatbot-api';

// Configure once at app startup
configureApi({
  apiUrl: 'https://your-api-server.com',
  apiKey: 'your-api-key',
  sessionId: 'user_123_session_456' // Optional
});

async function handleChat(message: string) {
  for await (const response of streamChat(message, true)) {
    // Handle streaming response
    console.log(response.text);
    if (response.done) {
      console.log('Chat complete!');
    }
  }
}

🌐 CDN Integration

You can also use the API directly in the browser via CDN:

<script type="module">
  import { configureApi, streamChat } from 'https://cdn.jsdelivr.net/npm/@schmitech/chatbot-api/dist/api.mjs';

  configureApi({
    apiUrl: 'https://your-api-server.com',
    apiKey: 'your-api-key',
    sessionId: 'your-session-id' // Optional
  });

  async function handleChat() {
    for await (const response of streamChat('Hello', true)) {
      console.log(response.text);
    }
  }
</script>

📚 API Reference

configureApi(config)

Configure the API client with server details.

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | apiUrl | string | Yes | Chatbot API server URL | | apiKey | string | Yes | API key for authentication | | sessionId | string | No | Session ID for conversation tracking |

streamChat(message: string, stream: boolean = true)

Stream chat responses from the server.

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | message | string | - | The message to send to the chat | | stream | boolean | true | Whether to stream the response |

Returns an AsyncGenerator that yields StreamResponse objects:

interface StreamResponse {
  text: string;    // The text content of the response
  done: boolean;   // Whether this is the final response
}

🔒 Security

  • Always use HTTPS for your API URL
  • Keep your API key secure and never expose it in client-side code
  • Consider using environment variables for sensitive configuration