Skip to content

GPT-Shell is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT. Also allows creating Dalle2 images.


Notifications You must be signed in to change notification settings


Repository files navigation


❗ The new version of GPT-Shell is called Erin! Find out more at Erin's Website!

GPT-Shell is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT.

It allows users to converse with a virtual companion. It uses nodejs and typescript, as well as modern yarn, to create a seamless conversation experience.

It can also generate images based on your conversation!

Try it out

You can try the bot on the official Discord server:


To interact with GPT-Shell, users can:

  • Use the /chat-gpt command to start a conversation with the bot
  • Ping the bot in a channel it's in
  • Message the bot directly

The /chat-gpt command will start a new conversation thread, and whenever the user types something, the bot will respond.

The bot is able to handle multiple conversations at once, so you can start as many conversations as you like.

Bot Setup

Set up a discord bot here and add it to your server.


  • bot
  • application.commands

Bot Permissions:

  • read messages/view channels
  • send messages
  • create public threads
  • create private threads
  • send messages in threads
  • embed links
  • attach files
  • use slash commands

You also need to enable the Message Content Intent:

Expand to see image



  • You can try to fork the replit here

  • Or you can set it up on your machine.


  • Nodejs: (18 or above)

  • Yarn: (after installing nodejs)

  • pm2: To keep your bot alive even after killing your terminal.

To use GPT-Shell, you will need to:

  • Clone the project:
git clone
  • Open the terminal in the project's folder:
cd GPT-Shell

(in windows, right click somewhere in the folder and select "Open In Terminal") if you see something about powershell, type cmd and hit enter, to go to the simpler command line terminal.

  • Install yarn:
yarn install
  • Set up environment variables

Setting up Environment Variables

The following environment variables are required for GPT-Shell to work properly.

You can set the environment variables in any way you like, or place an .env.local file at the root of your project (rename example.env.local to .env.local), Ensure that your .env.local looks like this:

[EXPAND] Click to see .env.local
# MongoDB:

# Bot Token from Discord:

# Commands:

# Discord Server Details:


  • MONGODB_URI: The MongoDB connection string.
    • Should look something like this: mongodb+srv://
  • DB_NAME: The name of the collection in MongoDB. You can use CHAT_DB or anything you like.

Bot Token:


  • COMMAND_NAME: The name of the chat-gpt command
  • PRIVATE_COMMAND_NAME: Command to create private threads.
  • CONFIG_COMMAND_NAME: The name of the config command
  • CUSTOM_PROMPT_COMMAND_NAME: (Optional) The name of the command for custom prompts
  • DRAW_COMMAND_NAME: (Optional) The name of the draw command.

Discord Server Details:

  • MAIN_SERVER_ID: The Discord server where the bot lives

  • LOG_CHANNEL_ID: (Optional) The channel for log messages

  • MAIN_SERVER_INVITE: (Optional) The ideally non-expiring server invite link (if you want users to add the bot to their server)

  • USE_SAME_API_KEY_FOR_ALL: (Optional) When set to 'true', it will allow any server or user to use the bot without needing to provide their own API keys.

  • ADMIN_PING_ID: Bot owner's Discord id (that's you!)

    Used to let you send some special commands and configure the bot.

  • IGNORE_INIT: (Optional) When set to 'true', when it starts, will not check active threads for new messages since the bot was last online. If you're in many servers, there may be many active threads, so that would hit a rate limit. In that case, it's better to handle messages as they come, instead of checking many threads at once.


Start your bot

Set up the environment variables as described above.

  • Install pm2:

With yarn:

yarn global add pm2

With npm:

npm install pm2 -g

With debian, use the install script:

apt update && apt install sudo curl && curl -sL | sudo -E bash -
  • Then to start a development environment, run
yarn dev

This way, whenever you change the code, it will restart the bot to update.

  • To build and start the bot, run
yarn build

and then

yarn start

You can also run npm start or npm run start to start the bot.

NOTE: running yarn start, npm start or npm run start will start the bot with PM2 and give it the name "GPT-Shell". You can replace "GPT-Shell" with a name of your choice in package.json. It will also show logs for the PM2 running processes and save them.

If you are in dev environment, use node . to test your code:

node .

Once you are satisfied with the changes run:

pm2 restart GPT-Shell && pm2 logs

In order to stop the bot, run:

yarn run stop

You can also restart it from the dashboard as shown bellow:

Expand to see image



Go to your server, and type the config command, and set the API key for your server using the config.

Expand to see config image


Long-Term Memory

Starting from 2.0.0, the bot has the capacity to have a long-term memory.

Expand to see how to configure long term memory.

This functionality is experimental, but internal testing shows that it works quite well for typical conversation.

Does not work so well if the conversation has long pieces of code, because of token limitations.

How it works:

  • the bot creates embeddings for every message in the conversation
  • if the conversation is short, all the conversation history is included in the prompt
  • if the conversation is long enough, when a new message is sent, that message's embedding is compared to the conversation history, and only the most relevant messages will be included in the prompt.

To be able to set this up, use the config command on the main server:



Then enter the pinecone configuration details.

You can create an account at

If you did it correctly, you should see something like this:


Custom Prompts

By default, the bot behaves like a helpful software engineer.

If you want the bot to behave differently, you can use a custom prompt.

This can be done in a new channel dedicated to the bot, or a new conversation thread, or in DMs.

You can use the /chat-gpt-prompt command, if you have the permissions, and you can set the custom prompt for the bot by filling the form.

This command can be used in:

  • channels (if you are a server admin)
  • threads (if you are the one who created the thread)
  • DMs

The temperature is the same as OpenAI's temperature parameter. 0 means it becoems repetitive, 1 means it becomes a bit chaotic. Default is 0.8 for GPT-Shell.



We welcome contributions to GPT-Shell. If you have an idea for a new feature or have found a bug, please open an issue on GitHub. We would also appreciate any sponsorships or donations.

You can sponsor us through our GitHub sponsor page here.


GPT-Shell is released under the MIT License.


GPT-Shell is an OpenAI based chat-bot that is similar to OpenAI's ChatGPT. Also allows creating Dalle2 images.








No releases published

Sponsor this project



No packages published