Appearance
openclaw tui 是终端 UI 命令,可连接远程 Gateway 或本地直接启动智能体。使用 --url 指定 WebSocket 地址,--token 或 --password 认证;本地模式用 --local 或别名 openclaw chat,不会绕过配置校验。支持 --session 切换会话、--deliver 通过渠道投递回复、--timeout-ms 和 --history-limit 调参。在工作区目录内自动选择对应智能体。注意 --local 不能与 --url/--token/--password 混用。
openclaw tui:终端 UI 怎么连接 Gateway 或本地运行
打开连接到 Gateway 的终端 UI,或直接使用本地嵌入式智能体运行时。
相关文档:
- TUI 使用指南:TUI
选项
| 标志 | 默认值 | 描述 |
|---|---|---|
--local | false | 针对本地嵌入式智能体运行,不连接 Gateway。 |
--url <url> | 配置项 gateway.remote.url | Gateway WebSocket URL。 |
--token <token> | 无 | Gateway token(如果要求)。 |
--password <pass> | 无 | Gateway 密码(如果要求)。 |
--session <key> | main(全局作用域时为 global) | 会话 key。在智能体工作区目录内自动选择该智能体,除非加前缀。 |
--deliver | false | 将助手回复通过已配置的渠道投递。 |
--thinking <level> | 模型默认值 | 思维链等级覆盖。 |
--message <text> | 无 | 连接后发送的初始消息。 |
--timeout-ms <ms> | agents.defaults.timeoutSeconds | 智能体超时时间。无效值会输出警告并忽略。 |
--history-limit <n> | 200 | 连接时加载的历史记录条数。 |
别名:openclaw chat 和 openclaw terminal 会以隐含 --local 的方式执行相同命令。
补充说明:
chat和terminal是openclaw tui --local的别名。--local不能与--url、--token、--password同时使用。tui在可能的情况下解析配置中 Gateway 认证的 SecretRef(支持env/file/exec提供方),自动完成 token/密码认证。- 如果在某个智能体工作区目录内启动,TUI 会自动将该智能体设为会话 key 的默认值(除非通过
--session显式指定agent:<id>:...格式)。 - 本地模式直接使用嵌入式智能体运行时。大部分本地工具可用,但 Gateway 专属功能不可用。
- 本地模式在 TUI 内部命令界面增加
/auth [provider]。 - 插件审批门控在本地模式下仍然生效。需要审批的工具会在终端中提示用户决策;不会因为不涉及 Gateway 而静默自动批准。
示例
bash
openclaw chat
openclaw tui --local
openclaw tui
openclaw tui --url ws://127.0.0.1:18789 --token <token>
openclaw tui --session main --deliver
openclaw chat --message "Compare my config to the docs and tell me what to fix"
# 在智能体工作区目录内运行时,自动推断对应智能体
openclaw tui --session bugfix配置修复循环
当当前配置已验证通过,希望嵌入式智能体检查配置、对比文档并从同一终端修复时,使用本地模式:
如果 openclaw config validate 已经失败,请先使用 openclaw configure 或 openclaw doctor --fix。openclaw chat 不会绕过无效配置的防护。
bash
openclaw chat然后在 TUI 内部执行:
text
!openclaw config file
!openclaw docs gateway auth token secretref
!openclaw config validate
!openclaw doctor应用针对性的修复时使用 openclaw config set 或 openclaw configure,然后重新运行 openclaw config validate。详见 TUI 和 Config。
相关文档
常见问题
openclaw tui 报错连不上 Gateway 怎么办?
检查 --url 是否指向正确的 WebSocket 地址(格式 ws://host:port),是否需要 --token 或 --password。如果已在 Gateway 目录下运行,tui 会自动读取配置中的 gateway.remote.url 和 SecretRef。如果只想测试本地智能体,使用 --local 或 openclaw chat 即可绕过 Gateway。
--local 和 --url 能一起用吗?
不能。--local 隐含不使用 Gateway,会忽略 --url、--token、--password。如果同时指定,tui 会报错或忽略多余参数。建议只选择一种模式。
怎么在工作区目录内自动选择智能体?
在 openclaw 智能体工作区目录下运行 openclaw tui 时,会话默认会选用该目录对应的智能体。如果想覆盖,用 --session agent:<id>:... 显式指定。