- Full ES Modules (ESM) and CommonJS (CJS) support
- Complete API coverage for all BoostGPT endpoints
- Bot/Agent management (create, read, update, delete)
- Chat operations with streaming support
- Memory source/training management
- Tools management (MCP server integration)
- Message voting and feedback
- Subscriber management
- Comprehensive analytics and statistics
- TypeScript-friendly (type definitions coming soon)
- Node.js >= 12.20.0
- For ES Modules: Node.js >= 14.0.0 recommended
- BoostGPT API Key
npm install boostgptimport { BoostGPT } from 'boostgpt';
const client = new BoostGPT({
project_id: 'your-project-id',
key: 'your-api-key'
});
// Create a bot
const botResponse = await client.createBot({
name: 'My Bot',
model: 'gpt-4o-min',
instruction: 'You are a helpful assistant',
max_reply_tokens: 1000,
status: 1
});
if (botResponse.err) {
console.error('Error:', botResponse.err);
} else {
console.log('Bot created:', botResponse.response);
}
// Chat with the bot
const chatResponse = await client.chat({
bot_id: 'bot-id',
message: 'Hello, how are you?'
});
console.log('Response:', chatResponse.response);const { BoostGPT } = require('boostgpt');
const client = new BoostGPT({
project_id: 'your-project-id',
key: 'your-api-key'
});
// Use async/await or promises
(async () => {
const botResponse = await client.createBot({
name: 'My Bot',
model: 'gpt-4o-min',
instruction: 'You are a helpful assistant'
});
console.log(botResponse.response);
})();const client = new BoostGPT({
project_id: 'your-project-id', // Required
key: 'your-api-key' // Required
});await client.createBot({
name: 'Bot Name',
model: 'gpt-4o-min',
instruction: 'System instruction',
max_reply_tokens: 1000,
status: 1
});await client.fetchBot(bot_id);await client.fetchBots({
page: 1,
per_page: 10
});await client.updateBot({
bot_id: 'bot-id',
name: 'Updated Name',
model: 'gpt-5.1',
instruction: 'Updated instruction',
max_reply_tokens: 1500,
status: "0" // 1 = online, 0 = offline
});await client.resetBot(bot_id);await client.deleteBot(bot_id);await client.chat({
bot_id: 'bot-id',
model: 'gpt-4o-min', //Optional
provider_key: 'optional-provider-key', //Optional
provider_host: 'optionl-provider-host', // Only needed and required when using ollama models
instruction: 'Optional override instruction',
reasoning_mode: 'optional-reasoning-mode', //Default to standard
source_ids: ['source1', 'source2'], //Optional
message: 'Your message here',
max_reply_tokens: 1000, //Optional
chat_id: 'optional-chat-id',
stream: false, //Optional
memory: false // Optional: Disables the agents memory
});await client.search({
bot_id: 'bot-id',
source_ids: ['source1', 'source2'],
keywords: 'search terms'
});await client.fetchChat({
bot_id: 'bot-id',
chat_id: 'chat-id',
page: 1,
per_page: 10
});await client.fetchChats({
bot_id: 'bot-id',
page: 1,
per_page: 10
});await client.deleteChat({
chat_id: 'chat-id',
bot_id: 'bot-id'
});await client.executeTool({
bot_id: 'bot-id',
chat_id: 'chat-id',
tool_calls: [
{
tool_name: 'calculator',
parameters: { operation: 'add', a: 5, b: 3 }
}
]
});await client.voteMessage({
bot_id: 'bot-id',
message_id: 'message-id',
voter_id: 'user-id',
voter_type: 'member',
vote_type: 'upvote' // or 'downvote'
});await client.fetchVoteStatus({
bot_id: 'bot-id',
message_id: 'message-id',
voter_id: 'user-id',
voter_type: 'member'
});await client.deleteMessage({
bot_id: 'bot-id',
chat_id: 'chat-id',
message_id: 'message-id'
});await client.startTraining({
bot_id: 'bot-id',
type: 'text',
source: 'Training content here'
});await client.fetchTraining({
source_id: 'source-id',
bot_id: 'bot-id'
});await client.fetchTrainings({
bot_id: 'bot-id',
page: 1,
per_page: 10
});await client.updateTraining({
source_id: 'source-id',
bot_id: 'bot-id',
type: 'text',
source: 'Updated content'
});await client.deleteTraining({
source_id: 'source-id',
bot_id: 'bot-id'
});await client.fetchTools({
bot_id: 'bot-id',
page: 1,
per_page: 10,
filter: { type: 'mcp' } // Optional filter
});await client.createTool({
bot_id: 'bot-id',
name: 'My Tool',
description: 'Tool description',
config: {
url: 'https://api.example.com',
auth: 'bearer_token'
},
type: 'mcp'
});await client.fetchTool({
tool_id: 'tool-id',
bot_id: 'bot-id'
});await client.updateTool({
tool_id: 'tool-id',
bot_id: 'bot-id',
name: 'Updated Tool Name',
description: 'Updated description',
config: { /* updated config */ },
type: 'mcp'
});await client.deleteTool({
tool_id: 'tool-id',
bot_id: 'bot-id'
});await client.configureTools({
tool_id: 'tool-id',
bot_id: 'bot-id',
settings: {
enabled: true,
timeout: 30000
}
});await client.refreshTools({
tool_id: 'tool-id',
bot_id: 'bot-id'
});await client.toggleTool({
tool_id: 'tool-id',
bot_id: 'bot-id',
tool_name: 'specific-tool',
active: true
});await client.testToolConnection({
tool_id: 'tool-id',
bot_id: 'bot-id'
});await client.fetchSubscribers({
page: 1,
per_page: 10
});await client.fetchVoteStats({
bot_id: 'bot-id'
});await client.fetchSummaryStats({
bot_id: 'bot-id'
});await client.fetchDashboardStats({
bot_id: 'bot-id'
});await client.fetchToolUsageStats({
bot_id: 'bot-id'
});await client.fetchWorkflowStats({
bot_id: 'bot-id'
});await client.fetchPerformanceMetrics({
bot_id: 'bot-id'
});await client.fetchBehaviorStats({
bot_id: 'bot-id'
});await client.fetchErrorAnalysis({
bot_id: 'bot-id'
});await client.fetchReasoningSummary({
bot_id: 'bot-id'
});All methods return a BoostGPTResponse object:
{
err: null | Error, // Error object if request failed
response: null | Object // Response data if request succeeded
}Example error handling:
const result = await client.createBot({ name: 'My Bot' });
if (result.err) {
console.error('Request failed:', result.err.message);
} else {
console.log('Success:', result.response);
}# Install dependencies
npm install
# Build CommonJS files from ESM source
npm run buildThe build process converts the ES Module source files in src/ to CommonJS in dist/.
src/- ES Module source code (edit these files)dist/- Generated CommonJS build (don't edit, auto-generated)build.js- Build script that transpiles ESM to CJSpackage.json- Configured with"type": "module"and dual exports
- Edit files in
src/(ESM format) - Run
npm run buildto generate CJS indist/ - Test both ESM and CJS usage
- The
prepublishOnlyscript automatically builds before publishing
While this package is written in JavaScript, it works with TypeScript. Type definitions may be added in a future release.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes in
src/ - Run
npm run build - Test both ESM and CJS usage
- Submit a Pull Request
MIT
For support, please visit the GitHub Issues page.