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'
});
Display name for your bot
AI model to use: gpt-5.1, gpt-5-mini, claude-3.7-sonnet, gemini-2.0-flash, etc.
System instruction guiding the AI’s behavior
Maximum tokens in AI responses
Reasoning mode: auto, standard, stepwise, react, interactive
Bot status: active or inactive
fetchBot()
Get a bot’s configuration.
await client.fetchBot(bot_id);
fetchBots()
Get all bots in a project (paginated).
await client.fetchBots({
page: 1,
per_page: 10
});
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:
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
});
ID of the bot to chat with
Unique ID for conversation continuity
Enable streaming responses
Use agent’s training data/memory
Override bot’s default model
Use your own API key (BYOK)
Provider host URL (required for Ollama)
Override bot’s default instruction
Limit knowledge to specific sources
Override reasoning mode: auto, standard, stepwise, react, interactive
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
});
fetchChats()
Get all chats for a bot.
await client.fetchChats({
bot_id: 'bot-123',
page: 1,
per_page: 10
});
deleteChat()
Delete a chat history.
await client.deleteChat({
chat_id: 'user-456',
bot_id: 'bot-123'
});
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 }
}
]
});
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'
});
Type of voter (e.g., ‘member’)
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'
});
deleteMessage()
Delete a specific message.
await client.deleteMessage({
bot_id: 'bot-123',
chat_id: 'chat-456',
message_id: 'msg-789'
});
Training & Sources
startTraining()
Add training data to a bot.
await client.startTraining({
bot_id: 'bot-123',
type: 'text',
source: 'Your training content here'
});
Source type: text, website, file, webpage
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()
Search the bot’s knowledge base.
await client.search({
bot_id: 'bot-123',
keywords: 'search query',
source_ids: ['source1', 'source2']
});
Limit search to specific sources
Subscribers
fetchSubscribers()
Get all subscribers for your project.
await client.fetchSubscribers({
page: 1,
per_page: 10
});
Analytics & Statistics
fetchVoteStats()
Get voting statistics for a bot.
await client.fetchVoteStats({
bot_id: 'bot-123'
});
fetchSummaryStats()
Get summary statistics for a bot.
await client.fetchSummaryStats({
bot_id: 'bot-123'
});
fetchDashboardStats()
Get dashboard statistics for a bot.
await client.fetchDashboardStats({
bot_id: 'bot-123'
});
Get tool usage statistics for a bot.
await client.fetchToolUsageStats({
bot_id: 'bot-123'
});
fetchWorkflowStats()
Get workflow statistics for a bot.
await client.fetchWorkflowStats({
bot_id: 'bot-123'
});
Get performance metrics for a bot.
await client.fetchPerformanceMetrics({
bot_id: 'bot-123'
});
fetchBehaviorStats()
Get user behavior statistics for a bot.
await client.fetchBehaviorStats({
bot_id: 'bot-123'
});
fetchErrorAnalysis()
Get error analysis for a bot.
await client.fetchErrorAnalysis({
bot_id: 'bot-123'
});
fetchReasoningSummary()
Get reasoning summary statistics for a bot.
await client.fetchReasoningSummary({
bot_id: 'bot-123'
});
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