lm-studio-subagents
БесплатноБез исполняемых скриптовНе проверенOffload tasks to local LLMs via LM Studio. Use when a user asks to run local models with LM Studio, save API costs by using local LLMs, create subagents with…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
LM Studio Subagents
Overview
Offload LLM tasks to local models running in LM Studio to save API costs and maintain privacy. LM Studio provides a native REST API and OpenAI-compatible endpoints. Prefer the native /api/v1/chat API for long-form work because it exposes output-token, reasoning, context-length, streaming, and stateful-continuation controls. Use local models for high-volume, lower-complexity tasks like summarization, extraction, classification, and reformatting while reserving cloud APIs for complex reasoning.
Instructions
When a user wants to use local models via LM Studio, determine the task:
Task A: Set up LM Studio as a local API server
Download and install LM Studio from
https://lmstudio.ai/Download a model: in the app use Model Search, or from a terminal run
lms get(no argument lists curated recommendations;lms get llama-3.1-8b@q4_k_mpicks a quantization). Instruct models in the 4B-8B range (Qwen, Llama, Mistral families) are a good start; check the memory estimate first withlms load --estimate-only qwen2.5-7b-instruct.Start the local server: toggle "Start server" in the Developer tab, or run
lms server start(add--port 1234to pin the port; the CLI otherwise reuses the last port, and 1234 is the usual default). It listens on127.0.0.1only unless you pass--bind;--corsand non-local binds need authentication switched on.Load a model with a stable API name and context size, then verify:
lms load qwen2.5-7b-instruct --identifier local-worker --context-length 16384
curl http://localhost:1234/v1/models
The id values returned are what you pass as model. Export it: export LM_MODEL=local-worker.
- Authentication is off by default ("does not require authentication"). To enable it, go to Developer, Server Settings, switch authentication on, then Manage Tokens, Create Token, and copy the token once. Export it as
LM_API_TOKEN; send it asAuthorization: Bearer $LM_API_TOKEN. With auth off, the header is harmless. OpenAI-compatible clients still need some non-empty key string.
Task B: Call LM Studio from Python (native v1 API, preferred)
The native endpoint exposes output-length, reasoning, and stateful-continuation controls the OpenAI-compatible route lacks. Set max_output_tokens generously (4096-8192 for long-form), turn reasoning off unless it is genuinely needed, keep store: true so a truncated answer can be continued with previous_response_id, and allow a long HTTP timeout for slow local models.
import os
import requests
LM_STUDIO_URL = "http://localhost:1234"
TOKEN = os.environ.get("LM_API_TOKEN") # only needed when server auth is enabled
HEADERS = {"Authorization": f"Bearer {TOKEN}"} if TOKEN else {}
MODEL = os.environ.get("LM_MODEL", "local-worker")
def _chat(**body) -> dict:
body.setdefault("model", MODEL)
body.setdefault("max_output_tokens", 4096)
body.setdefault("reasoning", "off") # reasoning tokens eat the output budget
body.setdefault("store", True) # required for previous_response_id
r = requests.post(f"{LM_STUDIO_URL}/api/v1/chat", headers=HEADERS, json=body,
timeout=900) # local models are slow; do not time out early
r.raise_for_status()
data = r.json()
message = next(item for item in data["output"] if item["type"] == "message")
return {"text": message["content"], "response_id": data.get("response_id"),
"stats": data.get("stats", {})}
def ask_local(prompt: str, system: str = "You are a helpful assistant.") -> dict:
return _chat(input=prompt, system_prompt=system, temperature=0.3,
context_length=32768) # match the loaded model's configured context
def continue_local(response_id: str) -> dict:
"""Resume a cut-off answer without resending the source text."""
return _chat(previous_response_id=response_id,
input="Continue exactly where you stopped. Do not repeat prior text.")
result = ask_local("Summarize this text in 2 sentences: ...")
print(result["text"])
# If stats["total_output_tokens"] reached max_output_tokens, the answer was cut off; extend it:
# result = continue_local(result["response_id"])
OpenAI-compatible fallback
Use this route when the native API is unavailable (LM Studio older than 0.4.0, or an existing OpenAI-SDK codebase). Set max_tokens generously (4096-8192) because a small hard-coded limit silently truncates answers. There is no continuation primitive here, so always inspect finish_reason.
from openai import OpenAI
# Point to local LM Studio server
client = OpenAI(
base_url="http://localhost:1234/v1",
api_key="lm-studio", # any non-empty string; only checked when auth is on
)
def ask_local(prompt: str, system: str = "You are a helpful assistant.") -> str:
response = client.chat.completions.create(
model="local-worker", # the identifier shown by /v1/models
messages
Установить lm-studio-subagents в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл lm-studio-subagents?
Offload tasks to local LLMs via LM Studio. Use when a user asks to run local models with LM Studio, save API costs by using local LLMs, create subagents with local models, offload summarization or classification to a local model, or use LM Studio's API for batch processing. Covers local model inference, task delegation, and cost optimization.
Как установить скилл lm-studio-subagents?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл lm-studio-subagents запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic