当前位置: 首页 > Skill >

Lmstudio Model Switch

Lmstudio Model Switch

Lmstudio Model Switch

在OpenClaw中通过简单命令实时切换本地LM Studio与云端Kimi API模型,自动重启网关。

0.1.0 2026.11.27 485
获取Skill文件查看使用说明
作 者:顾宁 许可证: 更新时间:2026.11.27
本文目录展开

lmstudio-model-switch

Fast model switching between LM Studio local and Kimi API for OpenClaw.

Switch your agent's AI model on-the-fly between local (LM Studio) and cloud (Kimi API) providers with a single command.

Installation

# Clone to your OpenClaw skills directory
git clone https://github.com/yourusername/lmstudio-model-switch 
  ~/.openclaw/workspace/skills/lmstudio-model-switch

# Or manually copy
cp -r lmstudio-model-switch ~/.openclaw/workspace/skills/

Usage

Commands

Command Description
/switch-model status Show current model and available providers
/switch-model local Switch to LM Studio (Qwen 3.5 9B default)
/switch-model local <model> Switch to specific local model
/switch-model api Switch to Kimi K2.5 API
/switch-model kimi Alias for /switch-model api

Examples

# Check current status
/switch-model status

# Switch to local LM Studio
/switch-model local

# Switch to specific model
/switch-model local mistral-small-24b

# Switch to Kimi API
/switch-model api

Configuration

Add to your openclaw.json:

{
  "skills": {
    "lmstudio-model-switch": {
      "enabled": true,
      "config": {
        "local": {
          "baseUrl": "http://127.0.0.1:1234/v1",
          "defaultModel": "qwen/qwen3.5-9b"
        },
        "api": {
          "provider": "kimi-coding",
          "model": "k2p5"
        }
      }
    }
  }
}

How It Works

  1. Backup: Creates timestamped backup of openclaw.json
  2. Edit: Modifies "primary" model in agents.defaults
  3. Verify: Validates JSON syntax
  4. Restart: Restarts OpenClaw gateway service
  5. Confirm: Reports new active model

Use Cases

Privacy-First Work

Use local when handling:

  • Authentication tokens
  • Passwords or credentials
  • Sensitive personal data
  • Proprietary code

Quality-First Work

Use API when needing:

  • Maximum reasoning capability
  • Very long contexts (>100k tokens)
  • Best-in-class performance
  • Cloud reliability

VRAM Management

Switch to API when:

  • GPU memory is low (<6GB free)
  • Running other GPU-intensive tasks
  • LM Studio is restarting

Requirements

  • OpenClaw ≥ 2026.3.12
  • LM Studio running on port 1234 (for local mode)
  • Kimi API key configured (for API mode)
  • systemd (for service restart)

Troubleshooting

"LM Studio not responding"

# Check if LM Studio is running
curl http://127.0.0.1:1234/api/v0/models

# Restart LM Studio if needed
killall lmstudio; sleep 2; lmstudio &

"Switch failed"

  • Check JSON syntax: python3 -m json.tool ~/.openclaw/openclaw.json
  • Restore from backup: cp ~/.openclaw/openclaw.json.bak.* ~/.openclaw/openclaw.json

"Gateway won't restart"

# Check service status
systemctl --user status openclaw-gateway

# Manual restart
systemctl --user restart openclaw-gateway

Author

WarMech - OpenClaw Community

License

MIT

Changelog

2026-03-14 - v1.0.0

  • Initial release
  • Support for local/API switching
  • Backup/restore functionality
  • systemd integration

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,037
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,020
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,016
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,015
Skill 文件
  • SKILL.md
    • lmstudio-model-switch
    • Installation
    • Usage
      • Commands
      • Examples
    • Configuration
    • How It Works
    • Use Cases
      • Privacy-First Work
      • Quality-First Work
      • VRAM Management
    • Requirements
    • Troubleshooting
      • "LM Studio not responding"
      • "Switch failed"
      • "Gateway won't restart"
    • Author
    • License
    • Changelog
  • 项目或源文件

相关 Skill

更多
Offload Tasks to LM Studio Models Offload Tasks to LM Studio Models 通过将工作负载卸载到本地 LM Studio 模型,减少对付费提供商的 token 使用。使用场景:(1)降低成本——当质量足够时,使用本地模型进行摘要、抽取、分类、改写、首次审查、头脑风暴;(2)避免高批量或重复性任务的付费 API 调用;(3)无需额外模型配置——JIT 加载和 REST API 与现有 LM Studio 设置兼容;(4)仅限本地或隐私敏感的工作。需 LM Studio 0.4+ 并启动服务器(默认 :1234),无需 CLI。
多AI讨论 多AI讨论 多个 AI 角色组成「谋士团」,主参谋(WorkBuddy)常驻对话,其余 AI 角色按需 @召唤发言。适合小说创作、剧本讨论、创意头脑风暴。 核心特点: - 主参谋先回应,谋士平时沉默、@召唤才开口 - 支持单角色召唤、全体讨论、上下文自动共享 - 默认角色:逻辑猫、共鸣猫、现实猫、博学家 - 自带可视化角色管理页,可增删角色、改 prompt - 支持 DeepSeek / OpenAI / 本地 LM Studio 三种后端 安装后填入自己的 API Key 即可使用。
Adaptive Routing Adaptive Routing 优先将LLM请求路由至本地模型(如Ollama、LM Studio、llamafile),验证响应质量,仅在本地结果不佳时升级至云端。
Local-First LLM Local-First LLM 将LLM请求优先路由至本地模型(Ollama、LM Studio、llamafile),失败后回退至云端API,并持续追踪Token节省与成本规避情况。
AI Guardian AI Guardian Use this skill whenever the user needs to observe or govern on-endpoint local LLMs running on Ollama, llama.cpp (llama-server), LM Studio, or a local single-node vLLM — inventory installed/running models with an allow/deny verdict (shadow-AI detection), inspect VRAM residency, model license/params/capabilities and server version, view the model policy, detect model provenance/digest drift (re-pulled or tampered weights; strong for Ollama/llama.cpp, id-only and honestly weaker for LM Studio/vLLM)