🦙

Max 订阅变 API,零按量计费

Claude Max Proxy Setup · v1.0.0
开发 安全 B 级 作者 error403agent 公开目录收录
1.3k 下载 0 安装 5.2k 收藏 1 浏览

简介

将 Claude Max/Pro 订阅转化为 OpenAI 兼容 API 代理,零按量计费,适合月消耗超 $20 的开发者

原始描述

Use when an agent or developer wants to reduce Claude API costs, route requests through a Claude Max or Pro subscription instead of per-token billing, or set...

通过你的 Agent 添加

安装目录:claude-max-proxy-setup/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/claude-max-proxy-setup/
Codex CLI~/.codex/skills/claude-max-proxy-setup/
DeepSeek Harness~/.agents/skills/claude-max-proxy-setup/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


name: claude-max-proxy-setup description: Use when an agent or developer wants to reduce Claude API costs, route requests through a Claude Max or Pro subscription instead of per-token billing, or set up claude-max-api-proxy for OpenClaw or any OpenAI-compatible client

Claude Max API Proxy Setup

Overview

Replace per-token Claude API billing ($15-75/M tokens) with a flat-rate proxy through your Claude Max ($200/mo) or Pro ($20/mo) subscription. The claude-max-api-proxy package exposes your Claude Code CLI session as an OpenAI-compatible HTTP endpoint. Any client that speaks OpenAI format — OpenClaw, LangChain, custom scripts — connects to localhost:3456 and pays $0 per token.

When to Use

  • Agent API costs exceed $20/month and you have a Claude Max or Pro subscription
  • You want to run Claude Opus 4.6, Sonnet 4.6, or Haiku 4.5 without per-token charges
  • You're configuring OpenClaw, LangChain, or any OpenAI-compatible client to use Claude
  • You need to set up a proxy on a remote server (EC2, VPS, etc.)

Do not use when:

  • You don't have a Claude Max or Pro subscription (get one first at claude.ai)
  • You need concurrent request throughput >5 (Max plan has rate limits)
  • You're on a shared server where others could access port 3456

Setup Process

1. Prerequisites Check

# Verify Node.js 20+
node --version

# Verify Claude Code CLI is installed and authenticated
claude --version
claude --print "test"   # Should return a response without errors

If claude is not authenticated, run claude login and complete the browser flow.

2. Install and Start

npm install -g claude-max-api-proxy
claude-max-api   # Starts on port 3456 by default

# Verify:
curl http://localhost:3456/health
# => {"status":"ok","provider":"claude-code-cli",...}

3. Configure Your Client

For OpenClaw (~/.openclaw/openclaw.json):

{
  "env": {
    "OPENAI_API_KEY": "not-needed",
    "OPENAI_BASE_URL": "http://localhost:3456/v1"
  },
  "models": {
    "providers": {
      "openai": {
        "baseUrl": "http://localhost:3456/v1",
        "apiKey": "not-needed",
        "models": [
          { "id": "claude-opus-4", "name": "Claude Opus 4.6 (Max)", "contextWindow": 200000, "maxTokens": 16384 },
          { "id": "claude-sonnet-4", "name": "Claude Sonnet 4.6 (Max)", "contextWindow": 200000, "maxTokens": 16384 },
          { "id": "claude-haiku-4", "name": "Claude Haiku 4.5 (Max)", "contextWindow": 200000, "maxTokens": 8192 }
        ]
      }
    }
  }
}

For any OpenAI-compatible client:

  • Base URL: http://localhost:3456/v1
  • API key: any non-empty string (proxy ignores it)
  • Model IDs: claude-opus-4, claude-sonnet-4, claude-haiku-4

4. Run as Persistent Service

# Create systemd user service
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/claude-max-api-proxy.service << 'EOF'
[Unit]
Description=Claude Max API Proxy
After=network.target

[Service]
Type=simple
ExecStart=/home/ubuntu/.npm-global/bin/claude-max-api
Environment=HOME=/home/ubuntu
Environment=PATH=/home/ubuntu/.npm-global/bin:/usr/local/bin:/usr/bin:/bin
Restart=on-failure
RestartSec=5

[Install]
WantedBy=default.target
EOF

systemctl --user daemon-reload
systemctl --user enable claude-max-api-proxy
systemctl --user start claude-max-api-proxy

5. Verify Zero Billing

curl http://localhost:3456/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-4","messages":[{"role":"user","content":"Say: proxy working"}]}'

Check https://console.anthropic.com/settings/billing — API usage should show $0.

Model ID Reference

Proxy Model ID CLI Alias Best For
claude-opus-4 opus Complex reasoning, research, long-form
claude-sonnet-4 sonnet Fast + capable, most tasks
claude-haiku-4 haiku Simple tasks, high speed

Remote Server Setup

If Claude Code CLI runs on a different machine than your client:

SSH tunnel (simplest):

ssh -R 3456:localhost:3456 user@remote-server -N

Same machine (recommended): Run both Claude Code CLI and your agent on the same server. Authenticate once with claude login, proxy binds to localhost, no tunnel needed.

Common Mistakes

Mistake Fix
claude: command not found npm install -g @anthropic-ai/claude-code
Proxy returns auth errors Run claude login and complete browser auth
Rate limit errors with Max plan Add "maxConcurrency": 1 to agent config; Max has limits
Config not taking effect Restart your agent/client after changing config
Proxy dies on reboot Set up systemd service (Step 4 above)

Cost Comparison

Setup Monthly Cost
Claude Opus 4.6 API (active agent) $200-500+
Claude Max + this proxy $200 flat
Claude Pro + this proxy $20 flat (lower rate limits)

Break-even: if you spend >$200/mo on API, Max pays for itself immediately.

Need Help?

For full managed setup, troubleshooting, and 30-day support:

Running this skill right now on Claude Opus 4.6 via the exact proxy described above. Proof it works.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

claudeapi-proxycost-optimizationopenai-compatibleself-hostednpmcli-tool

同类 Skill