Skip to main content

What is the Core SDK?

The Core SDK provides programmatic access to create, manage, and interact with BoostGPT agents. It handles bot management, chat interactions, and training data.

Installation

npm install boostgpt

Quick Start

import { BoostGPT } from 'boostgpt';

const client = new BoostGPT({
  project_id: process.env.BOOSTGPT_PROJECT_ID,
  key: process.env.BOOSTGPT_API_KEY
});

Key Features

Response Format

All SDK methods return a consistent format:
{
  err: null | string,      // Error message if failed
  response: object | null  // Response data if successful
}
Always check err before using response:
const result = await client.createBot({
  name: 'My Bot',
  model: 'gpt-5-mini',
  instruction: 'You are helpful.'
});

if (result.err) {
  console.error('Error:', result.err);
} else {
  console.log('Success:', result.response);
}

Available Methods

Bot Management

  • createBot() - Create a new bot
  • fetchBot() - Get bot details
  • fetchBots() - List all bots (paginated)
  • updateBot() - Update bot settings
  • resetBot() - Delete all training data
  • deleteBot() - Delete a bot

Chat

  • chat() - Send message and get response (supports streaming)
  • fetchChat() - Get chat history
  • fetchChats() - List all chats (paginated)
  • deleteChat() - Delete chat history
  • search() - Search bot’s knowledge base
  • executeTool() - Execute tool calls
  • voteMessage() - Upvote/downvote messages
  • fetchVoteStatus() - Get message vote status
  • deleteMessage() - Delete a specific message

Training

  • startTraining() - Add training content (queued)
  • fetchTraining() - Get training source
  • fetchTrainings() - List training data (paginated)
  • updateTraining() - Update training source
  • deleteTraining() - Remove training data

Subscribers

  • fetchSubscribers() - Get all subscribers (paginated)

Analytics & Statistics

  • fetchVoteStats() - Get voting statistics
  • fetchSummaryStats() - Get summary statistics
  • fetchDashboardStats() - Get dashboard statistics
  • fetchToolUsageStats() - Get tool usage statistics
  • fetchWorkflowStats() - Get workflow statistics
  • fetchPerformanceMetrics() - Get performance metrics
  • fetchBehaviorStats() - Get user behavior statistics
  • fetchErrorAnalysis() - Get error analysis
  • fetchReasoningSummary() - Get reasoning summary

Example Usage

// Create a bot
const bot = await client.createBot({
  name: 'Support Bot',
  model: 'gpt-5-mini',
  instruction: 'You are a customer support assistant.'
});

// Add training
await client.startTraining({
  bot_id: bot.response.id,
  type: 'text',
  source: 'We offer 24/7 support at support@example.com'
});

// Chat
const response = await client.chat({
  bot_id: bot.response.id,
  message: 'How can I contact support?'
});

console.log('Bot:', response.response);

Next Steps