Tyler Sinclair

Offload Tasks to LM Studio Models

AI 智慧體v1.0.3
作者:Tyler Sinclair更新於 2026-05-11共 4 個版本 · 最新版本釋出於 2026-02-02lm-studio-subagents@clawhub_t-sinclair2500/lm-studio-subagents
任務自動化工具呼叫#Privacy#Rest Api

據 AlphaMoat 統計,截至 2026-09,Offload Tasks to LM Studio Models 累計下載 3,537 次、獲 4 個星標,在全部 5,078 個 AI 技能中排名第 3,108 位,在「AI 智慧體」分類(969 個)中排名第 632 位。

累計安裝
120
累計下載
3537
星標
4
全站排名
#3,108
全站前 62% · 「AI 智慧體」前 66%
平台累計安裝累計下載星標評論
ClawHub ↗11334593-
SkillHub ↗12035374—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

需要 LM Studio 0.4+、已下載模型和執行中的本機 API 服務,預設埠 1234,使用 Bearer lmstudio。指令碼需 Node,也可用 curl。先列模型,按視覺、嵌入和脈絡長度選擇;可即時或明確載入,透過 response_id 延續對話。卸載必須用回傳的 loaded_instances[].id,不能猜成模型名;只卸載目標模型例項。服務未就緒先處理連線,記憶體不足改小模型或卸載,輸出不適合時保留主模型回退。

資料釋出於 2026-10-26

可以用來做什麼

  • 使用本機模型處理品質要求適配的重複文字任務

什麼時候用

  • 本機LM Studio已就緒,任務適合其模型能力時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

列出本機可用模型,為這份摘要任務選擇合適的模型。

月度資料趨勢

累計下載3537
2355299036252026-03 · 累計下載 24432026-05 · 累計下載 28992026-06 · 累計下載 30322026-07 · 累計下載 32722026-08 · 累計下載 33592026-09 · 累計下載 353726-0326-09
星標4
3442026-03 · 星標 32026-05 · 星標 42026-06 · 星標 32026-07 · 星標 42026-08 · 星標 42026-09 · 星標 426-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-093537—4
2026-083359+2.7%4
2026-073272+7.9%4
2026-063032+4.6%3
2026-052899—4
2026-032443—3

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

7.6 KB · ClawHub v1.0.3
---
name: lmstudio-subagents
description: "Reduces token usage from paid providers by offloading work to local LM Studio models. Use when: (1) Cutting costs—use local models for summarization, extraction, classification, rewriting, first-pass review, brainstorming when quality suffices, (2) Avoiding paid API calls for high-volume or repetitive tasks, (3) No extra model configuration—JIT loading and REST API work with existing LM Studio setup, (4) Local-only or privacy-sensitive work. Requires LM Studio 0.4+ with server (default :1234). No CLI required."
metadata: {"openclaw":{"requires":{},"tags":["local-model","local-llm","lm-studio","token-management","privacy","subagents"]}}
license: MIT
---

# LM Studio Models

Offload tasks to local models when quality suffices. Base URL: http://127.0.0.1:1234. Auth: `Authorization: Bearer lmstudio`. instance_id = `loaded_instances[].id` (same model can have multiple, e.g. `key` and `key:2`).
展開全部(共 133 行)

## Key Terms

- **model**: From GET models key; use in chat and optional load.
- **lm_studio_api_url**: Default http://127.0.0.1:1234 (paths /api/v1/...).
- **response_id** / **previous_response_id**: Chat returns response_id; pass as previous_response_id for stateful.
- **instance_id**: For unload, use only the value from GET /api/v1/models for that model: each `loaded_instances[].id`. Do not assume it equals the model key; with multiple instances ids can be like key:2. LM Studio docs: List (loaded_instances[].id), Unload (instance_id).

Trigger in frontmatter; below = implementation.

## Prerequisites

LM Studio 0.4+, server :1234, models on disk; load/unload via API (JIT optional); Node for script (curl ok).

## Quick start

Minimal path: list models, then one chat. Replace `<model>` with a key from GET /api/v1/models and `<task>` with the task text.

```bash
curl -s -H 'Authorization: Bearer lmstudio' http://127.0.0.1:1234/api/v1/models
node scripts/lmstudio-api.mjs <model> '<task>' --temperature=0.5 --max-output-tokens=200
```

Stateful multi-turn: pass `--previous-response-id=<id>` from the prior script output. Or use `--stateful` to persist response_id automatically. Optional `--log <path>` for request/response.

```bash
node scripts/lmstudio-api.mjs <model> 'First turn...' --previous-response-id=$ID1
node scripts/lmstudio-api.mjs <model> 'Second turn...' --previous-response-id=$ID2
```

## Complete Workflow

### Step 0: Preflight

GET <base>/api/v1/models; non-200 or connection error = server not ready.

```bash
exec command:"curl -s -o /dev/null -w '%{http_code}' -H 'Authorization: Bearer lmstudio' http://127.0.0.1:1234/api/v1/models"
```

### Step 1: List Models and Select

GET /api/v1/models to list models. Parse each entry: key, type, loaded_instances, max_context_length, capabilities. If a model already has loaded_instances.length > 0 and fits the task, skip to Step 5; otherwise pick a key for chat (and optional load in Step 3). Choose by task: vision -> capabilities.vision; embedding -> type=embedding; context -> max_context_length. Prefer already-loaded; prefer smaller for speed, larger for reasoning. Note loaded_instances[].id for optional unload later.

**Example — list models:**
```bash
exec command:"curl -s -H 'Authorization: Bearer lmstudio' http://127.0.0.1:1234/api/v1/models"
```

Parse models[] (key, type, loaded_instances, max_context_length, capabilities, params_string). If a model has loaded_instances.length > 0 and fits task, skip to Step 5; else pick key for chat (and optional load). Note loaded_instances[].id for optional unload.

### Step 2: Model Selection

Pick key from GET response; use as model in chat (optional load). Constraints: vision -> capabilities.vision; embedding -> type=embedding; context -> max_context_length. Prefer loaded (loaded_instances non-empty), smaller for speed/larger for reasoning; fallback primary. If unsure, use the first loaded instance for that key or the smallest loaded model that fits the task. Optional POST load; else JIT on first chat.

### Step 3: Load Model (optional)

Optional: POST /api/v1/models/load { model, context_length?, ... }. Or run scripts/load.mjs &lt;model&gt;. JIT: first chat loads; explicit load only for specific options.

### Step 4: Verify Loaded (optional)

If explicit load: GET models, confirm loaded_instances. If JIT: no verify; first chat returns model_instance_id, stats.model_load_time_seconds.

### Step 5: Call API

From the skill folder: node scripts/lmstudio-api.mjs &lt;model&gt; '&lt;task&gt;' [options].

```bash
exec command:"node scripts/lmstudio-api.mjs <model> '<task>' --temperature=0.7 --max-output-tokens=2000"
```

Stateful: add --previous-response-id=<response_id>. Curl: POST <base>/api/v1/chat, body model, input, store, temperature, max_output_tokens; optional previous_response_id. Parse: output (type message) -> content; response_id, model_instance_id, stats. Script outputs content, model_instance_id, response_id, usage.

### Step 6: Unload (optional)

For the model key you used: GET /api/v1/models, then for **each** `loaded_instances[].id` for that model, POST /api/v1/models/unload with body `{"instance_id": "<that id>"}`. Use the id from the response only (do not send the model key unless it exactly equals that id). Or run scripts/unload.mjs &lt;model_key&gt; (script does GET then unloads each instance id). Optional --unload-after (default off); use --keep to leave loaded. Unload only that model's instances. JIT+TTL auto-unload; explicit when needed.

```bash
# One unload per instance_id; repeat for each id in that model's loaded_instances
exec command:"curl -s -X POST http://127.0.0.1:1234/api/v1/models/unload -H 'Content-Type: application/json' -H 'Authorization: Bearer lmstudio' -d '{\"instance_id\": \"<instance_id>\"}'"
```

### Step 7: Verify unload (optional)

After unloading, confirm no instances remain for that model key. Run the jq check below; result must be `0`. If non-zero, unload the remaining instance_id(s) from that model and re-run the check. Do not infer from "model object exists"; the object still exists with an empty `loaded_instances` array.

```bash
exec command:"curl -s -H 'Authorization: Bearer lmstudio' http://127.0.0.1:1234/api/v1/models | jq '.models[]|select(.key==\"<model_key>\")|.loaded_instances|length'"
```

Expect output `0`. If not, unload remaining instance_ids and re-run.

## Error Handling

- Script retries on transient failure (2-3 attempts with backoff).
- Model not found -> pick another model from GET response.
- API/server errors -> GET models, check URL.
- Invalid output -> retry.
- Memory -> unload or smaller model.
- Unload fails -> instance_id must be exactly from GET /api/v1/models for that model's loaded_instances[].id (not the model key unless it matches).

## Copy-paste

Replace `<model>` with a key from GET /api/v1/models and `<task>` with the task text. Optional unload per Step 6 (instance_id from GET models for that key).

```bash
exec command:"curl -s -H 'Authorization: Bearer lmstudio' http://127.0.0.1:1234/api/v1/models"
exec command:"node scripts/lmstudio-api.mjs <model> '<task>' --temperature=0.7 --max-output-tokens=2000"
```

## LM Studio API Details

Helper/API: see Step 5. Output: content, model_instance_id, response_id, usage. Auth: Bearer lmstudio. List GET /api/v1/models. Load POST /api/v1/models/load (optional). Unload POST /api/v1/models/unload { instance_id }.

## Scripts

lmstudio-api.mjs: chat; options --stateful, --unload-after, --keep, --log &lt;path&gt;, --previous-response-id, --temperature, --max-output-tokens. load.mjs: load model by key. unload.mjs: unload by model key (all instances). test.mjs: smoke test (load, chat, unload one model).

## Notes

- LM Studio 0.4+.
- JIT (first chat loads; model_load_time_seconds in stats); stateful (response_id / previous_response_id).

「AI 智慧體」分類下的熱門技能

self-improving agentAI 智慧體

記錄自身發現以實現自我改進的技能

↓ 129萬★ 4521pskoett
Find SkillsAI 智慧體

幫助使用者發現和安裝智慧體技能,當用戶詢問如「如何做X」、「找X的技能」、「有能做...的嗎」等問題時

↓ 110.3萬★ 1778桂皮
Agent BrowserAI 智慧體

給 AI agent 用的瀏覽器自動化命令列技能。

↓ 90.9萬★ 991Nicolas Kleiber
Self-Improving + Proactive AgentAI 智慧體

自我反思+自我批評+自我學習+自組織記憶。智慧體評估自身工作、發現錯誤並持續改進。

↓ 44.4萬★ 1606Iván
Skill VetterAI 智慧體

在安裝第三方技能之前,按清單審查來源、許可權與危險模式的技能。

↓ 33萬★ 1323spclaudehome
ontologyAI 智慧體

類型化知識圖譜,用於結構化智慧體記憶與可組合技能。適用於以下場景:建立/查詢實體(人物、專案、任務、事件、文件)、關聯相關物件、強制執行約束、將多步操作規劃為圖譜變換,或當技能需要共享狀態時。觸發關鍵詞包括"記住""我知道關於什麼""將X連結到Y""顯示依賴關係"、實體增刪改查操作,以及跨技能資料訪問。

↓ 29.4萬★ 788oswalpalash
Proactive AgentAI 智慧體

將 AI 代理從任務執行者轉變為能夠預見需求、持續最佳化的主動夥伴。現已支援 WAL Protocol、Working Buffer、Autonomous Crons 及經過實戰驗證的模式。屬於 Hal Stack 🦞。

↓ 28.8萬★ 913halthelobster
Skill CreatorAI 智慧體

建立有效技能指南。當用戶希望建立新技能(或更新現有技能)以利用專業知識、工作流程或工具整合擴充套件 Claude 的能力時,應使用此技能。

↓ 23.8萬★ 473chindden

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。