# Zero6992/chatGPT-discord-bot: a self-hosted Discord bot for OpenAI, Claude, Gemini, Grok, DeepSeek and local models

> The project is a Python bot you host yourself, with per-user conversation history and administrator-controlled backends. It is strongest when you want one bot for several providers, and weakest when you want voice or agent features.

**Zero6992/chatGPT-discord-bot** — Integrate ChatGPT into your own discord bot

- Repository: https://github.com/Zero6992/chatGPT-discord-bot
- Stars: 2,735 · Forks: 693
- Language: Python
- License: GPL-2.0
- Published: 2026-09-14 · Updated: 2026-09-14 · Language: en
- Canonical page: https://hysenlabs.com/projects/zero6992-chatgpt-discord-bot

## What Zero6992/chatGPT-discord-bot actually replaces

Most Discord AI bots are hosted services. You invite them, they answer, and the operator decides which model you get and what happens to your messages. This project inverts that: you run the process, you hold the API keys, and the conversation database lives on your disk. The README frames it as "Bring your favorite AI models into Discord," and the practical consequence is that a single bot can front OpenAI, Anthropic, Google Gemini, xAI Grok, DeepSeek, a local server, or a CLI account login, with the administrator choosing which of those users may reach.

The audience is narrower than the topic list suggests. It suits a community or team that already has a Discord server and wants a private assistant inside it, plus someone comfortable running Python 3.12 through 3.14 on Linux, WSL or macOS. Windows users are told to use WSL. If nobody on the team wants to own a systemd unit or a Docker Compose file, a hosted bot will be less work.

## How the bot routes a message to a model

The architecture is a single Python process with three configuration surfaces. Credentials live in .env. Model aliases, access rules and backend settings live in config.toml, and the Docker Compose file points the container at that file through BOT_CONFIG. The bot connects to Discord with discord.py 2.7.1 and stores conversation state in SQLite through aiosqlite, which is why conversations survive a restart.

Routing is by alias. Each alias declares its capabilities, and the README is explicit that chat, search and media use separate aliases, and that unsupported settings fail explicitly rather than falling back. That last point matters more than it sounds: the README states that "Provider failures never silently select another model or billing mode." If your OpenAI key is out of credit, you get an error, not a surprise charge on a different account. Model IDs and aliases are edited in TOML, so adding a model does not require touching Python. Configuration changes require restarting the bot.

Conversation scope is per user, per server, per channel and per thread, with private and public conversations kept separate. Replies start private; /public makes future slash replies visible in the channel and /private returns to the private thread. The trade-off is that the bot is a router, not an agent framework: text chat accepts text only, and the README lists vision, audio, streaming and general agent tools as not exposed.

## Installing it and getting a first reply

You need a Discord bot token from the Developer Portal plus either an API key or a running local model server. In the portal, enable Guild Install and the bot and applications.commands scopes, and grant View Channels, Send Messages, Embed Links and Attach Files. Add Send Messages in Threads if you plan to use threads. Slash commands work without the Message Content Intent; that intent is only needed for automatic channel replies.

The install sequence clones the repository, creates a virtual environment, installs the pinned dependency set, and copies the two example config files:

```bash
git clone https://github.com/Zero6992/chatGPT-discord-bot.git
cd chatGPT-discord-bot
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
cp .env.example .env
cp config.example.toml config.toml
```

For an OpenAI start, the README says to put the Discord token and the OpenAI key in .env:

```dotenv
DISCORD_BOT_TOKEN=your_discord_bot_token
OPENAI_API_KEY=your_openai_api_key
```

Then edit the existing [bot] section of config.toml. Leaving allowed_user_ids empty means everyone in the server can chat, which the README calls the default in every mode:

```toml
[bot]
default_model = "openai"
allowed_user_ids = [] # Everyone can chat; this is the default in every mode.
```

Run python main.py and the bot connects and synchronizes its slash commands. A first exchange looks like this: /chat message:Hello! Help me plan a small Python project, then /models to see what is configured, then /provider model:claude to switch, /chat again to continue in the new backend, and /reset to clear history. Only select backends whose credentials or local service you have actually configured.

For a local model, keep default_model = "local" and point the base URL at your server. The README gives Ollama at http://127.0.0.1:11434/v1, LM Studio at http://127.0.0.1:1234/v1 and vLLM at http://127.0.0.1:8000/v1. The local example uses auth = "none" and needs only the Discord token. Remote endpoints require HTTPS.

## The capability gaps the README admits to

This is where the project is honest and where it will disappoint some people. Text chat accepts text only. Vision, audio, streaming and general agent tools are not exposed. If you were looking for a bot that listens in a voice channel, this is not it. If you want token-by-token streaming in Discord, this is not it either. Long replies arrive as a text attachment instead, which preserves formatting but is a different reading experience.

Live verification is uneven. The README states that adapters have offline contract coverage, with live checks for OpenAI, Anthropic and xAI chat, native CLI account text, and xAI video. Other paths have outstanding live verification or provider errors. That is an unusually candid note, and it should shape your rollout: enable one backend, exercise it, then add the next. The project also carries a marker for tests that are explicitly opted in and may incur provider charges, which tells you the maintainers think about cost.

