360 Secure SkillHub
360 安全技能中心

OpenClaw API Control

该 Skill 提供 Node 客户端脚本,通过 OpenClaw as a Service API 操作用户自己的托管实例:列出或创建实例、发送与流式接收聊天消息、读取写入及上传文件、在实例上执行终端命令,并以 JSON 输出结果。需要用户提供 API Key,目录上传仅包含文本类文件。

fstandhartinger
fstandhartinger
热度 52.45
最近更新 2026-05-11 17:34:28
分类:自动化依赖:代码执行 / 第三方 API / 读写文件应用场景:API 集成 / 自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add openclaw-api-control
Metadata
name
openclaw-api-control
description
Control a hosted OpenClaw instance through the OpenClaw as a Service API. Use when the user asks to talk to OpenClaw over API, send a folder or file to OpenClaw, read or write files in the OpenClaw workspace, run commands on OpenClaw, list or create hosted OpenClaw instances, or wire another agent to OpenClaw using an API key.
version
0.1.1
license
MIT-0
author
fstandhartinger
env
[{"name":"OPENCLAW_API_KEY","required":true,"description":"Bearer API key created from the OpenClaw account page. Scoped to the authenticated user's instances."},{"name":"OPENCLAW_API_BASE_URL","required":false,"default":"https://openclaw-as-a-service.com/api","description":"Base URL of the OpenClaw as a Service API. Defaults to the production endpoint."},{"name":"OPENCLAW_INSTANCE_ID","required":false,"description":"Target instance ID. When omitted, the skill auto-discovers the first ready instance owned by the API key holder."}]
security
{"network":"outbound-only","data-access":"This skill reads local files when the user explicitly requests an upload\n(e.g. \"send this folder to OpenClaw\") and transmits them to the user's\nown authenticated OpenClaw instance via HTTPS. No data is sent without\nan explicit user command. All API calls require a user-provided bearer\ntoken (OPENCLAW_API_KEY) and operate only on instances owned by that user.\n"}

OpenClaw API Control

Overview

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_KEY
  • OPENCLAW_API_BASE_URL

Optional environment variables:

  • OPENCLAW_INSTANCE_ID

Defaults:

  • If OPENCLAW_API_BASE_URL is missing, use https://openclaw-as-a-service.com/api
  • If OPENCLAW_INSTANCE_ID is missing, discover a ready instance automatically

When To Use

  • “Send this folder to my OpenClaw”
  • “Upload these files into the OpenClaw workspace”
  • “Ask my OpenClaw to continue this task”
  • “Run this command on my hosted OpenClaw”
  • “Read /workspace/... from OpenClaw”
  • “Create an OpenClaw instance through the API”

Workflow

  1. Verify OPENCLAW_API_KEY is present.
  2. Use scripts/openclaw_api_client.mjs root or instances list to confirm connectivity.
  3. Resolve the target instance:
    • Prefer OPENCLAW_INSTANCE_ID
    • Otherwise pick the first ready instance from instances list
  4. Choose the right action:
    • Chat: chat send
    • Recent history: chat tail
    • Files or folders: files read, files write, files upload-tree
    • Commands: terminal exec
  5. Report the exact API action and result back to the user.

Commands

Discover API root

node scripts/openclaw_api_client.mjs root

List instances

node scripts/openclaw_api_client.mjs instances list

Create an instance

node scripts/openclaw_api_client.mjs instances create --invite-code YOUR_CODE

Send a chat message

node scripts/openclaw_api_client.mjs chat send --message "Continue the task in /workspace"

Stream a chat message

node scripts/openclaw_api_client.mjs chat send --stream --message "Narrate each step while you work"

Upload a folder into /workspace

node scripts/openclaw_api_client.mjs files upload-tree --src ./my-project --dest /workspace/my-project

Read a file

node scripts/openclaw_api_client.mjs files read --path /workspace/README.md

Run a command

node scripts/openclaw_api_client.mjs terminal exec --command "pwd && ls -la /workspace"

Notes

  • 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.
  • The helper prints JSON for machine-friendly reuse.

Resources

  • scripts/openclaw_api_client.mjs - Minimal Node client for OpenClaw API operations