Call a remote OpenClaw instance via its Gateway OpenAI-compatible /v1/chat/completions endpoint,
with multi-turn conversation support via x-openclaw-session-key.
通过 OpenClaw Gateway 的 OpenAI 兼容端点调用远程 OpenClaw 实例,自动处理多轮会话保持。
Variable / 变量Default / 默认值Description / 说明OC_URL``http://192.168.123.106:28789/v1/chat/completionsRemote Gateway address / 远程 Gateway 地址OC_TOKEN``87654321Auth token / 认证 TokenOC_SESSION_FILE``~/.oc_sessionSession key storage path / Session Key 存储路径
Note / 注意: Sensitive values (URL, token) should be overridden via environment variables in production. 产品环境中请通过环境变量覆盖敏感配置。
text
/oc 你的问题
用 oc 回答用 openclaw 回答oc 回答Only the x-openclaw-session-key HTTP header is used — no local history file needed.
The session key is stored in ~/.oc_session and automatically reused for subsequent calls.
仅依赖 x-openclaw-session-key HTTP header 保持会话,无需本地历史文件。
Session Key 存放在 ~/.oc_session,后续调用自动复用。
bash
python oc_call.py /clear # Clear session (delete session key) / 清除会话
python oc_call.py /new # Create new session / 新建会话
python
import subprocess
result = subprocess.run(
["python", "oc_call.py", "Your question here"],
capture_output=True, text=True,
cwd="C:\\Users\\an\\.openclaw\\workspace\\skills\\oc-call\\scripts"
)
print(result.stdout)