CLI backends carry additional requirements and are documented separately, and the CLI owner_id controls account login, status, logout and cancellation. If you are not prepared to read docs/cli.md, skip those backends entirely.

## Docker, and why the Compose file is stricter than most

The Dockerfile builds on python:3.12-slim, creates a non-root user with UID 1001, installs requirements.txt, copies the source, and installs the package with --no-deps before dropping to USER 1001:1001. The Compose file goes further than the usual bot deployment. It mounts config.toml read-only, mounts ./data for the SQLite database, sets read_only: true on the container filesystem, adds a 64 MB tmpfs at /tmp with noexec and nosuid, drops all capabilities, and sets no-new-privileges.

The practical consequence is that anything the bot needs to write must go under /app/data, because the rest of the filesystem cannot be written. That is a reasonable default for a process holding API keys, but it is a constraint you should know before you debug a permission error at 2 a.m. Logging is capped at three 10 MB files, so long-running servers will not fill the disk with logs. If you run without Docker, none of these restrictions apply and the bot writes wherever the process user can write.

## Compared with writing your own discord.py bot

The obvious alternative is a few hundred lines of your own discord.py code calling the OpenAI SDK. That gives you exact control over commands, storage and error handling, and no dependency on someone else's config schema. It also means you build per-user history, model switching, access control, a persistence layer and an image pipeline yourself. This project already has those, plus adapters for six credential types and a TOML schema where new model aliases need no Python changes.

The second alternative is a hosted bot you simply invite. That is less work and no server, but you do not choose the model, you cannot point it at a local endpoint, and the operator sees the traffic. The third is a general agent framework wired to Discord. Those expose tools and streaming that this project deliberately does not. If your requirement is an assistant that answers in text and remembers context per user, the narrower scope here is a feature. If your requirement is an agent that runs code, it is a wall.

## Maintenance, licence and upgrade cost

The repository is not archived, and the last push was on 2026-09-12, days before this writing. Version 4.0.0 was released on 2026-09-08, after 3.0.0 in July 2025 and 2.1.2 in May 2024. The jump from 3.x to 4.0.0 is the kind that usually carries breaking changes, and the README points to docs/migration.md for upgrades, telling existing installations to follow the migration guide before replacing configuration or dependencies. Read that file before you pull.

Dependencies are pinned exactly, including discord.py 2.7.1, httpx 0.28.1 and aiosqlite 0.22.1, and requirements.txt is generated by uv pip compile from pyproject.toml. Pinning makes upgrades predictable but means security updates arrive when the maintainer regenerates the file, not when a CVE lands. The dev extra includes pip-audit, so you can check the tree yourself.

The licence is GPL-2.0-only. If you run the bot for your own server, the practical effect is minimal. If you modify it and distribute the result, or offer a modified version to others, the copyleft obligations attach. This is a description of the licence, not legal advice; if you plan to build a commercial service on a fork, talk to a lawyer.

## Conclusion

Adopt it if you run your own server, want one bot that can switch between official APIs and a local Ollama or vLLM endpoint, and are willing to manage a .env and config.toml yourself. Do not adopt it if you need voice channels, streaming replies or agent tool use, because the README states those are not exposed. Before enabling any backend, verify two things: that the alias you intend to use is listed under [models] in config.toml with the capabilities you expect, and that the provider path you picked has live verification, since the README notes only OpenAI, Anthropic, xAI chat, native CLI account text and xAI video have live checks.

## FAQ

### What is the ChatGPT bot on Discord from Zero6992/chatGPT-discord-bot?

It is a self-hosted Python bot that connects Discord to OpenAI and other providers, including Claude, Gemini, Grok, DeepSeek and local model servers. You run the process yourself and hold the credentials, and each user gets separate history in each server, channel and thread.

### How do I make a ChatGPT Discord bot with Zero6992/chatGPT-discord-bot?

Create an application in the Discord Developer Portal, enable Guild Install with the bot and applications.commands scopes, then clone the repository, install requirements.txt, copy .env.example to .env and config.example.toml to config.toml, set DISCORD_BOT_TOKEN and your provider key, and run python main.py. The README recommends Python 3.12 through 3.14 and WSL on Windows.

### Is there a ChatGPT Discord bot I can run myself?

Yes. This project is designed to be hosted by the administrator, with credentials in .env and model aliases and access rules in config.toml, and it can also point at a local server such as Ollama, LM Studio or vLLM. A Dockerfile and docker-compose.yml are included for container deployment.

### How do I use the ChatGPT chat bot in Discord once it is running?

Use /chat message to send a message in your current conversation, /models to list configured models and capabilities, /provider to show or switch the backend, and /reset to clear history. Replies start private, and /public makes future slash replies visible in the channel.

## Sources

- [Issues](https://github.com/Zero6992/chatGPT-discord-bot/issues)
- [License: GPL-2.0](https://github.com/Zero6992/chatGPT-discord-bot/blob/main/LICENSE)
- [README](https://github.com/Zero6992/chatGPT-discord-bot/blob/main/README.md)
- [Releases](https://github.com/Zero6992/chatGPT-discord-bot/releases)
- [Zero6992/chatGPT-discord-bot on GitHub](https://github.com/Zero6992/chatGPT-discord-bot)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/zero6992-chatgpt-discord-bot
