Skip to main content

Requirements

Node.js

Version 12.20.0 or higher

Package Manager

npm, yarn, or pnpm

API Key

Installation

npm install boostgpt

Setup

1. Get Your Credentials

1

Create account

Sign up at app.boostgpt.co
2

Create project

Create a new project from your dashboard
3

Get credentials

Copy your Project ID and API Key from settings

2. Configure Environment Variables

Create a .env file:
.env
BOOSTGPT_API_KEY=your_api_key_here
BOOSTGPT_PROJECT_ID=your_project_id_here
Install dotenv:
npm 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
});

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!

Response Format

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';

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

Make sure you’ve installed the package:
npm install boostgpt
Check that your API key is correct and hasn’t been revoked. You can verify it at app.boostgpt.co/account/api-keys.
Verify you’re using the correct Project ID for your API key.
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