Model Switcher Skill
Core Rule
When the user asks to switch the current session model, resolve the target dynamically from the active OpenClaw configuration first, then switch the current session directly. Do not hardcode
provider/model values inside the skill.
Required Behavior
Switch current session immediately
When the user says things like:
- - INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
- INLINECODE5
The agent should:
- - read
models.providers from the current OpenClaw configuration - use
skills/openclaw-session-model-switcher/model-aliases.json for provider-level alias resolution - dynamically match against configured models when the user provides a concrete model name or fragment
- directly execute
/model <provider/model> in the current session after resolving a unique target
Recommended execution path:
- - prefer
scripts/switch-model.sh <selection> to resolve the target model - once the script returns a unique model, execute the returned command in the current session
- if the environment supports a direct session-level model override tool, prefer that
- do not merely print
/model ... as plain advice when direct execution is possible
Restore default
When the user says things like:
- - INLINECODE11
- INLINECODE12
- INLINECODE13
The agent should directly execute:
Show current session model
When the user says things like:
- - INLINECODE15
- INLINECODE16
- INLINECODE17
The agent should directly query the current session model state instead of only explaining how to check it.
List configured models
When the user says things like:
- - INLINECODE18
- INLINECODE19
- INLINECODE20
- INLINECODE21
The agent should read models.providers from the current OpenClaw configuration and list switchable models. If the user specifies a provider, only list models for that provider.
Resolution Rules
- - trust only the current OpenClaw configuration in INLINECODE23
- keep
model-aliases.json limited to provider aliases and default semantics - if a provider has only one configured model, use it directly
- if a provider has multiple models, prefer model-name matching from the user input
- if multiple candidates still remain, list the candidates and ask the user to choose
- if nothing matches, clearly say that no configured model matches the request
Multi-Agent Rule
- - this skill affects only the current persona in the current session
- do not modify global configuration
- do not affect other personas or sessions
- do not restart the Gateway
Do
- - switch the current session directly
- tell the user the current session model was switched
- mention that the change affects only the current session when helpful
- return candidate lists for ambiguous matches
- list current available models when the user is unsure
- consume script output at the upper layer instead of exposing raw stderr or internal errors
Do Not
- - do not edit INLINECODE25
- do not restart the Gateway
- do not hardcode model IDs inside the skill
- do not maintain a static model list separate from the active configuration
- do not accidentally implement this as a global default model switch
- do not guess in multi-candidate cases
- do not dump raw JSON, stderr, or internal tool errors to normal users
Suggested Script Interface
- -
scripts/switch-model.sh <selection>: resolve user input and return JSON - INLINECODE27 : list all configured models or only one provider
- INLINECODE28 : output INLINECODE29
Upper-Layer Interaction Flow
For switch requests
When the user asks to switch models, the upper layer should:
- 1. call INLINECODE30
- parse the JSON output
- branch on INLINECODE31
- execute the returned
command
- confirm which model was selected
- mention that it only affects the current session when useful
- do not surface raw script output
- convert
options into a readable candidate list
- ask the user to reply with a model name or number
- do not guess
- explain naturally that no configured model matched
- suggest listing available models when appropriate
For list requests
When the user asks for available models or models from a specific provider:
- 1. call INLINECODE37
- present the result as a readable provider-grouped list
- do not mix in models that are not present in the active configuration
For status requests
When the user asks which model is currently active:
- 1. call INLINECODE38
- execute the session-level status query
- present the result in natural language instead of only teaching the command
Standard Reply Templates
Switch success
- - INLINECODE39
- INLINECODE40
Ambiguous match
- - INLINECODE41
- INLINECODE42
- INLINECODE43
- INLINECODE44
If the user specified a provider:
No match
- - INLINECODE46
- INLINECODE47
List models
- - INLINECODE48
- list them grouped by provider
Fallback Rule
Only if the current environment truly cannot execute native session commands should the agent fall back to replying with:
- - the exact command to run
- why it cannot execute it directly in the current environment
That fallback is a degraded path, not the default path.
模型切换技能
核心规则
当用户要求切换当前会话模型时,首先从当前OpenClaw配置中动态解析目标,然后直接切换当前会话。不要在技能内部硬编码provider/model值。
必要行为
立即切换当前会话
当用户说出类似以下内容时:
- - 切换到gpt
- 切换到claude
- 使用千问
- 改为minimax
- 切换到qwen3.5-flash
代理应:
- - 从当前OpenClaw配置中读取models.providers
- 使用skills/openclaw-session-model-switcher/model-aliases.json进行提供者级别的别名解析
- 当用户提供具体模型名称或片段时,动态匹配已配置的模型
- 解析出唯一目标后,在当前会话中直接执行/model
推荐执行路径:
- - 优先使用scripts/switch-model.sh 解析目标模型
- 脚本返回唯一模型后,在当前会话中执行返回的命令
- 如果环境支持直接的会话级模型覆盖工具,优先使用该工具
- 当可以直接执行时,不要仅仅打印/model ...作为建议
恢复默认
当用户说出类似以下内容时:
代理应直接执行:
显示当前会话模型
当用户说出类似以下内容时:
代理应直接查询当前会话模型状态,而不是仅解释如何查看。
列出已配置的模型
当用户说出类似以下内容时:
- - 有哪些模型可用
- 列出当前模型
- 显示已配置的模型
- 我有哪些千问模型
代理应从当前OpenClaw配置中读取models.providers并列出可切换的模型。如果用户指定了提供者,仅列出该提供者的模型。
解析规则
- - 仅信任当前OpenClaw配置中的models.providers
- 将model-aliases.json限制为提供者别名和默认语义
- 如果某个提供者仅配置了一个模型,直接使用该模型
- 如果某个提供者有多个模型,优先根据用户输入进行模型名称匹配
- 如果仍有多个候选,列出候选并让用户选择
- 如果没有匹配项,明确说明没有已配置的模型匹配该请求
多代理规则
- - 此技能仅影响当前会话中的当前角色
- 不要修改全局配置
- 不要影响其他角色或会话
- 不要重启网关
应做事项
- - 直接切换当前会话
- 告知用户当前会话模型已切换
- 在适当时提及更改仅影响当前会话
- 对模糊匹配返回候选列表
- 当用户不确定时列出当前可用模型
- 在上层消费脚本输出,而不是暴露原始stderr或内部错误
禁止事项
- - 不要编辑openclaw.json
- 不要重启网关
- 不要在技能内部硬编码模型ID
- 不要维护与活动配置分离的静态模型列表
- 不要意外将其实现为全局默认模型切换
- 不要在多个候选情况下猜测
- 不要向普通用户转储原始JSON、stderr或内部工具错误
建议的脚本接口
- - scripts/switch-model.sh :解析用户输入并返回JSON
- scripts/list-models.sh [provider]:列出所有已配置的模型或仅某个提供者的模型
- scripts/model-status.sh:输出/model status
上层交互流程
切换请求
当用户要求切换模型时,上层应:
- 1. 调用scripts/switch-model.sh
- 解析JSON输出
- 根据status分支处理
- 执行返回的command
- 确认选择了哪个模型
- 在有用时提及仅影响当前会话
- 不要暴露原始脚本输出
- 将options转换为可读的候选列表
- 要求用户回复模型名称或编号
- 不要猜测
- 自然地解释没有已配置的模型匹配
- 在适当时建议列出可用模型
列表请求
当用户询问可用模型或特定提供者的模型时:
- 1. 调用scripts/list-models.sh [provider]
- 将结果呈现为按提供者分组的可读列表
- 不要混入活动配置中不存在的模型
状态请求
当用户询问当前活动的模型时:
- 1. 调用scripts/model-status.sh
- 执行会话级状态查询
- 用自然语言呈现结果,而不是仅教授命令
标准回复模板
切换成功
- - 已将当前会话切换到。
- 已将当前会话切换到;此更改仅影响当前会话。
模糊匹配
- - 您可以切换到以下模型:
- 1.
- 2.
- 请回复模型名称或编号。
如果用户指定了提供者:
无匹配
- - 没有已配置的模型匹配。
- 我可以列出您配置中当前可用的模型。
列出模型
- - 当前活动配置中可用的模型如下:
- 按提供者分组列出
降级规则
仅当当前环境确实无法执行原生会话命令时,代理才应降级为回复:
- - 要运行的确切命令
- 为什么无法在当前环境中直接执行
该降级路径是退化路径,而非默认路径。