> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Core SDK Installation

> Install and configure the BoostGPT Core SDK

## Requirements

> [card] Node.js
>
> Version 12.20.0 or higher

> [card] Package Manager
>
> npm, yarn, or pnpm

> [card] API Key
>
> From [app.boostgpt.co](https://app.boostgpt.co)

## Installation

> [tab] npm
>
> ```bash theme={null}
> npm install boostgpt
> ```

> [tab] yarn
>
> ```bash theme={null}
> yarn add boostgpt
> ```

> [tab] pnpm
>
> ```bash theme={null}
> pnpm add boostgpt
> ```

## Setup

### 1. Get Your Credentials

**1. Create account**

Sign up at [app.boostgpt.co](https://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:

```bash .env theme={null}
BOOSTGPT_API_KEY=your_api_key_here
BOOSTGPT_PROJECT_ID=your_project_id_here
```

Install dotenv:

```bash theme={null}
npm install dotenv
```

### 3. Initialize the Client

> [tab] ES Modules
>
> ```javascript theme={null}
> import 'dotenv/config';
> import { BoostGPT } from 'boostgpt';
>
> const client = new BoostGPT({
>   key: process.env.BOOSTGPT_API_KEY,
>   project_id: process.env.BOOSTGPT_PROJECT_ID
> });
> ```

> [tab] CommonJS
>
> ```javascript theme={null}
> 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:

```javascript theme={null}
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-6-luna',
  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);
}
```

> [!TIP]
>
> Run the script and you should see your bot respond!

## Response Format

All SDK methods return a consistent response format:

```javascript theme={null}
{
  err: null | Error,        // Error object if request failed
  response: null | Object   // Response data if successful
}
```

Always check for errors:

```javascript theme={null}
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

```javascript theme={null}
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:

> [tab] ES Modules
>
> **Requirements:**
>
> * Node.js 14.0.0+
> * Add `"type": "module"` to `package.json` OR use `.mjs` extension
>
> ```javascript theme={null}
> import { BoostGPT } from 'boostgpt';
> ```

> [tab] CommonJS
>
> **Requirements:**
>
> * Node.js 12.20.0+
> * Use `.js` extension (default)
>
> ```javascript theme={null}
> 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:

```typescript theme={null}
// 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

> [accordion] Cannot find module 'boostgpt'
>
> Make sure you've installed the package:
>
> ```bash theme={null}
> npm install boostgpt
> ```

> [accordion] 401 Unauthorized
>
> Check that your API key is correct and hasn't been revoked. You can verify it at [app.boostgpt.co/account/api-keys](https://app.boostgpt.co/account/api-keys).

> [accordion] 403 Forbidden
>
> Verify you're using the correct Project ID for your API key.

> [accordion] 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

> [card] [API Reference](/docs/sdk/core/api-reference.md)
>
> Explore all available methods

> [card] [Router SDK](/docs/sdk/router/installation.md)
>
> Deploy bots to multiple channels

> [card] [Examples](/docs/examples/use-cases.md)
>
> See real-world implementations

> [card] [Troubleshooting](/docs/developers/troubleshooting.md)
>
> Common issues and solutions


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.