
lm-studio
by arthurelgindell
Arthur's AI-powered content creation toolkit: video generation, carousel creation, image generation, and automation scripts
SKILL.md
name: lm-studio description: This skill should be used when the user asks to "run local LLMs", "use LM Studio", "configure local AI server", "estimate VRAM requirements", "load a model locally", or needs guidance on OpenAI-compatible local API usage, model quantization selection, GPU offload configuration, MCP server integration, or headless LLM server management. Covers local AI inference, CLI automation, SDK integration, and hardware optimization. version: 1.0.0 license: MIT
LM Studio Local LLM Integration
Comprehensive integration for running AI models locally via LM Studio.
Quick Reference
Server Endpoints:
- Base URL:
http://localhost:1234/v1 - Chat Completions:
POST /v1/chat/completions - Embeddings:
POST /v1/embeddings - List Models:
GET /v1/models - Responses (Stateful):
POST /v1/responses
Default Port: 1234 (configurable via --port)
API Endpoints
LM Studio provides an OpenAI-compatible HTTP server.
| Endpoint | Method | Description |
|---|---|---|
/v1/chat/completions | POST | Generate chat completions (streaming supported) |
/v1/embeddings | POST | Generate vector embeddings for RAG |
/v1/models | GET | List loaded/available models with capability tags |
/v1/completions | POST | Legacy text completion endpoint |
/v1/responses | POST | Stateful interactions with previous_response_id |
Authentication: API key not required but some clients expect non-empty string (use "lm-studio").
CLI Commands Reference
The lms CLI enables headless operation and automation.
Server Management
# Start server with CORS enabled
lms server start --port 1234 --cors
# Stop server
lms server stop
# Check status
lms server status
Model Management
# List downloaded models
lms ls
lms ls --json # JSON output for scripts
# List loaded models
lms ps
lms ps --json
# Download model
lms get deepseek-r1
lms get <huggingface-url>
lms get --mlx <model> # Apple MLX optimized
# Load model with configuration
lms load <model> --ttl 300 --gpu auto --context-length 8192
# Estimate VRAM before loading
lms load --estimate-only <model>
Logging & Monitoring
# Stream server logs
lms log stream --source server
# Stream inference logs with stats
lms log stream --source model --filter input,output --stats --json
Model Configuration Parameters
Inference Parameters
| Parameter | Type | Description | Recommended |
|---|---|---|---|
temperature | float | Randomness (0.0-2.0) | 0.3 (code), 0.6 (reasoning), 0.7 (chat) |
max_tokens | int | Maximum generation length | Task-dependent |
top_p | float | Nucleus sampling threshold | 0.95 |
top_k | int | Top-k sampling | 40 |
ttl | int | Auto-unload after N seconds idle | 300-600 |
Load-Time Configuration
| Parameter | Description |
|---|---|
contextLength | Context window size (tokens) |
gpu.ratio | GPU offload ratio (0.0-1.0) |
flashAttention | Enable Flash Attention (NVIDIA RTX) |
useFp16ForKVCache | Half-precision KV cache |
evalBatchSize | Tokens processed per batch |
VRAM Requirements Guide
Quantization Levels
- Q4_K_M: Best balance for consumer hardware (recommended)
- Q8_0: Higher quality, ~2x VRAM of Q4
- FP16/BF16: Full precision, research/workstation only
Requirements by Model Size
| Model Size | Quantization | VRAM Required | Hardware |
|---|---|---|---|
| 1.5B-3B | Q4_K_M | 3-4 GB | GTX 1650, RTX 3050 |
| 7B-9B | Q4_K_M | 6-8 GB | RTX 3060, 4060 |
| 13B-14B | Q4/Q5 | 9-12 GB | RTX 3060 Ti, 4070 |
| 30B-35B | Q4 | 20-24 GB | RTX 3090, 4090 |
| 70B | Q4 | 40-48 GB+ | RTX 6000, 2x 3090 |
Rule: If model fits entirely in VRAM, runs fastest. Offloading to RAM is up to 30x slower.
Use scripts/check_vram.py to estimate requirements before loading.
Recommended Models by Use Case
Reasoning & Logic
DeepSeek-R1 Distillations:
deepseek-r1-distill-qwen-7b,deepseek-r1-distill-qwen-32b- Temperature: 0.5-0.7
- No system prompt (instructions in user message)
- Math directive: "Please reason step by step, and put your final answer within \boxed{}."
Nemotron 3 Nano:
nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-GGUF- Temperature: 1.0, Top P: 1.0
- Use
/thinkor/no_thinkcontrol tokens
Coding & Agentic Workflows
Qwen3-Coder:
qwen3-coder-30b-a3b-instruct- Temperature: 0.3
- Context: up to 256k tokens
GLM-4.7:
zai-org/GLM-4.7- Excellent for web page generation and multi-step tool use
Vision (Multimodal)
Qwen2.5-VL/Qwen3-VL:
qwen2.5-vl-7b-instruct,qwen3-vl-8b-instruct- Set image resize bounds to 2048px minimum
LFM2.5-VL:
LiquidAI/LFM2.5-VL-1.6B- Optimized for edge devices and laptops
MCP Server Configuration
LM Studio acts as an MCP Host, connecting to external tool servers.
Configuration File: ~/.lmstudio/mcp.json
Remote Server Example
{
"mcpServers": {
"hf-mcp-server": {
"url": "https://huggingface.co/mcp",
"headers": {
"Authorization": "Bearer <YOUR_HF_TOKEN>"
}
}
}
}
Local Server Example
{
"mcpServers": {
"sandbox": {
"command": "sandbox-server-stdio",
"args": []
},
"my-local-server": {
"url": "http://localhost:8000"
}
}
}
Tool Choice Options:
"auto": Model decides whether to call tools"required": Force tool usage"none": Disable tools
Python/OpenAI Client Integration
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:1234/v1",
api_key="lm-studio" # Placeholder required by some clients
)
completion = client.chat.completions.create(
model="qwen2.5-7b-instruct",
messages=[{"role": "user", "content": "Hello!"}],
temperature=0.7,
max_tokens=2048
)
print(completion.choices[0].message.content)
With Streaming
stream = client.chat.completions.create(
model="deepseek-r1-distill-qwen-7b",
messages=[{"role": "user", "content": "Explain quantum computing"}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
TypeScript SDK Usage
import { LMStudioClient } from "@lmstudio/sdk";
const client = new LMStudioClient();
// Load model with configuration
const model = await client.llm.load("qwen2.5-7b-instruct", {
config: {
contextLength: 8192,
gpu: { ratio: 1.0 },
flashAttention: true,
useFp16ForKVCache: true
}
});
// Run inference
const response = await model.respond([
{ role: "user", content: "Write a Python function to sort a list" }
]);
Framework Integration
LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="http://localhost:1234/v1",
api_key="lm-studio",
model="qwen2.5-7b-instruct"
)
AutoGen
config_list = [
{
"model": "qwen2.5-7b-instruct",
"base_url": "http://localhost:1234/v1",
"api_key": "lm-studio"
}
]
assistant = autogen.AssistantAgent(
name="Assistant",
llm_config={"config_list": config_list}
)
System Requirements
macOS (Apple Silicon):
- M1/M2/M3/M4 chip required (Intel not supported)
- macOS 13.4+ (14.0+ for MLX backend)
- 16GB+ unified memory recommended
Windows:
- x64 with AVX2 or ARM64 (Snapdragon X Elite)
- 16GB+ RAM, 4GB+ dedicated VRAM minimum
- NVIDIA RTX preferred (CUDA 12.8), AMD via ROCm
Linux:
- Ubuntu 20.04+ (AppImage)
- x64 with AVX2, 16GB+ RAM, 8GB+ VRAM
Performance Optimization
- Enable Flash Attention for NVIDIA RTX GPUs
- Use Q4_K_M quantization for best speed/quality balance
- Set appropriate context length (smaller = faster, less VRAM)
- Enable FP16 KV Cache to reduce memory usage
- Configure Idle TTL for automatic resource cleanup
- Use speculative decoding with draft models for 2-3x speedup
Speculative Decoding Example
{
"model": "deepseek-r1-distill-qwen-7b",
"draft_model": "deepseek-r1-distill-qwen-0.5b",
"messages": [...]
}
Bundled Resources
scripts/check_vram.py- Estimate VRAM requirementsscripts/server_health.py- Monitor server statusscripts/model_benchmark.py- Performance testingreferences/integration-patterns.md- RAG, multi-model, IDE integration examples
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です