Requirements
Node.js Version 12.20.0 or higher
Package Manager npm, yarn, or pnpm
Installation
Setup
1. Get Your Credentials
Create project
Create a new project from your dashboard
Get credentials
Copy your Project ID and API Key from settings
Create a .env file:
BOOSTGPT_API_KEY = your_api_key_here
BOOSTGPT_PROJECT_ID = your_project_id_here
Install dotenv:
3. Initialize the Client
import 'dotenv/config' ;
import { BoostGPT } from 'boostgpt' ;
const client = new BoostGPT ({
key: process . env . BOOSTGPT_API_KEY ,
project_id: process . env . BOOSTGPT_PROJECT_ID
});
require ( 'dotenv' ). config ();
const { BoostGPT } = require ( 'boostgpt' );
const client = new BoostGPT ({
key: process . env . BOOSTGPT_API_KEY ,
project_id: process . env . BOOSTGPT_PROJECT_ID
});
Quick Start Example
Create a bot and have a conversation:
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 a bot
const botResult = await client . createBot ({
name: 'My Assistant' ,
model: 'gpt-5-mini' ,
instruction: 'You are a helpful assistant. Be concise and friendly.' ,
max_reply_tokens: 1000 ,
status: 'active'
});
if ( botResult . err ) {
console . error ( 'Error creating bot:' , botResult . err );
process . exit ( 1 );
}
const botId = botResult . response . id ;
console . log ( 'Bot created with ID:' , botId );
// Chat with the bot
const chatResult = await client . chat ({
bot_id: botId ,
message: 'Hello! How are you?' ,
chat_id: 'user-123'
});
if ( chatResult . err ) {
console . error ( 'Error:' , chatResult . err );
} else {
console . log ( 'Bot:' , chatResult . response );
}
Run the script and you should see your bot respond!
All SDK methods return a consistent response format:
{
err : null | Error , // Error object if request failed
response : null | Object // Response data if successful
}
Always check for errors:
const result = await client . createBot ({ name: 'My Bot' });
if ( result . err ) {
console . error ( 'Failed:' , result . err . message );
// Handle error
} else {
console . log ( 'Success:' , result . response );
// Use response data
}
Configuration Options
Constructor Options
new BoostGPT ({
key: string , // Required: Your API key
project_id: string // Required: Your project ID
})
Module System
The Core SDK supports both ES Modules and CommonJS:
Requirements:
Node.js 14.0.0+
Add "type": "module" to package.json OR use .mjs extension
import { BoostGPT } from 'boostgpt' ;
Requirements:
Node.js 12.20.0+
Use .js extension (default)
const { BoostGPT } = require ( 'boostgpt' );
TypeScript Support
While the SDK is written in JavaScript, it works with TypeScript projects. Type definitions may be added in a future release.
For now, you can create your own type definitions:
// types/boostgpt.d.ts
declare module 'boostgpt' {
export class BoostGPT {
constructor ( config : { key : string ; project_id : string });
createBot ( params : any ) : Promise < any >;
chat ( params : any ) : Promise < any >;
// Add other methods as needed
}
}
Troubleshooting
Cannot find module 'boostgpt'
Make sure you’ve installed the package:
Verify you’re using the correct Project ID for your API key.
SyntaxError: Cannot use import statement
You’re trying to use ES modules in a CommonJS environment. Either:
Add "type": "module" to your package.json
Use .mjs file extension
Switch to require() syntax
Next Steps