Talk to ChatGPT via any Matrix client!
Go to file
2023-01-28 00:20:05 +00:00
.github Update github actions to use cache and latest tag 2023-01-08 17:03:39 +00:00
img Add example screenshot 2022-12-09 21:09:14 +11:00
src Add support for refreshing ChatGPT sessions regularly 2023-01-27 18:49:36 +00:00
.env.example Update README 2023-01-27 21:01:40 +00:00
.gitignore Initial commit 2022-12-09 20:41:17 +11:00
.nvmrc Update and simplify Docker 2023-01-08 16:24:49 +00:00
Dockerfile Update Dockerfile 2023-01-19 17:43:55 +00:00
LICENSE Initial commit 2022-12-09 20:41:17 +11:00
package-lock.json Bump chatgpt from 3.3.13 to 3.5.1 2023-01-23 16:18:41 +00:00
package.json Bump version 2023-01-27 18:05:24 +00:00
README.md Update README.md 2023-01-27 21:09:37 +00:00
tsconfig.json Initial commit 2022-12-09 20:41:17 +11:00

Matrix ChatGPT Bot

Talk to ChatGPT via your favourite Matrix client!

Screenshot of Element iOS app showing conversation with bot

A Matrix bot that uses transitive-bullshit/chatgpt-api to access the unofficial ChatGPT API.

Usage

  1. Create a room
  2. Add the bot
  3. Start chatting away!

Features

  • Shows typing indicator as ChatGPT is thinking!
  • Supports encryption
  • Stores context for ChatGPT conversations

Configure

cp .env.example .env

You must adjust the settings in the .env file according to your needs.

Matrix

You need a Matrix account on Matrix.org (or any other server).

The bot outputs MATRIX_ACCESS_TOKEN to the console if it is not already set but MATRIX_BOT_USERNAME & MATRIX_BOT_PASSWORD are.

You must set MATRIX_ACCESS_TOKEN to use this token. Do not use it with any other client.

You no longer need MATRIX_BOT_PASSWORD set but you can leave it if you want.

OpenAI / ChatGPT

You must read the authentication instructions for chatgpt-api if you get stuck.

Using the same account at chat.openai.com may refresh tokens invalidating the bot's session.

Ensure your OpenAI account uses Google and set OPENAI_LOGIN_TYPE to google.

If the Google account uses 2FA it will fail but there is a workaround

Run

with Docker

This is the recommended way to run this project.

docker build . -t matrix-chatgpt-bot
docker run -it -v storage:/storage --env-file=./.env --name matrix-chatgpt-bot matrix-chatgpt-bot

Note: Without -it flags in the command above you won't be able to stop the container using Ctrl-C

without Docker

It is strongly recommended you run this package under Docker.

  • yarn
  • yarn build
  • yarn start

in Development

You only need to do this if you want to contribute code to this package.

  • Run yarn
  • Run yarn build

Discussion

Join #matrix-chatgpt-bot:matrix.org with any Matrix chat client or on the web!

If you've never set up a Matrix client before you can follow the prompts to get started.

License

GNU AGPLv3. See LICENSE