Use the hosted OpenClaw API instead of the browser UI when an agent should operate an existing OpenClaw instance directly.
Required environment variables:
OPENCLAW_API_KEYOPENCLAW_API_BASE_URLOptional environment variables:
OPENCLAW_INSTANCE_IDDefaults:
OPENCLAW_API_BASE_URL is missing, use https://openclaw-as-a-service.com/apiOPENCLAW_INSTANCE_ID is missing, discover a ready instance automatically/workspace/... from OpenClaw”OPENCLAW_API_KEY is present.scripts/openclaw_api_client.mjs root or instances list to confirm connectivity.OPENCLAW_INSTANCE_IDready instance from instances listchat sendchat tailfiles read, files write, files upload-treeterminal execnode scripts/openclaw_api_client.mjs root
node scripts/openclaw_api_client.mjs instances list
node scripts/openclaw_api_client.mjs instances create --invite-code YOUR_CODE
node scripts/openclaw_api_client.mjs chat send --message "Continue the task in /workspace"
node scripts/openclaw_api_client.mjs chat send --stream --message "Narrate each step while you work"
/workspacenode scripts/openclaw_api_client.mjs files upload-tree --src ./my-project --dest /workspace/my-project
node scripts/openclaw_api_client.mjs files read --path /workspace/README.md
node scripts/openclaw_api_client.mjs terminal exec --command "pwd && ls -la /workspace"
files upload-tree only uploads text-like files and skips likely binary files.chat tail automatically reuses the latest chat session when no session id is supplied.scripts/openclaw_api_client.mjs - Minimal Node client for OpenClaw API operations共 1 个版本