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

@nonefinity/ai-sdk

v1.1.1

Published

AI SDK for integrating Nonefinity chat system into any website

Readme

@nonefinity/ai-sdk

npm version License: MIT

AI SDK for integrating Nonefinity's powerful chat system into any website. Built with TypeScript, React, and Server-Sent Events (SSE) for real-time streaming.

Features

  • 🚀 Easy Integration - Drop-in chat widget for any website
  • 💬 Real-time Streaming - Server-Sent Events (SSE) for live responses
  • 🛠️ Tool Execution - Support for AI agent tools with live feedback
  • 🎨 Customizable UI - Flexible styling and positioning options
  • 📦 TypeScript Support - Full type definitions included
  • ⚛️ React Components - Pre-built React components
  • 🔐 Secure - Support for API keys and custom auth tokens

Installation

Always install the latest published version to benefit from the newest browser fixes and streaming improvements.

npm install @nonefinity/ai-sdk
# or
yarn add @nonefinity/ai-sdk
# or
pnpm add @nonefinity/ai-sdk

Heads up: Version 1.0.1 includes improved SSE parsing for browsers that deliver events as strings (Safari, some Chromium builds). Upgrade if you previously saw empty assistant replies.

Examples

Check out our example implementation:

Quick Start

React Chat Widget

import { ChatWidget } from "@nonefinity/ai-sdk";
import "@nonefinity/ai-sdk/styles";

function App() {
    return (
        <ChatWidget
            sessionId="your-session-id"
            apiKey="your-api-key"
            position="bottom-right"
            primaryColor="#3b82f6"
            title="AI Assistant"
            placeholder="Ask me anything..."
        />
    );
}

Simple Client API

import { NonefinitySimpleClient } from "@nonefinity/ai-sdk/simple";

const client = new NonefinitySimpleClient({
    chatConfigId: "your-config-id",
    apiKey: "your-api-key",
    // apiUrl: "https://api.nonefinity.com/api/v1", // Optional: Defaults to production
    session: "auto", // auto-generate session ID
});

// Send a message with streaming
await client.chat("Hello, how can you help me?", (event) => {
    if (event.event === "message" && event.data.content) {
        console.log("AI:", event.data.content);
    }
});

Advanced Client API

import { NonefinityClient } from "@nonefinity/ai-sdk";

const client = new NonefinityClient({
    apiKey: "your-api-key",
    // apiUrl: "https://api.nonefinity.com/api/v1", // Optional: Defaults to production
    debug: true,
});

// Create a chat configuration
const config = await client.createConfig({
    name: "My Chat Bot",
    chat_model_id: "model-id",
    instruction_prompt: "You are a helpful assistant.",
});

// Create a chat session
const session = await client.createSession({
    chat_config_id: config.data.id,
    name: "User Conversation",
});

// Stream a message
await client.streamMessage(
    session.data.id,
    "Hello, how can you help me?",
    (event) => {
        if (event.event === "ai_result") {
            console.log("AI:", event.data.content);
        } else if (event.event === "tool_calls") {
            console.log("Tool called:", event.data.name);
        }
    }
);

API Reference

NonefinitySimpleClient

Simplified client for basic chat functionality.

new NonefinitySimpleClient(config: SimpleClientConfig)

Config Options:

  • chatConfigId (string, required) - Chat configuration ID
  • apiKey (string, required) - API key for authentication
  • apiUrl (string, optional) - Base URL of your Nonefinity API (defaults to production)
  • session (string | "auto", optional) - Session ID or "auto" to generate

Methods:

// Send a chat message with streaming
chat(message: string, onEvent: (event: StreamEvent) => void): Promise<void>

// Get current session ID
getSessionId(): string | null

// Clear current session
clearSession(): void

// Create a new session
createSession(): Promise<string>

NonefinityClient

Full-featured client for complete API access.

Config Options:

  • apiUrl (string, optional) - Base URL of your Nonefinity API (defaults to production)
  • apiKey (string, optional) - API key for authentication
  • getAuthToken (function, optional) - Function to get dynamic auth token
  • debug (boolean, optional) - Enable debug logging

Key Methods:

// Chat Configuration
listConfigs(skip?: number, limit?: number): Promise<ApiResponse<ChatConfigListResponse>>
createConfig(data: ChatConfigCreate): Promise<ApiResponse<ChatConfig>>
updateConfig(id: string, data: ChatConfigUpdate): Promise<ApiResponse<ChatConfig>>
deleteConfig(id: string): Promise<ApiResponse<void>>

// Chat Sessions
listSessions(skip?: number, limit?: number): Promise<ApiResponse<ChatSessionListResponse>>
createSession(data: ChatSessionCreate): Promise<ApiResponse<ChatSession>>
deleteSession(id: string): Promise<ApiResponse<void>>
clearSessionMessages(id: string): Promise<ApiResponse<void>>

// Streaming
streamMessage(sessionId: string, message: string, onEvent: (event: StreamEvent) => void): Promise<void>

ChatWidget Component

Props:

interface WidgetConfig {
    sessionId: string; // Required - Chat session ID
    apiUrl?: string; // Optional - API base URL (defaults to production)
    apiKey?: string; // Optional - API key
    getAuthToken?: () => Promise<string | null> | string | null; // Optional - Auth token function
    position?: "bottom-right" | "bottom-left" | "top-right" | "top-left"; // Default: "bottom-right"
    primaryColor?: string; // Default: "#3b82f6"
    title?: string; // Default: "AI Assistant"
    placeholder?: string; // Default: "Type your message..."
    className?: string; // Optional - Additional CSS classes
    style?: React.CSSProperties; // Optional - Inline styles
    onError?: (error: Error) => void; // Optional - Error callback
}

Stream Events

The SDK emits the following events during streaming:

| Event | Description | Data | | ------------- | ------------------------------- | ------------------------------ | | start | Stream started | {} | | tool_calls | AI is calling a tool | { name, arguments, id? } | | tool_result | Tool execution completed | { name, result, id? } | | ai_result | AI response content | { role, content, is_delta? } | | error | Error occurred | { message, status_code? } | | message | Generic message (includes done) | { done?: boolean } |

TypeScript Support

Full TypeScript definitions included:

import type {
    ChatConfig,
    ChatSession,
    ChatMessage,
    StreamEvent,
    NonefinityConfig,
    SimpleClientConfig,
} from "@nonefinity/ai-sdk";

Browser Support

  • Chrome/Edge (142)
  • Firefox (145)

License

MIT © Nonefinity

Support

For issues and questions, please visit: