本文へ移動
cccskills
無料GitHub で公開

openclaw-model-switch

Switches or repairs an OpenClaw instance's model config: changes the default model, adds model definitions, and fixes 401 "Invalid token", "No available channel / model not found", "Thinking level X is not supported", or a config edit that doesn't take effect. Use for 切换模型/换模型/升级模型 or 模型配的错了. Not for plain config audits (use openclaw).

インストール方法を見る

含まれるファイル(4)

  • SKILL.md5.3 KB
  • references/kimi-models.md3.6 KB
  • references/troubleshooting-model-config.md8.3 KB
  • scripts/switch-model.py8.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

OpenClaw Model Switch

Switch or repair an OpenClaw instance's model configuration by safely editing openclaw.json.

Diagnose before you edit. Model failures on OpenClaw are usually NOT the model id — they are key routing (env hijack), provider-plugin restrictions, or endpoint/model mismatch. Changing the model id without checking these first is how a 5-minute fix becomes a 2-hour debugging session. The full trap catalog with discovery commands lives in references/troubleshooting-model-config.md — read it the moment anything errors.

Step 1 — Find the real config file(s)

Do NOT assume a hardcoded path. Candidate locations (check all, edit all that exist):

  1. ~/.openclaw/openclaw.json — the gateway's live config on most installs
  2. ~/.kimi/kimi-claw/openclaw.json — Kimi Claw mirror, kept in sync on some installs
  3. ~/.kimi_openclaw/openclaw.json — legacy desktop path

Confirm which one the gateway actually reads: openclaw gateway status prints Config (service): <path>. If several exist, treat them as mirrors: edit all of them identically, otherwise the next sync overwrites your fix.

Step 2 — Probe the endpoint + model BEFORE touching config

Never trust a relay's model listing (GET /v1/models on new-api style relays is frequently incomplete — a model can be absent from the list yet serve fine). The only authority is a real completion probe from the host that will run the bot:

curl -sS -o /tmp/probe.json -w "HTTP %{http_code}\n" \
  -X POST "<baseUrl>/v1/messages" \
  -H "Authorization: Bearer <apiKey>" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model":"<model-id>","max_tokens":16,"messages":[{"role":"user","content":"hi"}]}'

