LogicX Skill
Interact with the LogicX platform on behalf of the user. All API calls go through the frontend proxy (/api/proxy/*). Use scripts/logicx_api.sh for every request — never write ad-hoc curl commands.
Rules
- - Only call
/api/proxy/* (or /api/health). Never call backend /v1/* directly. - Default to browser binding. Only ask for email and password if the user explicitly chooses password login.
- Confirm before any mutating call:
payment/create, payment/cancel, auth/change-password, agent/unlink. - Never echo
LOGICX_AGENT_SERVICE_KEY or LOGICX_USER_TOKEN in full. - Never infer binding, membership, order, or payment state — report API responses only.
- Summarize results in natural language unless the user asks for raw JSON.
Auth
No user token required:
- - INLINECODE12
- INLINECODE13
- INLINECODE14
- INLINECODE15
All other calls require both headers:
CODEBLOCK0
The script handles headers automatically. Built-in defaults: LOGICX_BASE_URL=http://43.139.104.95:8070, LOGICX_AGENT_SERVICE_KEY=openclaw-public.
Default Flow
- 1. If connectivity is uncertain, run
GET /api/health. - If a user token is needed and none exists, start browser binding (see below).
- After login, verify with
GET user/. - Run the requested action.
Login: Browser Binding (Default)
CODEBLOCK1
The script auto-saves link_code and install_id to ~/.config/logicx/skill-state.json.
Reply to the user:
CODEBLOCK2
When the user says they have finished, run:
CODEBLOCK3
Interpret the response:
- -
pending — browser authorization not complete yet; ask the user to confirm and try again - INLINECODE24 — ask whether to restart binding
- INLINECODE25 — token saved automatically; verify with INLINECODE26
If the script fails with "No bind state found", restart with agent/link/start.
Login: Password (Fallback)
Only when the user explicitly chooses not to use the browser flow.
CODEBLOCK4
Rate limit: 5 attempts per 15 minutes per IP + email. On 429, tell the user to wait before retrying.
After success, verify:
CODEBLOCK5
Common Calls
CODEBLOCK6
Error Handling
- -
Agent service key required / Unauthorized — the backend may not have enabled the public key yet; ask the user to try again later or contact LogicX support - INLINECODE31 on login — rate limit hit; wait 15 minutes
- Auth failure on user-scoped calls — clear the saved token and restart binding
References
- -
references/api-reference.md — full endpoint specs - INLINECODE33 — example dialogues
LogicX 技能
代表用户与 LogicX 平台进行交互。所有 API 调用均通过前端代理(/api/proxy/*)进行。每次请求都使用 scripts/logicx_api.sh——切勿编写临时的 curl 命令。
规则
- - 仅调用 /api/proxy/(或 /api/health)。切勿直接调用后端 /v1/。
- 默认使用浏览器绑定。仅当用户明确选择密码登录时才询问邮箱和密码。
- 在执行任何变更操作前需确认:payment/create、payment/cancel、auth/change-password、agent/unlink。
- 切勿完整输出 LOGICXAGENTSERVICEKEY 或 LOGICXUSER_TOKEN。
- 切勿推断绑定、会员、订单或支付状态——仅报告 API 响应。
- 除非用户要求原始 JSON,否则以自然语言总结结果。
认证
无需用户令牌:
- - GET /api/health
- POST agent/link/start
- POST agent/link/status
- POST agent/auth/login
所有其他调用都需要以下两个请求头:
Authorization: Bearer AGENTSERVICE_KEY>
X-LogicX-User-Token: USERTOKEN>
脚本会自动处理请求头。内置默认值:LOGICXBASEURL=http://43.139.104.95:8070、LOGICXAGENTSERVICE_KEY=openclaw-public。
默认流程
- 1. 如果连接状态不确定,运行 GET /api/health。
- 如果需要用户令牌但不存在,则启动浏览器绑定(见下文)。
- 登录后,通过 GET user/ 进行验证。
- 执行请求的操作。
登录:浏览器绑定(默认)
bash
{baseDir}/scripts/logicxapi.sh POST agent/link/start {installid:openclaw-main}
脚本会自动将 linkcode 和 installid 保存到 ~/.config/logicx/skill-state.json。
回复用户:
你可以点击以下链接登录并完成授权:
登录完成后请回来告诉我一声,比如直接回复我登录好了。
如果你不想跳转浏览器,也可以直接把用户名和密码告诉我,我可以直接帮你登录。
当用户表示已完成时,运行:
bash
{baseDir}/scripts/checklinkstatus.sh
解读响应:
- - pending——浏览器授权尚未完成;请用户确认后重试
- expired——询问是否重新启动绑定
- confirmed——令牌已自动保存;通过 GET user/ 进行验证
如果脚本返回未找到绑定状态,则使用 agent/link/start 重新启动。
登录:密码(备用)
仅当用户明确选择不使用浏览器流程时使用。
bash
{baseDir}/scripts/logicx_api.sh POST agent/auth/login \
{email:user@example.com,password:secret,install_id:openclaw-main}
速率限制:每 15 分钟每个 IP 和邮箱组合最多 5 次尝试。如果收到 429,请告知用户等待后重试。
成功后,进行验证:
bash
{baseDir}/scripts/logicx_api.sh GET user/
常用调用
bash
健康检查
{baseDir}/scripts/logicx_api.sh GET /api/health
账户
{baseDir}/scripts/logicx_api.sh GET user/
订单
{baseDir}/scripts/logicx_api.sh GET payment/orders
{baseDir}/scripts/logicx
api.sh GET payment/orders/ORDERNO
支付(调用前需确认)
{baseDir}/scripts/logicx
api.sh POST payment/create {plan:promonthly,gateway:mock}
{baseDir}/scripts/logicx
api.sh POST payment/cancel {orderNo:ORDERNO}
修改密码(调用前需确认)
{baseDir}/scripts/logicx_api.sh POST auth/change-password {currentPassword:old,newPassword:new-min-8}
解绑设备(调用前需确认)
{baseDir}/scripts/logicx
api.sh POST agent/unlink {installid:INSTALL_ID}
错误处理
- - 需要代理服务密钥 / 未授权——后端可能尚未启用公钥;请用户稍后重试或联系 LogicX 支持
- 登录时出现 429——触发速率限制;等待 15 分钟
- 用户相关调用认证失败——清除已保存的令牌并重新启动绑定
参考资料
- - references/api-reference.md——完整端点规范
- examples.md——示例对话