Skip to main content

Constructor

const client = new BoostGPT({
  key: string,           // Required: API key
  project_id: string     // Required: Project ID
});

Bot Management

createBot()

Create a new AI bot.
await client.createBot({
  name: 'Bot Name',
  model: 'gpt-5.1',
  instruction: 'System instruction',
  max_reply_tokens: 1000,
  reasoning_mode: 'auto',
  status: 'active'
});
name
string
required
Display name for your bot
model
string
required
AI model to use: gpt-5.1, gpt-5-mini, claude-3.7-sonnet, gemini-2.0-flash, etc.
instruction
string
required
System instruction guiding the AI’s behavior
max_reply_tokens
number
default:"1000"
Maximum tokens in AI responses
reasoning_mode
string
Reasoning mode: auto, standard, stepwise, react, interactive
status
string
default:"active"
Bot status: active or inactive

fetchBot()

Get a bot’s configuration.
await client.fetchBot(bot_id);
bot_id
string
required
ID of the bot to fetch

fetchBots()

Get all bots in a project (paginated).
await client.fetchBots({
  page: 1,
  per_page: 10
});
page
number
default:"1"
Page number
per_page
number
default:"10"
Items per page

updateBot()

Update a bot’s configuration.
await client.updateBot({
  bot_id: 'bot-123',
  name: 'Updated Name',
  model: 'gpt-5.1',
  instruction: 'New instruction',
  max_reply_tokens: 1500,
  reasoning_mode: 'react',
  status: 'active'
});
All parameters same as createBot(), plus:
bot_id
string
required
ID of the bot to update

resetBot()

Delete all training data from a bot.
await client.resetBot(bot_id);
This permanently deletes all training sources and cannot be undone.

deleteBot()

Delete a bot permanently.
await client.deleteBot(bot_id);
This permanently deletes the bot, its training data, and chat history.

Chat Operations

chat()

Send a message and get an AI response.
await client.chat({
  bot_id: 'bot-123',
  message: 'Hello!',
  chat_id: 'user-456',
  stream: false,
  memory: true,
  model: 'gpt-5.1',
  provider_key: 'optional-key',
  provider_host: 'http://localhost:11434', // For Ollama
  instruction: 'Optional override',
  source_ids: ['source1', 'source2'],
  reasoning_mode: 'react',
  max_reply_tokens: 1000
});
bot_id
string
required
ID of the bot to chat with
message
string
required
User’s message
chat_id
string
Unique ID for conversation continuity
stream
boolean
default:"false"
Enable streaming responses
memory
boolean
default:"true"
Use agent’s training data/memory
model
string
Override bot’s default model
provider_key
string
Use your own API key (BYOK)
provider_host
string
Provider host URL (required for Ollama)
instruction
string
Override bot’s default instruction
source_ids
array
Limit knowledge to specific sources
reasoning_mode
string
Override reasoning mode: auto, standard, stepwise, react, interactive
max_reply_tokens
number
Override bot’s default token limit
Response:
{
  err: null,
  response: {
    chat: {
      reply: "AI response text",
      // ... other fields
    }
  }
}

fetchChat()

Get chat history for a conversation.
await client.fetchChat({
  bot_id: 'bot-123',
  chat_id: 'user-456',
  page: 1,
  per_page: 20
});
bot_id
string
required
Bot ID
chat_id
string
required
Chat/conversation ID
page
number
default:"1"
Page number
per_page
number
default:"20"
Messages per page

fetchChats()

Get all chats for a bot.
await client.fetchChats({
  bot_id: 'bot-123',
  page: 1,
  per_page: 10
});
bot_id
string
required
Bot ID
page
number
default:"1"
Page number
per_page
number
default:"10"
Chats per page

deleteChat()

Delete a chat history.
await client.deleteChat({
  chat_id: 'user-456',
  bot_id: 'bot-123'
});
chat_id
string
required
Chat ID to delete
bot_id
string
required
Bot ID

executeTool()

Execute tool calls for a chat.
await client.executeTool({
  bot_id: 'bot-123',
  chat_id: 'chat-456',
  tool_calls: [
    {
      tool_name: 'calculator',
      parameters: { operation: 'add', a: 5, b: 3 }
    }
  ]
});
bot_id
string
required
Bot ID
chat_id
string
required
Chat ID
tool_calls
array
required
Array of tool call objects with tool_name and parameters

voteMessage()

Vote on a message (upvote/downvote).
await client.voteMessage({
  bot_id: 'bot-123',
  message_id: 'msg-456',
  voter_id: 'user-789',
  voter_type: 'member',
  vote_type: 'upvote' // or 'downvote'
});
bot_id
string
required
Bot ID
message_id
string
required
Message ID to vote on
voter_id
string
required
ID of the user voting
voter_type
string
required
Type of voter (e.g., ‘member’)
vote_type
string
required
Vote type: ‘upvote’ or ‘downvote’

fetchVoteStatus()

Get the vote status for a message.
await client.fetchVoteStatus({
  bot_id: 'bot-123',
  message_id: 'msg-456',
  voter_id: 'user-789',
  voter_type: 'member'
});
bot_id
string
required
Bot ID
message_id
string
required
Message ID
voter_id
string
required
Voter ID
voter_type
string
required
Voter type

deleteMessage()

Delete a specific message.
await client.deleteMessage({
  bot_id: 'bot-123',
  chat_id: 'chat-456',
  message_id: 'msg-789'
});
bot_id
string
required
Bot ID
chat_id
string
required
Chat ID
message_id
string
required
Message ID to delete

Training & Sources

startTraining()

Add training data to a bot.
await client.startTraining({
  bot_id: 'bot-123',
  type: 'text',
  source: 'Your training content here'
});
bot_id
string
required
Bot ID
type
string
default:"text"
Source type: text, website, file, webpage
source
string | array
required
  • text: String content
  • website: String URL to crawl
  • file: Array of file paths
  • webpage: Array of URLs
Response: Training is queued and returns status:
{
  err: null,
  response: {
    id: 'source_xyz789',
    bot_id: 'bot_abc123',
    source: 'Training content...',
    type: 'text',
    status: 'processing', // 'processing', 'success', or 'failed'
    tokens: 150,
    created_at: '2025-01-01T12:00:00Z'
    // For website, file, webpage types:
    // links: ['https://example.com/page1', ...]
  }
}

fetchTraining()

Get a specific training source.
await client.fetchTraining({
  source_id: 'source-123',
  bot_id: 'bot-123'
});

fetchTrainings()

Get all training sources for a bot.
await client.fetchTrainings({
  bot_id: 'bot-123',
  page: 1,
  per_page: 10
});

updateTraining()

Update a training source.
await client.updateTraining({
  source_id: 'source-123',
  bot_id: 'bot-123',
  type: 'text',
  source: 'Updated content'
});
Returns same format as startTraining() with status, tokens, and links.

deleteTraining()

Delete a training source.
await client.deleteTraining({
  source_id: 'source-123',
  bot_id: 'bot-123'
});

search()

Search the bot’s knowledge base.
await client.search({
  bot_id: 'bot-123',
  keywords: 'search query',
  source_ids: ['source1', 'source2']
});
bot_id
string
required
Bot ID
keywords
string
required
Search query
source_ids
array
Limit search to specific sources

Subscribers

fetchSubscribers()

Get all subscribers for your project.
await client.fetchSubscribers({
  page: 1,
  per_page: 10
});
page
number
default:"1"
Page number
per_page
number
default:"10"
Subscribers per page

Analytics & Statistics

fetchVoteStats()

Get voting statistics for a bot.
await client.fetchVoteStats({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchSummaryStats()

Get summary statistics for a bot.
await client.fetchSummaryStats({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchDashboardStats()

Get dashboard statistics for a bot.
await client.fetchDashboardStats({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchToolUsageStats()

Get tool usage statistics for a bot.
await client.fetchToolUsageStats({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchWorkflowStats()

Get workflow statistics for a bot.
await client.fetchWorkflowStats({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchPerformanceMetrics()

Get performance metrics for a bot.
await client.fetchPerformanceMetrics({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchBehaviorStats()

Get user behavior statistics for a bot.
await client.fetchBehaviorStats({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchErrorAnalysis()

Get error analysis for a bot.
await client.fetchErrorAnalysis({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

fetchReasoningSummary()

Get reasoning summary statistics for a bot.
await client.fetchReasoningSummary({
  bot_id: 'bot-123'
});
bot_id
string
required
Bot ID

Error Handling

All methods return a consistent response format:
const result = await client.createBot({ name: 'My Bot' });

if (result.err) {
  // Handle error
  console.error('Error:', result.err.message);
} else {
  // Use response
  console.log('Success:', result.response);
}
Common error codes:
  • 401 - Invalid API key
  • 403 - Insufficient permissions
  • 404 - Resource not found
  • 429 - Rate limit exceeded
  • 500 - Server error

Complete Example

import 'dotenv/config';
import { BoostGPT } from 'boostgpt';

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

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

if (botResult.err) {
  console.error('Error:', botResult.err);
  process.exit(1);
}

const botId = botResult.response.id;

// Add training data
await client.startTraining({
  bot_id: botId,
  type: 'text',
  source: 'Our product helps developers build AI agents...'
});

// Chat with bot
const chatResult = await client.chat({
  bot_id: botId,
  message: 'What does your product do?',
  chat_id: 'user-123'
});

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

Next Steps