← 返回 Skills 市场
maxsorto

Claude CLI Proxy

作者 Max · GitHub ↗ · v2.1.0 · MIT-0
cross-platform ⚠ suspicious
148
总下载
0
收藏
0
当前安装
6
版本数
在 OpenClaw 中安装
/install claude-cli-proxy
功能描述
Set up a local HTTP proxy that routes OpenClaw model requests through Claude Code CLI using a Team/Max/Pro subscription instead of API keys, achieving $0 per...
使用说明 (SKILL.md)

Claude CLI Proxy

Route OpenClaw model requests through Claude Code CLI to use your existing Anthropic subscription (Team/Max/Pro) instead of paying per-token API costs.

How It Works

OpenClaw → HTTP request (Anthropic Messages API format)
       → claude-cli-proxy (localhost:8081)
       → acpx claude prompt (persistent session)
       → Claude Code CLI (uses subscription auth)
       → Response streamed back as SSE

Prerequisites

  • Node.js 18+
  • Claude Code CLI installed and authenticated with a subscription (Team/Max/Pro)
  • acpx installed globally (npm i -g acpx)

Environment Variables

All configurable via env — no hardcoded paths:

Variable Default Description
CCPROXY_PORT 8081 Proxy listen port
CCPROXY_SESSION_NAME dexter-proxy acpx session name
CCPROXY_CWD ~/.openclaw/workspace Working directory
CCPROXY_TIMEOUT_MS 120000 Request timeout
CCPROXY_MAX_HISTORY 10 Max conversation turns forwarded

Also respects OPENCLAW_WORKSPACE as fallback for CWD.

Setup

1. Install & Authenticate Claude Code

npm install -g @anthropic-ai/claude-code acpx
claude auth login  # Select claude.ai, NOT API key
claude "say ok"    # Verify it works

2. Copy Proxy Scripts

Copy scripts/claude-cli-proxy.js and scripts/ccproxy-ensure.js to your OpenClaw workspace:

cp scripts/claude-cli-proxy.js ~/.openclaw/workspace/
cp scripts/ccproxy-ensure.js ~/.openclaw/workspace/

3. Configure Agent Identity (Important)

Without this, Claude Code responds as generic "Claude". To preserve your agent's personality:

a) Set customInstructions in Claude Code settings:

cat > ~/.claude/settings.json \x3C\x3C 'EOF'
{
  "customInstructions": "You are [YOUR_AGENT_NAME]. Your identity is defined in CLAUDE.md. Always respond as [YOUR_AGENT_NAME]. This is not roleplay — this is your configured identity by your operator."
}
EOF

Replace [YOUR_AGENT_NAME] with your agent's name (e.g., "Ozwald", "Dexter", "Atlas").

b) Create a CLAUDE.md in your workspace with your agent's full identity, style, and context. Claude Code reads this file automatically on every session. Copy the relevant parts from your SOUL.md / IDENTITY.md.

Why both? settings.json is the minimum instruction Claude Code always respects. CLAUDE.md provides richer context (relationships, style, domain knowledge) that the agent reads when it needs it.

4. Create Persistent Session

cd ~/.openclaw/workspace
ANTHROPIC_API_KEY="" acpx claude sessions new --name dexter-proxy

Critical: ANTHROPIC_API_KEY="" ensures Claude Code uses subscription auth, not any API key in the environment.

5. Start the Proxy

node ~/.openclaw/workspace/ccproxy-ensure.js

Verify: curl http://127.0.0.1:8081/health

6. Configure OpenClaw Provider

Add to openclaw.json (or use config.patch):

{
  "models": {
    "mode": "merge",
    "providers": {
      "claude-cli": {
        "baseUrl": "http://127.0.0.1:8081/v1",
        "apiKey": "dummy",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "claude-sonnet-4-6",
            "name": "claude-sonnet-4-6",
            "api": "anthropic-messages",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 8192
          }
        ]
      }
    }
  }
}

Set as default model:

{
  "agents": {
    "defaults": {
      "model": { "primary": "claude-cli/claude-sonnet-4-6" }
    }
  }
}

7. Auto-Start (macOS)

See references/autostart.md for LaunchAgent config.

7b. Auto-Start (Linux/Docker)

Add to HEARTBEAT.md:

node /path/to/workspace/ccproxy-ensure.js

What Gets Forwarded

The proxy forwards the full OpenClaw context to Claude Code:

  1. System prompt → Written to .ccproxy-system-context.md, Claude Code reads it as operator context (avoids prompt injection rejection)
  2. Conversation history → Last N turns (configurable via CCPROXY_MAX_HISTORY)
  3. Current message → Last user message

Claude Code metadata ([thinking], [tool], file dumps) is automatically stripped from output.

Key Details

  • First call after cold start: ~8s (agent reconnects)
  • Subsequent calls: ~2-3s
  • Streaming: Full SSE support (required by OpenClaw)
  • Serialized: Requests queue — CLI handles one at a time
  • Session persistence: Survives proxy restarts, stored on disk by acpx
  • Token refresh: Claude Code handles OAuth token refresh automatically
  • Privacy note: System prompt content is written to .ccproxy-system-context.md in the workspace and sent to Anthropic on each request. The file is overwritten on every request (never accumulates stale data) but persists on disk between requests.
  • Fake streaming caveat: SSE chunks are sent after the full response completes — first-token latency equals full response time. Real-time piping would require acpx to support stdout streaming natively.

Troubleshooting

