Skip to content
站长自营API 中转

国内开发者可试试 ZZSwitch

统一 Base URL、Key 和余额,适合 OpenCode / Claude Code / Codex 等工具接入。

站长自营API 中转

正在比较模型套餐?可以把多个 AI API 接到一个网关里

ZZSwitch 是我自己运营的统一 API 网关,适合需要国内支付、兑换码充值、多模型切换和 OpenAI 兼容接口的开发者。不是 OpenCode 官方服务。

本页介绍 openclaw models 的所有子命令:status(查看当前认证和模型配置)、list(列出所有可用模型)、set(设置默认模型)、scan(自动扫描新模型)、aliases/fallbacks(别名和降级链管理)以及 auth 系列(添加/登录/粘贴 token)。包含 Anthropic 在 OpenClaw 中使用时的计费须知。

openclaw models

模型发现、扫描与配置(默认模型、降级链、认证档案)。

相关文档:

常用命令

bash
openclaw models status        # 查看认证状态和当前模型
openclaw models list          # 列出所有可用模型
openclaw models set claude-3-7-sonnet-20250219
openclaw models scan          # 自动扫描可用模型

openclaw models status 显示已解析的默认模型、降级链及认证概览。有 OAuth/API Key 配置时还会显示 provider 用量窗口和配额快照。

支持用量快照的 provider:Anthropic、GitHub Copilot、Gemini CLI、OpenAI Codex、MiniMax、Xiaomi、z.ai。

Anthropic 计费说明(2026-04-04 通知): 在 OpenClaw 中使用 Anthropic Claude 登录路径,属于第三方框架使用,需要额外购买 Extra Usage,与 Claude 订阅分开计费。本地测试表明,使用 Anthropic SDK + API Key 路径不携带 OpenClaw 标识,所以生产环境推荐使用 Anthropic API Key 或其他订阅制 provider(OpenAI Codex、阿里云百炼 Coding Plan、MiniMax Coding Plan、Z.AI/GLM Coding Plan)。

models status

选项:

  • --json
  • --plain
  • --check(退出码:1=已过期/缺失,2=即将过期)
  • --probe(对配置的认证档案发起实时探测)
  • --probe-provider <name>(仅探测指定 provider)
  • --probe-profile <id>(可重复或逗号分隔)
  • --probe-timeout <ms>
  • --probe-concurrency <n>
  • --probe-max-tokens <n>
  • --agent <id>(使用指定 agent 的模型/认证配置)

探测结果状态:

状态含义
ok认证正常
auth认证失败
rate_limit触发限速
billing计费问题
timeout请求超时
format响应格式异常
unknown未知错误
no_model认证正常但找不到可用模型
excluded_by_auth_order档案存在,但被 auth.order 排除

models list

选项:

  • --all:包含未激活的模型
  • --local:仅列出本地模型
  • --provider <name>:按 provider 过滤
  • --json
  • --plain

models set <model>

设置 agents.defaults.model.primary

bash
openclaw models set anthropic/claude-3-7-sonnet-20250219
openclaw models set openrouter/moonshotai/kimi-k2
  • 接受 provider/model 格式,或别名
  • / 的模型 ID(OpenRouter 风格)需带 provider 前缀:openrouter/moonshotai/kimi-k2

models set-image <model>

设置 agents.defaults.imageModel.primary

models aliases

bash
openclaw models aliases list
openclaw models aliases add <alias> <model>
openclaw models aliases remove <alias>

models fallbacks

管理降级链(主模型不可用时依次尝试):

bash
openclaw models fallbacks list
openclaw models fallbacks add <model>
openclaw models fallbacks remove <model>
openclaw models fallbacks clear

图片模型降级链:models image-fallbacks list|add|remove|clear

models scan

自动扫描 provider 并推荐可用模型:

选项:

  • --min-params <b>--max-age-days <days>
  • --provider <name>--max-candidates <n>
  • --timeout <ms>--concurrency <n>
  • --no-probe--yes--no-input
  • --set-default(扫描后自动设置默认模型)
  • --set-image
  • --json

models auth

bash
openclaw models auth add                          # 交互式添加认证
openclaw models auth login --provider anthropic   # OAuth/API Key 登录
openclaw models auth login-github-copilot         # GitHub Copilot OAuth
openclaw models auth setup-token --provider anthropic
openclaw models auth paste-token --provider anthropic

models auth add 是交互式认证助手,根据所选 provider 引导完成 OAuth 或 API Key 配置。

models auth order get|set|clear:管理 provider 认证档案的优先级顺序。

常见问题

Q: models status 显示 excluded_by_auth_order,是什么意思?

A: 你的认证档案存在,但 auth.order.<provider> 配置明确排除了该档案,所以不会被探测。检查 openclaw config get auth.order 确认顺序配置。

Q: 如何在多个 OpenAI 账号之间切换?

A: 使用 openclaw models auth add 添加新档案,再用 openclaw models auth order set --provider openai <profileId1> <profileId2> 设置优先级。

Q: Anthropic API Key 和 Claude 登录有什么区别?

A: API Key 按用量计费,不受订阅用量限制,生产推荐;Claude 登录路径在 OpenClaw 中属于第三方使用,需要 Extra Usage 附加套餐。

站长自营API 中转

ZZSwitch API 中转

统一接入多家模型,支持兑换码充值。