← Back to Skills Marketplace
dq-stack

LM Studio Discord Bot

by dan · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
128
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install lm-studio-discord
Description
Connect a local LM Studio model directly to Discord as a lightweight chat bot. Use when you want to expose a local LLM (running via LM Studio on CPU) to Disc...
README (SKILL.md)

LM Studio Discord Bot

A minimal Discord bot that routes messages directly to LM Studio — no OpenClaw gateway in the path.

When to Use

  • LM Studio model is fast in direct chat but slow through OpenClaw
  • CPU-only setup where OpenClaw's tool system adds too much latency
  • You want a simple Discord bot without the full OpenClaw feature set

How It Works

Discord → bot.js → LM Studio API → bot.js → Discord

The bot uses Discord.js to receive messages and axios to call LM Studio's /v1/chat/completions endpoint directly. No tools, no workspace files, no system prompt overhead.

Setup

1. Create the bot project

mkdir lm-studio-discord-bot
cd lm-studio-discord-bot
npm init -y
npm install discord.js axios

2. Create bot.js

See scripts/bot-template.js for the ready-to-use template.

3. Configure

Edit these constants in bot.js:

const DISCORD_TOKEN = 'YOUR_DISCORD_BOT_TOKEN';
const LM_STUDIO_URL = 'http://127.0.0.1:1234/v1/chat/completions';
const MODEL = 'qwen2-0.5b-instruct';  // Must match loaded model in LM Studio
const GUILD_ID = 'YOUR_DISCORD_SERVER_ID';

To get your bot token: https://discord.com/developers/applications

To get the Guild ID: Enable Developer Mode in Discord → Right-click your server → Copy ID

4. Add bot to your server

https://discord.com/oauth2/authorize?client_id=BOT_CLIENT_ID&permissions=1024&scope=bot

Replace BOT_CLIENT_ID with your bot's Application ID from the Discord Developer Portal.

5. Run

node bot.js

The bot will log in and respond to messages in any channel of the configured guild.

Configuration Tips

Parameter Default Notes
max_tokens 512 Lower = faster, less verbose
timeout 60000ms Increase if slow on CPU
stream false Set true for streaming replies

Known Limitations

  • No tool access (file read/write, web search, etc.)
  • No conversation memory — each message is stateless
  • No slash commands
  • Single model per bot instance

Extending

To add conversation history, modify the messages array in the axios call to include prior exchanges. Note: this increases token usage and context window pressure.

Usage Guidance
This skill appears to do what it says, but follow secure practices before running: (1) do not paste your real Discord token into files that may be committed — prefer environment variables or a secrets store; (2) only run LM Studio on localhost or otherwise secure the service if binding to a network interface; (3) give the bot the minimum Discord permissions it needs and consider adding rate-limiting or command filters so it doesn't reply to every message; (4) be aware the template replies with raw error messages to users (could leak internal info) — sanitize or log errors privately; and (5) review and test locally before deploying to any public-facing machine.
Capability Analysis
Type: OpenClaw Skill Name: lm-studio-discord Version: 1.0.0 The skill provides a legitimate template and instructions for creating a Discord bot that interfaces with a local LM Studio instance. The code in scripts/bot-template.js is a standard implementation using discord.js and axios, performing only the stated functions without any evidence of data exfiltration, malicious execution, or obfuscation.
Capability Assessment
Purpose & Capability
Name/description, SKILL.md, and the included bot-template.js consistently implement a Discord bot that sends messages to LM Studio's local /v1/chat/completions endpoint. Required packages (discord.js, axios) and the localhost LM Studio URL align with the stated purpose.
Instruction Scope
Instructions are narrowly scoped to creating an npm project, installing discord.js and axios, editing the provided bot.js template, and running it. One operational note: the template expects you to edit hardcoded constants in the file (DISCORD_TOKEN, LM_STUDIO_URL, MODEL, GUILD_ID) rather than using environment variables, which is functional but increases risk of accidentally committing secrets or exposing tokens.
Install Mechanism
No install spec; skill is instruction-only and includes a local JS template. The only install commands the README suggests are 'npm install discord.js axios' from public registries — a low-risk, expected approach.
Credentials
The skill does not request additional credentials or environment variables beyond what is necessary for a Discord bot and LM Studio (a bot token and local LM Studio URL). There are no unexpected credential requests or config-path accesses. The template uses in-file constants rather than env vars; this is not disproportionate but is a security hygiene concern (see guidance).
Persistence & Privilege
The skill does not request always:true or any elevated/persistent platform privileges and does not modify other skills or system-wide settings. It runs as a normal user process when started.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install lm-studio-discord
  3. After installation, invoke the skill by name or use /lm-studio-discord
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
LM Studio Discord Bot v1.0.0 - Initial release: Connect a local LM Studio language model directly to Discord as a simple chat bot. - Bypasses OpenClaw gateway, reducing latency for CPU-only setups. - Minimal setup: just configure Discord token, LM Studio endpoint, model name, and guild ID. - No tool access, conversation memory, or advanced Discord features—focused on speed and simplicity. - Ready-to-use bot.js template provided for quick deployment.
Metadata
Slug lm-studio-discord
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is LM Studio Discord Bot?

Connect a local LM Studio model directly to Discord as a lightweight chat bot. Use when you want to expose a local LLM (running via LM Studio on CPU) to Disc... It is an AI Agent Skill for Claude Code / OpenClaw, with 128 downloads so far.

How do I install LM Studio Discord Bot?

Run "/install lm-studio-discord" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is LM Studio Discord Bot free?

Yes, LM Studio Discord Bot is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does LM Studio Discord Bot support?

LM Studio Discord Bot is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created LM Studio Discord Bot?

It is built and maintained by dan (@dq-stack); the current version is v1.0.0.

💬 Comments