openclaw models

模型发现、扫描与配置(默认模型、fallback、认证 profile)。

常用命令

openclaw models status          # 查看默认模型/fallback + 认证概览
openclaw models list            # 列出可用模型
openclaw models set <model>     # 设置默认模型(支持 provider/model 或 alias)
openclaw models scan            # 扫描 OpenRouter :free 目录并排名候选 fallback

models status

openclaw models status --json
openclaw models status --probe                        # 实时探测各 provider(消耗 token)
openclaw models status --probe-provider openai
openclaw models status --agent <id>                   # 查看指定 agent 的模型/认证状态
openclaw models status --check                        # exit 1=过期/缺失, 2=即将过期

探测状态桶:ok / auth / rate_limit / billing / timeout / format / unknown / no_model

models list

openclaw models list
openclaw models list --all                            # 含 provider 发现的完整目录
openclaw models list --provider moonshot              # 按 provider 过滤
  • --all 会等待 provider 发现完成,速度较慢
  • Ctx 列显示 contextTokens/contextWindow(有运行时 cap 时)
  • provider 过滤用 provider id(如 moonshot),不用显示名称

models scan

扫描 OpenRouter :free 目录,探测 tool/image 支持:

openclaw models scan --no-probe          # 仅元数据,不发起请求
openclaw models scan --set-default       # 扫描后设为默认(需 live probe)
openclaw models scan --min-params <b> --max-age-days <days>

Aliases 与 Fallbacks

openclaw models aliases list
openclaw models fallbacks list

认证 Profile 管理

openclaw models auth add                              # 交互式添加认证
openclaw models auth list [--provider <id>] [--json]
openclaw models auth login --provider openai          # OAuth/API key 流程
openclaw models auth login --provider openai --method api-key
openclaw models auth setup-token --provider <id>      # 交互式 token 设置
openclaw models auth paste-token --provider <id>      # 粘贴 token(自动化友好)
openclaw models auth paste-token --provider <id> --expires-in 365d
  • auth list 不输出 token/secret 内容
  • --agent <id> 将认证结果写入指定 agent 的存储
  • OpenAI:--provider openai 默认 ChatGPT/Codex 账号登录;--method api-key 添加 API key profile

模型引用格式

  • 格式:provider/model(按第一个 / 分割)
  • OpenRouter 风格:openrouter/moonshotai/kimi-k2
  • 省略 provider 时:先查 alias → 再查唯一匹配 → 最后用默认 provider(有 deprecation 警告)

相关链接