DEV Community

dtzp555-max
dtzp555-max

Posted on

Run Claude Opus 4.6 via OpenAI-compatible API using your existing Pro/Max subscription

openclaw-claude-proxy (ocp)

If you already pay $20/mo for Claude Pro or $100/mo for Claude Max, you're leaving significant value on the table every time you also pay per-token through the Anthropic API.

openclaw-claude-proxy (ocp) fixes this. It's a zero-dependency, single-file Node.js proxy that:

  • Exposes a standard OpenAI-compatible /v1/chat/completions endpoint on localhost:3456
  • Routes requests through the claude CLI using your existing OAuth session
  • Works with LangChain, Open WebUI, LlamaIndex, Cursor, or any app that speaks OpenAI
  • $0 extra cost — uses your existing subscription

Cost Comparison

Usage API Cost With ocp (Pro) With ocp (Max)
1M tokens/day $15–45 $0 extra $0 extra
10M tokens/day $150–450 $0 extra $0 extra
Monthly sub $20–100 $20 (Pro) $100 (Max)

Setup (2 commands)

git clone https://github.com/dtzp555-max/openclaw-claude-proxy
cd openclaw-claude-proxy
node setup.mjs
Enter fullscreen mode Exit fullscreen mode

No npm install needed. Auto-starts on login via launchd (macOS) or systemd (Linux).

Works With Any OpenAI Client

# LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(base_url="http://localhost:3456/v1", api_key="none", model="claude-opus-4-6")
Enter fullscreen mode Exit fullscreen mode
// OpenAI SDK
const openai = new OpenAI({ baseURL: 'http://localhost:3456/v1', apiKey: 'none' })
Enter fullscreen mode Exit fullscreen mode

Also works with: Open WebUI, LlamaIndex, Cursor, or anything with an OpenAI-compatible endpoint setting.

Multiple Agents, One Subscription

Multiple OpenClaw agents or instances can share a single Claude Pro/Max subscription through ocp — no extra API keys per agent.

Honest Trade-offs

  • Serial execution: The CLI worker pool runs requests one at a time, not in parallel. Higher latency than direct API.
  • Personal use: Best for solo workflows, local agents, and tools where you're the only user.
  • Claude CLI required: You need claude CLI installed and authenticated first.

Latest: v1.7.1

  • v1.7.0: Optional Bearer token authentication (PROXY_API_KEY env var)
  • v1.7.1: Crash recovery on network interruptions, ANTHROPIC_* env sanitization to prevent auth path pollution

Links


Feedback welcome — especially curious what use cases people find this most useful for.

Top comments (0)