> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boostgpt.co/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK Overview

> Understand the BoostGPT SDK ecosystem

## Two SDKs, One Platform

BoostGPT provides two complementary SDKs that work together:

> [card] [Core SDK](https://docs.boostgpt.co/sdk/core/installation.md)
>
> **`boostgpt`**
>
> Manage bots, chat API, training data, and knowledge base

> [card] [Router SDK](https://docs.boostgpt.co/sdk/router/installation.md)
>
> **`@boostgpt/router`**
>
> Deploy bots to Discord, Telegram, Slack, WhatsApp, and Crisp

## When to Use Each SDK

> [tab] Core SDK
>
> Use the **Core SDK** when you need to:
>
> * Create and manage AI bots
> * Configure bot behavior and models
> * Add training data and knowledge sources
> * Send chat messages programmatically
> * Search your bot's knowledge base
> * Manage chat history
> * Build custom web interfaces
>
> ```javascript theme={null}
> import { BoostGPT } from 'boostgpt';
>
> const client = new BoostGPT({
>   key: process.env.BOOSTGPT_API_KEY,
>   project_id: process.env.BOOSTGPT_PROJECT_ID
> });
>
> // Create a bot
> await client.createBot({
>   name: 'Support Bot',
>   model: 'gpt-6-luna',
>   instruction: 'You are a helpful support agent'
> });
>
> // Chat with the bot
> const response = await client.chat({
>   bot_id: 'bot-123',
>   message: 'Hello!',
>   chat_id: 'user-456'
> });
> ```

> [tab] Router SDK
>
> Use the **Router SDK** when you need to:
>
> * Deploy bots to multiple messaging platforms
> * Handle messages from Discord, Telegram, Slack, etc.
> * Normalize messages across different channels
> * Build omnichannel AI agents
> * Create unified message handlers
>
> ```javascript theme={null}
> import { Router, DiscordAdapter, TelegramAdapter } from '@boostgpt/router';
>
> const router = new Router({
>   apiKey: process.env.BOOSTGPT_API_KEY,
>   projectId: process.env.BOOSTGPT_PROJECT_ID,
>   adapters: [
>     new DiscordAdapter({ discordToken: process.env.DISCORD_TOKEN }),
>     new TelegramAdapter({ telegramToken: process.env.TELEGRAM_TOKEN })
>   ]
> });
>
> // One handler for ALL channels
> router.onMessage(async (message, context) => {
>   console.log(`${context.channel}: ${message.content}`);
>   return 'Response here';
> });
>
> await router.start();
> ```

> [tab] Both Together
>
> Use **both SDKs** for the complete solution:
>
> ```javascript theme={null}
> import { BoostGPT } from 'boostgpt';
> import { Router, DiscordAdapter } from '@boostgpt/router';
>
> // Core SDK - Manage your bot
> const client = new BoostGPT({
>   key: process.env.BOOSTGPT_API_KEY,
>   project_id: process.env.BOOSTGPT_PROJECT_ID
> });
>
> // Create or update bot configuration
> await client.updateBot({
>   bot_id: process.env.BOOSTGPT_BOT_ID,
>   model: 'gpt-6-luna',
>   instruction: 'Updated instructions'
> });
>
> // Router SDK - Deploy to channels
> const router = new Router({
>   apiKey: process.env.BOOSTGPT_API_KEY,
>   projectId: process.env.BOOSTGPT_PROJECT_ID,
>   defaultBotId: process.env.BOOSTGPT_BOT_ID,
>   adapters: [
>     new DiscordAdapter({ discordToken: process.env.DISCORD_TOKEN })
>   ]
> });
>
> await router.start();
> // Your bot is now live on Discord!
> ```

## Architecture Overview

```mermaid theme={null}
graph TB
    A[Your Application] --> B[Core SDK]
    A --> C[Router SDK]
    B --> D[BoostGPT API]
    C --> D
    C --> E[Discord]
    C --> F[Telegram]
    C --> G[Slack]
    C --> H[WhatsApp]
    C --> I[Crisp]
    D --> J[OpenAI/Claude/Gemini]
```

## Feature Comparison

| Feature | Core SDK | Router SDK |
| - | - | - |
| Bot Management | ✅ | ❌ |
| Training Data | ✅ | ❌ |
| Chat API | ✅ | ✅ (via router) |
| Discord Support | ❌ | ✅ |
| Telegram Support | ❌ | ✅ |
| Slack Support | ❌ | ✅ |
| WhatsApp Support | ❌ | ✅ |
| Crisp Support | ❌ | ✅ |
| Unified Message Handler | ❌ | ✅ |
| Custom Adapters | ❌ | ✅ |

## Installation

> [tab] Core SDK Only
>
> ```bash theme={null}
> npm install boostgpt
> ```

> [tab] Router SDK Only
>
> ```bash theme={null}
> npm install boostgpt @boostgpt/router
> ```
>
> > [!NOTE]
> >
> > The Router SDK depends on `boostgpt`, so you need to install both.

> [tab] Both
>
> ```bash theme={null}
> npm install boostgpt @boostgpt/router
> ```

## Common Patterns

### Pattern 1: Web App + API

Use **Core SDK only** for web applications:

```javascript theme={null}
import { BoostGPT } from 'boostgpt';

// In your web backend
app.post('/api/chat', async (req, res) => {
  const client = new BoostGPT({ key, project_id });
  
  const result = await client.chat({
    bot_id: 'bot-123',
    message: req.body.message,
    chat_id: req.user.id
  });
  
  res.json(result.response);
});
```

### Pattern 2: Multi-Channel Bot

Use **Router SDK** for omnichannel deployment:

```javascript theme={null}
import { Router, DiscordAdapter, TelegramAdapter } from '@boostgpt/router';

const router = new Router({
  apiKey: process.env.BOOSTGPT_API_KEY,
  projectId: process.env.BOOSTGPT_PROJECT_ID,
  defaultBotId: process.env.BOOSTGPT_BOT_ID,
  adapters: [
    new DiscordAdapter({ discordToken: process.env.DISCORD_TOKEN }),
    new TelegramAdapter({ telegramToken: process.env.TELEGRAM_TOKEN })
  ]
});

await router.start();
```

### Pattern 3: Dynamic Bot Configuration

Use **both SDKs** for advanced use cases:

```javascript theme={null}
import { BoostGPT } from 'boostgpt';
import { Router, DiscordAdapter } from '@boostgpt/router';

const client = new BoostGPT({ key, project_id });
const router = new Router({ apiKey, projectId, adapters: [...] });

// Dynamically update bot behavior
router.onMessage(async (message, context) => {
  // Check if it's a command to update the bot
  if (message.content.startsWith('/setmodel')) {
    const model = message.content.split(' ')[1];
    
    await client.updateBot({
      bot_id: context.adapter.botId,
      model: model
    });
    
    return `Model updated to ${model}`;
  }
  
  // Normal chat handling
  return null;
});
```

## Module Systems

Both SDKs support ES Modules and CommonJS:

> [tab] ES Modules (Recommended)
>
> ```javascript theme={null}
> import { BoostGPT } from 'boostgpt';
> import { Router, DiscordAdapter } from '@boostgpt/router';
> ```
>
> Requires Node.js 14+ and `"type": "module"` in `package.json` or `.mjs` file extension.

> [tab] CommonJS
>
> ```javascript theme={null}
> const { BoostGPT } = require('boostgpt');
> const { Router, DiscordAdapter } = require('@boostgpt/router');
> ```
>
> Works with any Node.js version 12+.

## Next Steps

> [card] [Core SDK Installation](https://docs.boostgpt.co/sdk/core/installation.md)
>
> Install and configure the Core SDK

> [card] [Router SDK Installation](https://docs.boostgpt.co/sdk/router/installation.md)
>
> Install and configure the Router SDK

> [card] [Core API Reference](https://docs.boostgpt.co/sdk/core/api-reference.md)
>
> Explore Core SDK methods

> [card] [Router API Reference](https://docs.boostgpt.co/sdk/router/api-reference.md)
>
> Explore Router SDK methods


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.