Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakobdylanc/llmcord
A Discord LLM chat bot that supports any OpenAI compatible API (OpenAI, xAI, Mistral, Groq, OpenRouter, Ollama, LM Studio and more)
https://github.com/jakobdylanc/llmcord
bot chatbot chatgpt discord gpt gpt-4 gpt-4o grok groq llama llama3 llava llm lmstudio mistral ollama oobabooga openai xai
Last synced: 4 days ago
JSON representation
A Discord LLM chat bot that supports any OpenAI compatible API (OpenAI, xAI, Mistral, Groq, OpenRouter, Ollama, LM Studio and more)
- Host: GitHub
- URL: https://github.com/jakobdylanc/llmcord
- Owner: jakobdylanc
- License: mit
- Created: 2023-05-08T23:07:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-05T16:26:57.000Z (7 days ago)
- Last Synced: 2024-12-05T17:30:01.211Z (7 days ago)
- Topics: bot, chatbot, chatgpt, discord, gpt, gpt-4, gpt-4o, grok, groq, llama, llama3, llava, llm, lmstudio, mistral, ollama, oobabooga, openai, xai
- Language: Python
- Homepage:
- Size: 174 KB
- Stars: 380
- Watchers: 5
- Forks: 73
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome - jakobdylanc/llmcord - A Discord LLM chat bot that supports any OpenAI compatible API (Ollama, LM Studio, vLLM, OpenRouter, xAI, Mistral, Groq and more) (Python)
README
llmcord
Talk to LLMs with your friends!
llmcord lets you (and your friends) chat with LLMs directly in Discord. It works with practically any LLM, remote or locally hosted.
## Features
### Reply-based chat system
Just @ the bot to start a conversation and reply to continue. Build conversations with reply chains!You can do things like:
- Continue your own conversation or someone else's
- "Rewind" a conversation by simply replying to an older message
- @ the bot while replying to any message in your server to ask a question about itAdditionally:
- Back-to-back messages from the same user are automatically chained together. Just reply to the latest one and the bot will see all of them.
- You can seamlessly move any conversation into a [thread](https://support.discord.com/hc/en-us/articles/4403205878423-Threads-FAQ). Just create a thread from any message and @ the bot inside to continue.
- When DMing the bot, conversations continue automatically (no reply required). To start a fresh conversation, just @ the bot. You can still reply to continue from anywhere.### Choose any LLM
llmcord supports remote models from:
- [OpenAI API](https://platform.openai.com/docs/models)
- [xAI API](https://docs.x.ai/docs#models) (**New!**)
- [Mistral API](https://docs.mistral.ai/platform/endpoints)
- [Groq API](https://console.groq.com/docs/models)
- [OpenRouter API](https://openrouter.ai/docs/models)Or run a local model with:
- [Ollama](https://ollama.com)
- [LM Studio](https://lmstudio.ai)
- [vLLM](https://github.com/vllm-project/vllm)...Or use any other OpenAI compatible API server.
### And more:
- Supports image attachments when using a vision model (like gpt-4o, claude-3, llava, etc.)
- Supports text file attachments (.txt, .py, .c, etc.)
- Customizable personality (aka system prompt)
- User identity aware (OpenAI API and xAI API only)
- Streamed responses (turns green when complete, automatically splits into separate messages when too long)
- Hot reloading config (you can change settings without restarting the bot)
- Displays helpful warnings when appropriate (like "⚠️ Only using last 25 messages" when the customizable message limit is exceeded)
- Caches message data in a size-managed (no memory leaks) and mutex-protected (no race conditions) global dictionary to maximize efficiency and minimize Discord API calls
- Fully asynchronous
- 1 Python file, ~200 lines of code## Instructions
1. Clone the repo:
```bash
git clone https://github.com/jakobdylanc/llmcord
```2. Create a copy of "config-example.yaml" named "config.yaml" and set it up:
### Discord settings:
| Setting | Description |
| --- | --- |
| **bot_token** | Create a new Discord bot at [discord.com/developers/applications](https://discord.com/developers/applications) and generate a token under the "Bot" tab. Also enable "MESSAGE CONTENT INTENT". |
| **client_id** | Found under the "OAuth2" tab of the Discord bot you just made. |
| **status_message** | Set a custom message that displays on the bot's Discord profile. **Max 128 characters.** |
| **allow_dms** | Set to `false` to disable direct message access.
(Default: `true`) |
| **allowed_channel_ids** | A list of Discord channel IDs where the bot can be used. **Leave empty to allow all channels. Does not affect DMs.** |
| **allowed_role_ids** | A list of Discord role IDs that can use the bot. **Leave empty to allow everyone. DMs are force-disabled when at least one role is specified.** |
| **max_text** | The maximum amount of text allowed in a single message, including text from file attachments.
(Default: `100,000`) |
| **max_images** | The maximum number of image attachments allowed in a single message. **Only applicable when using a vision model.**
(Default: `5`) |
| **max_messages** | The maximum number of messages allowed in a reply chain. When exceeded, the oldest messages in the reply chain are dropped.
(Default: `25`) |
| **use_plain_responses** | When set to `true` the bot will use plaintext responses instead of embeds. **Also disables streamed responses and warning messages. Plaintext responses have a shorter character limit so the bot's messages may split more often.**
(Default: `false`) |### LLM settings:
| Setting | Description |
| --- | --- |
| **providers** | Add the LLM providers you want to use, each with a `base_url` and optional `api_key` entry. Popular providers (`openai`, `ollama`, etc.) are already included. **Only supports OpenAI compatible APIs.** |
| **model** | Set to `/`, e.g:
-`openai/gpt-4o`
-`ollama/llama3.3`
-`openrouter/anthropic/claude-3.5-sonnet` |
| **extra_api_parameters** | Extra API parameters for your LLM. Add more entries as needed. **Refer to your provider's documentation for supported API parameters.**
(Default: `max_tokens=4096, temperature=1.0`) |
| **system_prompt** | Write anything you want to customize the bot's behavior! **Leave blank for no system prompt.** |3. Run the bot:
**No Docker:**
```bash
python -m pip install -U -r requirements.txt
python llmcord.py
```**With Docker:**
```bash
docker compose up
```## Notes
- If you're having issues, try my suggestions [here](https://github.com/jakobdylanc/llmcord/issues/19)
- Only models from OpenAI API and xAI API are "user identity aware" because only they support the "name" parameter in the message object. Hopefully more providers support this in the future.
- PRs are welcome :)
## Star History