gateway
OpenSquilla 的 gateway 是 Web UI、channels、RPC 客户端、sessions、审批、诊断和用量视图背后的本地服务器。OpenSquilla 的大多数日常使用界面都在 gateway 运行时才能发挥最佳效果。
当你需要启动、停止、查看、对外暴露或排障 gateway 时,请参考本页。
前台 gateway
在当前终端中运行 gateway:
opensquilla gateway run
打开控制台:
http://127.0.0.1:18791/control/
使用 Ctrl+C 停止前台 gateway。
托管的后台 gateway
启动一个托管的后台进程并等待其就绪:
opensquilla gateway start --json
查看其状态:
opensquilla gateway status
opensquilla gateway status --json
重启或停止:
opensquilla gateway restart
opensquilla gateway stop
对于 Web UI、channels、调度任务以及需要在当前终端标签关闭后仍然存活的本地自动化,请使用托管 gateway。
主机和端口
使用其他端口:
opensquilla gateway run --port 18792
opensquilla gateway status --port 18792
绑定到指定主机:
opensquilla gateway run --listen 127.0.0.1 --port 18791
--listen 是绑定主机的别名,当同时提供 --bind 时,--listen 优先生效。
安全默认值
gateway 默认采用环回作用域,通常是 127.0.0.1,因为本地 gateway 控制着聊天、工具、sessions、channels、审批和配置。
公开绑定需要显式启用:
opensquilla gateway run --listen 0.0.0.0 --port 18791
请勿在没有 token 认证和你能掌握的网络边界的情况下,将 gateway 暴露到不受信任的网络中。
配置文件路径
使用指定配置文件:
opensquilla gateway run --config /path/to/opensquilla.toml
opensquilla gateway status --config /path/to/opensquilla.toml
OpenSquilla 还会读取 configuration.md 中所述的标准配置位置。
远程状态检查
直接查看一个 gateway URL:
opensquilla gateway status --gateway ws://localhost:18791/ws
当客户端或 MCP 桥接器配置了显式的 gateway URL 时,这一点很有用。
何时需要重启
修改以下内容后请重启 gateway:
- provider 或 router 配置;
- channel 配置;
- 持久化 agent 条目;
- 全局 sandbox 策略;
- 搜索或图像生成相关设置;
- 已配置 provider 使用的环境变量。
opensquilla gateway restart
排障
检查状态和就绪性:
opensquilla gateway status
opensquilla doctor
如果端口被占用:
opensquilla gateway run --port 18792
如果 Web UI 无法连接,请确认其 URL 与 gateway 的绑定主机和端口一致。
继续阅读: