DEV Community

dtzp555-max
dtzp555-max

Posted on

OCP: Turn Your Claude Pro Subscription Into a Local OpenAI-Compatible API (Now With LAN Sharing)

If you're paying $20/month for Claude Pro or Max and also spending money on API credits to power your dev tools, you're paying twice for the same thing.

OCP (Open Claude Proxy) fixes that. It runs a local server that speaks the OpenAI API protocol, backed by your existing Claude subscription — zero extra API cost.

The Core Idea

OCP translates standard OpenAI /v1/chat/completions requests into claude -p CLI calls. Any tool that respects OPENAI_BASE_URL just works — no patching, no forks, no special plugins.

Cline          ──┐
OpenCode       ───┤
Aider          ───┼──→ OCP :3456 ──→ Claude CLI ──→ Your subscription
Continue.dev   ───┤
Any OpenAI app ──┘
Enter fullscreen mode Exit fullscreen mode

Quick Start

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

The setup script verifies your Claude CLI, starts the proxy on port 3456, and installs auto-start (launchd on macOS, systemd on Linux). Then point your tool:

export OPENAI_BASE_URL=http://127.0.0.1:3456/v1
Enter fullscreen mode Exit fullscreen mode

Verify it works:

curl http://127.0.0.1:3456/v1/models
# Returns: claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4
Enter fullscreen mode Exit fullscreen mode

That's it. Cline, Aider, OpenCode, Continue.dev — anything that accepts a custom OpenAI base URL just works.

What's New in v3.4.0: LAN Mode

The headline feature: share one Claude subscription with your whole household.

One machine runs OCP, everyone on the network connects. Your partner's laptop, your kid's iPad, your homelab Pi — all using the same subscription.

Wife's laptop   ──┐
Son's iPad      ───┼──→ OCP :3456 (your Mac) ──→ Claude subscription
Your Pi server  ───┤
Your desktop    ──┘
Enter fullscreen mode Exit fullscreen mode

Three Auth Tiers

Pick the level that fits your situation:

Mode How it works Best for
none Open access on your LAN Solo homelab
shared One API key for everyone Trusted small group
multi Individual keys per user, separate tracking Family / team (recommended)

Setup LAN Mode

node setup.mjs --bind 0.0.0.0 --auth-mode multi

# Create keys for each person
ocp keys add wife-laptop
#  ✓ Key created for "wife-laptop"
#    API Key: ocp_xDYzOB9ZKYzn...

ocp keys add son-ipad

# Show your IP and ready-to-share instructions
ocp lan
Enter fullscreen mode Exit fullscreen mode

Give each person their key and two settings:

export OPENAI_BASE_URL=http://192.168.1.100:3456/v1
export OPENAI_API_KEY=ocp_<their-key>
Enter fullscreen mode Exit fullscreen mode

Per-Key Usage Tracking

Every request is logged with key, model, token counts, latency, and success. All stored in local SQLite — zero external dependencies (uses Node.js built-in node:sqlite).

ocp usage --by-key
#  Key              Reqs   OK  Err  Avg Time
#  wife-laptop         5    5    0      8.0s
#  son-ipad            3    3    0      6.2s
Enter fullscreen mode Exit fullscreen mode

Web Dashboard

Real-time monitoring at http://<your-ip>:3456/dashboard — per-key usage, request history, system health. Dark theme, auto-refresh. No login needed.

Why This Matters

The standard path for AI coding tools: subscribe to Claude Pro for the chat UI, then separately buy API credits so your tools can call the API. Two billing lines for functionally the same model access.

OCP collapses them. One subscription, used both ways. LAN Mode scales it to your whole household.

What It Doesn't Do

  • Uses claude -p (the Claude CLI), so you need it installed and authenticated
  • Rate limits still enforced by Anthropic — this doesn't bypass your plan's limits
  • Local proxy only, not a hosted service

Security

  • Localhost by default, LAN access is opt-in (CLAUDE_BIND=0.0.0.0)
  • Timing-safe key comparison for all auth modes
  • Keys stored locally in SQLite, never sent externally
  • Dashboard and health check are always public; everything else respects your auth config

GitHub: github.com/dtzp555-max/ocp

If you're already paying for Claude Pro and buying separate API credits for your dev tools, give OCP a try. Setup takes five minutes.

Top comments (0)