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

nexusai-sdk

v1.0.2

Published

JavaScript SDK for NexusAI - AI Agent Platform for Businesses

Readme

NexusAI JavaScript SDK

Official JavaScript SDK for NexusAI - The Universal AI Agent Platform designed for Africa.

npm version License: MIT

🌍 About NexusAI

NexusAI is a comprehensive AI agent platform built specifically for the African market, offering:

  • 🎯 Business Logic Adapters - Language Learning, Emergency Services, and more
  • 🎤 Multimodal Capabilities - Voice, vision, and text interactions
  • 📱 Mobile-First Design - Optimized for African connectivity conditions
  • 🔒 Enterprise Security - SSL encryption and secure API endpoints

🚀 Quick Start

Installation

npm install nexusai-sdk

Basic Usage

const { NexusAIClient } = require('nexusai-sdk');

// Initialize client with production endpoint
const client = new NexusAIClient('https://nexus.bits-innovate.com');

// Create an AI agent for language learning
const agent = await client.createAgent({
  instructions: "You are a friendly language tutor for African students learning English",
  capabilities: ["text", "voice"],
  business_logic_adapter: "languagelearning"
});

// Start a conversation session
const session = await client.createSession({
  agent_id: agent.id,
  client_id: "mobile-app-v1"
});

// Send a message
const response = await client.sendMessage(session.session_id, "Hello, help me learn English!");
console.log(response.message);

📚 Documentation

Client Initialization

// Production (Recommended)
const client = new NexusAIClient('https://nexus.bits-innovate.com', 'your-api-key');

// Local Development
const client = new NexusAIClient('http://localhost:8000');

Agent Management

// Create specialized agents
const languageAgent = await client.createAgent({
  instructions: "Expert English tutor for African students",
  capabilities: ["text", "voice"],
  business_logic_adapter: "languagelearning",
  custom_settings: {
    level: "beginner",
    focus: "conversation"
  }
});

const emergencyAgent = await client.createAgent({
  instructions: "Emergency response coordinator for urgent situations",
  capabilities: ["text", "voice"],
  business_logic_adapter: "emergencyservices",
  custom_settings: {
    region: "west-africa",
    languages: ["english", "french"]
  }
});

Advanced Session Management

// Create session
const session = await client.createSession({
  agent_id: agent.id,
  client_id: "mobile-app-user-123"
});

// Send messages
const response = await client.sendMessage(
  session.session_id, 
  "I need help with English pronunciation"
);

// Get conversation history
const messages = await client.getMessages(session.session_id, 10);

Multimodal Features

// Voice messages (for language learning)
const audioResponse = await client.sendVoiceMessage(
  session.session_id,
  audioBuffer
);

// Image analysis
const imageResponse = await client.sendImageMessage(
  session.session_id,
  imageBuffer
);

Emergency Services Integration

// Emergency agent with phone integration
const emergencyAgent = await client.createAgent({
  instructions: "Emergency response coordinator",
  capabilities: ["text", "voice"],
  business_logic_adapter: "emergencyservices"
});

// Emergency message triggers automatic escalation
const response = await client.sendMessage(
  emergencySession.session_id,
  "Medical emergency - need ambulance immediately!"
);
// Automatically triggers phone call to emergency services

🏗️ Advanced Usage

Error Handling

try {
  const response = await client.sendMessage(sessionId, message);
  console.log(response.message);
} catch (error) {
  if (error.message.includes('session not found')) {
    // Handle session expiry
    const newSession = await client.createSession(sessionConfig);
  } else if (error.message.includes('rate limit')) {
    // Handle rate limiting
    await delay(1000);
    // Retry request
  }
  console.error('Error:', error.message);
}

Session Management

// Using AgentSession class for easier management
const { AgentSession } = require('nexusai-sdk');

const session = new AgentSession(client, sessionId);
await session.sendMessage("Hello!");
await session.sendVoice(audioBuffer);
const history = await session.getHistory(20);
await session.close();

Quick Setup Helper

const { createSimpleAgent } = require('nexusai-sdk');

// Quick setup for prototyping
const { client, agent, session } = await createSimpleAgent(
  'https://nexus.bits-innovate.com',
  'You are a helpful AI assistant for African businesses',
  ['text', 'voice']
);

const response = await session.sendMessage("Help me with my business plan");

🌍 African Market Features

Language Learning Adapter

  • Beginner/Intermediate/Advanced levels
  • Pronunciation coaching with voice feedback
  • Cultural context for African English variants
  • Offline-capable vocabulary building

Emergency Services Adapter

  • Automatic phone integration with Twilio
  • Geographic awareness for African regions
  • Multi-language support (English, French, Swahili, etc.)
  • Hospital/clinic database integration

🔧 Configuration

Environment Variables

# Optional: Set default API endpoint
NEXUSAI_API_URL=https://nexus.bits-innovate.com

# Optional: Set API key for authenticated requests
NEXUSAI_API_KEY=your-api-key-here

Custom Business Logic

// Create custom adapter for your business
const customAgent = await client.createAgent({
  instructions: "Customer service agent for my e-commerce platform",
  capabilities: ["text", "voice"],
  business_logic_adapter: "custom",
  custom_settings: {
    company: "MyAfrican Business",
    products: ["electronics", "clothing"],
    languages: ["english", "swahili"]
  }
});

📱 Mobile Integration

Perfect for African mobile apps with:

  • Low bandwidth optimization
  • Offline capability for cached responses
  • Progressive enhancement based on connection quality
  • SMS fallback for emergency services
// Mobile-optimized configuration
const mobileClient = new NexusAIClient('https://nexus.bits-innovate.com');

// Enable compression for slower connections
const response = await mobileClient.sendMessage(
  sessionId, 
  message,
  { compress: true, timeout: 30000 }
);

🔒 Security

  • HTTPS only in production
  • API key authentication for sensitive operations
  • Rate limiting protection
  • Input validation and sanitization

🤝 Support

📄 License

MIT License - see LICENSE file for details.

🌟 Contributing

We welcome contributions from the African developer community! Please read our contributing guidelines and submit pull requests.


Built with ❤️ for Africa by Bits Innovate