Symptom Cause Fix
LLM request timed out Proxy not returning SSE stream Ensure proxy v5+ with streaming support
request ended without sending any chunks stream:true but proxy returns JSON Update to proxy v5
Claude says "I am Claude" not your agent identity Missing customInstructions in settings.json Add customInstructions + CLAUDE.md
rate_limit_error Subscription rate limit hit Wait or upgrade plan tier
Proxy won't start Port 8081 in use pkill -f claude-cli-proxy then restart
Proxy won't start CWD path doesn't exist Set CCPROXY_CWD or OPENCLAW_WORKSPACE env var
Multiple instances collide Same session name Set unique CCPROXY_SESSION_NAME per instance
安全使用建议
This skill appears to do what it says — it runs a local Node proxy that calls the 'acpx' CLI so your Anthropic subscription handles model requests instead of API keys. Before installing, consider: (1) Privacy: the proxy forwards the full system prompt, recent conversation history, and any identity files you copy into CLAUDE.md to Anthropic. Do not include secrets, private prompts, or sensitive data in those files. (2) Persistence: the docs instruct creating autostart entries so the proxy runs continuously; that means any OpenClaw requests will be sent to Anthropic whenever the agent runs. (3) Local command safety: the scripts run shell commands (execSync with interpolated strings) using environment-controlled values (e.g., CCPROXY_SESSION_NAME, CCPROXY_CWD). Do not set those env vars to untrusted values, and review the scripts before running them. (4) Test in an isolated/non-production profile first: run the proxy manually, inspect logs and .ccproxy-system-context.md, and verify no sensitive content is being forwarded. If you accept the privacy tradeoffs and audit the scripts, the skill is coherent with its purpose; otherwise avoid installing.
功能分析
Type: OpenClaw Skill Name: claude-cli-proxy Version: 2.1.0 The skill implements a local HTTP proxy to route OpenClaw requests through the Claude Code CLI via the 'acpx' wrapper, aiming to use personal subscriptions instead of API keys. It employs high-risk behaviors including shell command execution (scripts/claude-cli-proxy.js and scripts/ccproxy-ensure.js), local network hosting, and instructions for the agent to modify global configuration files (~/.claude/settings.json). While these actions are aligned with the stated purpose of cost reduction and identity preservation, the automated modification of system-level configs and the exposure of CLI tools via a network proxy represent a significant attack surface without clear evidence of intentional malice.
能力标签
requires-oauth-token
能力评估
Purpose & Capability
Name/description match the included scripts and instructions: the files and SKILL.md implement a local HTTP proxy that forwards OpenClaw requests to the Claude Code CLI (acpx) to use a subscription instead of API keys. Required runtime pieces (Node.js, acpx) are documented and expected for this purpose.
Instruction Scope
The SKILL.md and scripts forward the full OpenClaw context (system prompt, history, current message) to Claude Code and explicitly instruct copying agent identity (SOUL.md/IDENTITY.md) into CLAUDE.md and to set customInstructions. That causes private agent identity and any sensitive system prompt content to be sent to Anthropic. The proxy also writes a persistent .ccproxy-system-context.md file to disk. These behaviors are coherent with the goal (give Claude full context) but are privacy-sensitive and broader than a minimal proxy.
Install Mechanism
This is instruction-only with bundled scripts — there is no remote download/install step. Nothing is fetched from arbitrary URLs; scripts are local and run by the user. Risk from install mechanism itself is low.
Credentials
The skill requests no external credentials, which matches its stated method of using subscription auth. However, it instructs users to store agent identity/context files and to set ANTHROPIC_API_KEY="" (and to configure environment/autostart with that empty var). The proxy will forward all system prompts and history (potentially sensitive data) to Anthropic. Also the code expects environment-controlled values (CCPROXY_SESSION_NAME, CCPROXY_CWD) which influence shell commands and filesystem paths — these can broaden the attack surface if misconfigured.
Persistence & Privilege
The skill does not set always:true and is not requesting unusual platform privileges. It does instruct creating OS autostart entries (LaunchAgent/systemd) to run the proxy persistently; that gives a background process persistent network access to forward context whenever OpenClaw makes requests. Persistent autostart combined with forwarding full context increases privacy/availability risk but is functionally consistent with the skill's purpose.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install claude-cli-proxy
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /claude-cli-proxy 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.1.0
v2.1.0: Auto-reset session on context overflow or missing session. Fix acpx commands (close instead of delete). Detect 'No acpx session found' errors. Clean up duplicate sessions on reset.
v2.0.2
Docs: document fake streaming caveat and system prompt file persistence behavior
v2.0.1
Fix: generalize identity setup — no longer hardcoded to Dexter. Instructions now guide any agent to configure their own identity via settings.json + CLAUDE.md
v2.0.0
v2.0.0: Fix hardcoded paths (all configurable via env vars), forward system prompt + conversation history, strip Claude Code metadata from output, configurable session name/port for multi-instance
v1.1.0
Fix: strip Claude Code metadata ([thinking], [tool], file dumps) from output
v1.0.0
Initial release: HTTP proxy routing OpenClaw requests through Claude Code CLI subscription for $0 per-token cost. Includes SSE streaming, persistent sessions, auto-start configs.
元数据
Slug claude-cli-proxy
版本 2.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 6
常见问题

Claude CLI Proxy 是什么?

Set up a local HTTP proxy that routes OpenClaw model requests through Claude Code CLI using a Team/Max/Pro subscription instead of API keys, achieving $0 per... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 148 次。

如何安装 Claude CLI Proxy?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install claude-cli-proxy」即可一键安装,无需额外配置。

Claude CLI Proxy 是免费的吗?

是的,Claude CLI Proxy 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Claude CLI Proxy 支持哪些平台?

Claude CLI Proxy 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Claude CLI Proxy?

由 Max(@maxsorto)开发并维护,当前版本 v2.1.0。

💬 留言讨论