llmcord Documentation

repository·main·Indexed 21 days ago

https://github.com/jakobdylanc/llmcord

llmcord is a collaborative LLM frontend for Discord that enables interaction with remote or local LLMs using reply-based conversation chains stored directly in Discord. It supports any OpenAI /v1/chat/completions compatible API and allows for conversation branching, threading, and model switching via the /model command. The bot can be installed locally via Python or deployed using Docker Compose.

Tokens
1.1K
Snippets
2
Records
6
Agent score
24%

What's inside llmcord

  1. How reply-based conversations work

    main

    llmcord uses Discord's own message structure to manage conversation history, meaning no external database is required.

    Conversation Mechanics

    • Starting a conversation: @ the bot in a channel or send it a DM.
    • Continuing a conversation: Reply to a previous message in the chain and @ the bot.
    • Branching: You can branch conversations endlessly by replying to different messages in the chain.
    • Threads: You can use Discord threads; simply create a thread from a message and @ the bot inside it.
    • DM Mode: In DMs, conversations continue automatically without needing to @ the bot, though @ing the bot will start a fresh conversation.
    • Message Chaining: Back-to-back messages from the same user are automatically grouped. Replying to the latest message includes the previous ones in the context.
  2. Install and run llmcord

    main

    To get started with llmcord, clone the repository, configure your settings, and run the bot using either a local Python environment or Docker.

    Local Installation

    1. Clone the repository:
      git clone https://github.com/jakobdylanc/llmcord
      cd llmcord
    2. Install dependencies and run:
      python -m pip install -U -r requirements.txt
      python llmcord.py

    Docker Installation

    Run the bot using Docker Compose:

    docker compose up
    git clone https://github.com/jakobdylanc/llmcord
    cd llmcord
    python -m pip install -U -r requirements.txt
    python llmcord.py
  3. Configure LLM settings in config.yaml

    main

    LLM settings define which providers and models the bot can access. llmcord supports any OpenAI /v1/chat/completions compatible API.

    SettingDescription
    providersA list of providers. Each requires a base_url and optional api_key. Supports extra_headers, extra_query, or extra_body for specific requirements (e.g., Azure OpenAI).
    modelsModels defined in <provider>/<model>: <parameters> format. The first model in the list is the default. Append :vision to model names to enable image support.
    system_promptCustomizes bot behavior. Supports {date} and {time} tags for current timestamp insertion.
  4. Configure Discord settings in config.yaml

    main

    The config.yaml file controls how the bot interacts with Discord. You can override any setting using an environment variable by appending _env to the setting name (e.g., bot_token_env: DISCORD_BOT_TOKEN).

    SettingDescription
    bot_tokenYour Discord bot token. Ensure "MESSAGE CONTENT INTENT" is enabled in the Discord Developer Portal.
    client_idFound under the "OAuth2" tab of your Discord application.
    status_messageCustom message for the bot's profile (max 128 chars).
    max_textMax text allowed in a single message (including file attachments). Default: 100,000.
    max_imagesMax image attachments per message (vision models only). Default: 5.
    max_messagesMax messages in a reply chain before oldest are dropped. Default: 25.
    use_plain_responsesIf true, uses plaintext instead of embeds. Disables streaming and warnings. Default: false.
    allow_dmsSet to false to disable direct messages. Default: true.
    permissionsControls access via users, roles, and channels. Each can have allowed_ids and blocked_ids. Use admin_ids to grant admin privileges (can use /model and DM the bot).
  5. Deploy llmcord using Docker Compose

    main

    You can deploy llmcord using Docker Compose. The service is configured to use host network mode and mounts the current directory to /app within the container as a read-only volume. It also supports loading environment variables from a .env file located in the same directory.

    services:
      container:
        build: .
        network_mode: host
        restart: unless-stopped
        env_file:
          - path: .env
            required: false
        volumes:
          - ./:/app:ro
  6. Switch models using the /model command

    main
    Users can switch the active LLM model using the /model slash command. The available models are populated from the models list defined in your config.yaml in the format <provider>/<model>. This command provides autocomplete suggestions based on your configuration.