llmcord

jakobdylancMIT活跃维护

把 Discord 变成大模型聊天前端,接入 OpenAI、Gemini、Ollama 等多种 LLM,在服务器频道里直接对话。

Make Discord your LLM frontend

暂无版本838star206fork同步于 2026-11-07 07:28 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/jakobdylanc/llmcord && cd llmcord
python -m pip install -U -r requirements.txt
python llmcord.py
硬件要求按 README 说明

README 未说明;本地模型需自行用 LM Studio、Ollama 或 vLLM 部署,硬件要求取决于所选模型

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 Discord 变成多人协作的 LLM 前端,靠回复链管理对话历史,无需数据库

把 Discord 变成大模型聊天前端,接入 OpenAI、Gemini、Ollama 等多种 LLM,在服务器频道里直接对话。

核心能力

  • 用回复链保存对话历史,可无限分支和接续他人对话
  • 用 /model 命令切换远程或本地模型
  • 支持图片和文本文件附件输入
  • 流式回复,过长时自动拆分成多条消息
  • 热重载 config.yaml,改设置无需重启

容易踩的坑

需在 Discord 开发者后台开启 MESSAGE CONTENT INTENT 并填好 bot_token 和 client_id;只支持 OpenAI /v1/chat/completions 兼容 API,部分视觉模型需在名称后加 :vision;使用 Docker 时需先配置好 config.yaml 再执行 docker compose up

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    llmcord transforms Discord into a collaborative LLM frontend. It works with practically any LLM, remote or locally hosted.

    Features

    Reply-based conversations:

    Just @ the bot to start a conversation and reply to continue. Build conversations with reply chains!

    The reply chain is the conversation history, stored entirely in Discord. No database required.

    You can:

    • Branch conversations endlessly
    • Continue other people's conversations
    • @ the bot while replying to ANY message to include it in the conversation

    Additionally:

    • 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.
    • You can branch conversations into threads. Just create a thread from any message and @ the bot inside to continue.
    • 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.

    Model switching with /model:

    image

    llmcord supports remote models from:

    Or run local models with:

    ...Or use any other OpenAI /v1/chat/completions compatible API server.


    And more:

    • Supports image attachments when using a vision model (like gpt-5, grok-4, claude-4, etc.)
    • Supports text file attachments (.txt, .py, .c, etc.)
    • Customizable personality (aka system prompt)
    • Distinguishes users via their Discord IDs
    • 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, ~300 lines of code

    Instructions

    1. Clone the repo:

      git clone https://github.com/jakobdylanc/llmcord
      cd llmcord
      
    2. Set up config.yaml:

    Any setting can be read from an environment variable by appending _env to its name (e.g. bot_token_env: DISCORD_BOT_TOKEN).

    Discord settings:

    SettingDescription
    bot_tokenCreate a new Discord bot at discord.com/developers/applications and generate a token under the "Bot" tab. Also enable "MESSAGE CONTENT INTENT".
    client_idFound under the "OAuth2" tab of the Discord bot you just made.
    status_messageSet a custom message that displays on the bot's Discord profile.Max 128 characters.
    max_textThe maximum amount of text allowed in a single message, including text from file attachments.Default: 100,000
    max_imagesThe maximum number of image attachments allowed in a single message.Default: 5Only applicable when using a vision model.
    max_messagesThe maximum number of messages allowed in a reply chain. When exceeded, the oldest messages are dropped.Default: 25
    use_plain_responsesWhen set to true the bot will use plaintext responses instead of embeds. Plaintext responses have a shorter character limit so the bot's messages may split more often.Default: falseAlso disables streamed responses and warning messages.
    allow_dmsSet to false to disable direct message access.Default: true
    permissionsConfigure access permissions for users, roles and channels, each with a list of allowed_ids and blocked_ids.Control which users are admins with admin_ids. Admins can change the model with /model and DM the bot even if allow_dms is false.Leave allowed_ids empty to allow ALL in that category.Role and channel permissions do not affect DMs.You can use category IDs to control channel permissions in groups.

    LLM settings:

    SettingDescription
    providersAdd the LLM providers you want to use, each with a base_url and optional api_key entry. Popular providers (openrouter, openai, ollama, etc.) are already included.Only supports OpenAI /v1/chat/completions compatible APIs.Some providers may need extra_headers / extra_query / extra_body entries for extra HTTP data. See the included azure-openai provider for an example.
    modelsAdd the models you want to use in <provider>/<model>: <parameters> format (examples are included). When you run /model these models will show up as autocomplete suggestions.Refer to each provider's documentation for supported parameters.The first model in your models list will be the default model at startup.Some vision models may need :vision added to the end of their name to enable image support.
    system_promptWrite anything you want to customize the bot's behavior!Leave blank for no system prompt.You can use the {date} and {time} tags in your system prompt to insert the current date and time, based on your host computer's time zone.It is recommended to include something like "User messages are prefixed with their Discord ID as <@ID>. Use this format to mention users." in your system prompt to help the bot understand the user message format.
    1. Run the bot:

      No Docker:

      python -m pip install -U -r requirements.txt
      python llmcord.py
      

      With Docker:

      docker compose up
      

    Notes

    • If you're having issues, try my suggestions here

    • PRs are welcome :)