Expected: HTTP 200 and a content array in the body. 401 Invalid token with a token you just verified works elsewhere → the wire key is being hijacked (see trap #1 in the troubleshooting reference). 503 No available channel → the model is not served for this token/group from this network (trap #3) — pick a served model or fix the relay, don't blind-switch.

Step 3 — Switch the model

python3 scripts/switch-model.py <model-id> --restart
# target a specific provider instead of the guessed one:
python3 scripts/switch-model.py k3 --provider kimi-relay --restart
# explicit config path (skips discovery):
python3 scripts/switch-model.py k3 --config ~/.openclaw/openclaw.json --restart

The script: discovers and backs up every candidate config to <config-dir>/config-backups/, adds the model definition if known, sets agents.defaults.model.primary, syncs mirror files, and restarts the gateway with --restart.

Step 4 — Verify end-to-end (mandatory)

A restarted gateway proves nothing. Run one real agent turn and read the result metadata:

openclaw agent --local --json --agent main --session-id verify-$(date +%s) -m "ping"

Success looks like: "result": "success", "fallbackUsed": false, and the gateway log shows agent model: <provider>/<model> (thinking=...). "result": "success" with fallbackUsed: true means your target failed and a fallback saved the turn — the config is still wrong.

Common failures → read the troubleshooting reference

SymptomMost likely trap
LLM error new_api_error: Invalid token, but the token works in curlTrap #1 — env KIMI_API_KEY hijacks the provider's wire key
Thinking level "max" is not supported ... Use one of: off, onTrap #2 — kimi-provider plugin hardcodes binary thinking; bypass with a custom provider
Thinking level ... Use one of: off, minimal, low, medium, highTrap #2 variant — anthropic-messages base profile; unlock via params.canonicalModelId
503 No available channel for model X under group defaultTrap #3 — model not served for this group/network; listing ≠ availability
Edit saved + gateway restarted, nothing changedTrap #5 — edited the wrong file / mirror not synced

Safety rules

  • Always backup before editing (the script does this; manual edits: copy to config-backups/ first)
  • Preserve existing apiKey, headers, plugin configs, and env blocks — retype only the fields you mean to change
  • Validate JSON after manual edits: python3 -m json.tool openclaw.json > /dev/null
  • Do not commit config files containing API keys to version control
  • After changing anything, redo the Step-4 verification — and if it fails, restore the newest backup before trying something else

Resources

  • scripts/switch-model.py — model switcher with config discovery, backup, mirror sync, and restart
  • references/kimi-models.md — known model specs (k3, k2p6, kimi-k2.7-code) and config snippets
  • references/troubleshooting-model-config.md — the trap catalog: env key hijack, plugin binary thinking, canonicalModelId, relay availability, config discovery. Read on any error.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Fixes web search on an agent whose model backend can't run it: a relay/reseller proxying Claude or Codex returns empty instead of failing. Use when web search returns nothing, a model insists a shipped product doesn't exist, someone wants to give an agent internet access, or the user is on a third-party base URL, relay, or 中转站. Diagnoses which built-in tools are dead, removes them, and installs a working replacement.

日本語の概要は準備中です。原文の説明を表示しています。

daymade/claude-code-skills1,4512026年10月11日 更新

抓取 A 股消息面情报:从财联社、华尔街见闻、金十、新浪 7x24、东财快讯、 证监会/央行/上交所/财政部政策公告、东方财富股吧等公开来源抓取与股票相关的 新闻、政策、情绪,输出结构化 JSON 或 Markdown。 当用户提到“A 股消息面”、“抓新闻”、“个股消息”、“政策监管”、“股吧情绪”、 “财联社”、“东财快讯”、“市场情绪”或需要把某只股票相关的公开情报聚合出来时 触发。也适用于“帮我看看 000001 最近有什么消息”这类口语化请求。

日本語の概要は準備中です。原文の説明を表示しています。

daymade/claude-code-skills1,4512026年10月11日 更新

Transcribes audio or video to speaker-labeled, timestamped text, locally with MLX on Apple Silicon or remotely. Use for 转录 / 录音转文字 / 说话人分离 / 字幕, and also for preparing audio for ASR without transcribing: 转格式, 降采样到 16kHz, merging recorder segments, or compressing and speeding up audio before 飞书妙记 — even when it looks like a one-line ffmpeg job.

日本語の概要は準備中です。原文の説明を表示しています。

daymade/claude-code-skills1,4512026年10月11日 更新

Routes audio: StepFun ASR/语音识别, StepFun TTS/配音, transcript/妙记→会议纪要, merge/review minutes. Reads one bundled specialist; generic ASR and correction stay direct.

日本語の概要は準備中です。原文の説明を表示しています。

daymade/claude-code-skills1,4512026年10月11日 更新

Diagnoses and repairs repository setup and guarded Git workflows for Claude Code or Codex — environment repair, startup sync, hook auditing, collaborator handoff. Use when a repo won't run, a teammate onboards, hook output duplicates, or commit/push/conflict needs guarding. Not for lost-commit recovery (use git-safety-net), GitHub ops (use github-ops), or history scrubbing (use github-sensitive-data-cleanup).

日本語の概要は準備中です。原文の説明を表示しています。

daymade/claude-code-skills1,4512026年10月11日 更新

Runs adversarial due-diligence on a benchmark the user envies — a founder, KOL, company, or product whose success looks inflated — splitting marketing bubble from real signal, then mapping the validated playbook onto the user's own resources. Use for 尽调/对标/拆解 a competitor, 抄/偷师 their playbook, or suspecting 水分/泡沫 in claims. Prefer over deep-research when debunking inflated claims, not a neutral briefing.

日本語の概要は準備中です。原文の説明を表示しています。

daymade/claude-code-skills1,4512026年10月11日 更新

daymade のスキルをすべて見る

このスキルの問題を報告する