Follow-up to #12 / #13. Fixes the IDE detection failures documented in issue #12 section 9.3 (IDE detection coverage matrix). ## What was broken PR-1 fixed the OpenClaw multi-agent auth bug but left section 9 of the report (IDE detection coverage) unaddressed. Empirical testing showed the script's "Other IDEs detected" section had a 25% effective hit rate: - Cline -> grep pattern was `grep -qi cline` but the actual VSCode extension ID is `saoudrizwan.claude-dev`. Hit rate 0%. - Continue.dev -> checked `~/.continue/config.json` but the directory is not created until the user opens the Continue panel for the first time, AND v1.x uses `config.yaml` not `config.json`. Hit rate 0% on a fresh install. - Cursor -> only checked `command -v cursor` and `~/.cursor`. Both fail when the user installs Cursor.app from the official dmg without enabling the optional shell command and without launching the app. brew cask installs work by side effect (it links the binary). Hit rate 100% via brew, 0% via dmg. - opencode -> not detected at all. opencode (https://opencode.ai) is one of the most popular AI CLI tools, missing entirely from the hint list. The hints themselves were also too sparse. Each one was a single line like `Cursor: Settings -> OpenAI Base URL = ...`, with no API key, no model IDs, no path to the actual settings page. Users had to guess. ## What this commit does ### Detection rewrite (Cline / Continue.dev / Cursor / opencode) Cline: prefer `code --list-extensions`, fall back to ls, match pattern `cline|saoudrizwan\.claude-dev`. Real-world Cline detection goes from 0% to 100%. Continue.dev: three-condition OR -- VSCode extension ID `continue.continue` OR `~/.continue/config.yaml` OR `~/.continue/config.json`. Catches all three real-world install states (extension installed but never opened / config.yaml / legacy config.json). Cursor: add `[[ -d "/Applications/Cursor.app" ]]` as a third fallback alongside `command -v cursor` and `~/.cursor`. Now detects Cursor regardless of how it was installed. opencode: NEW detection branch. Checks `command -v opencode`, `~/.opencode/bin/opencode`, and `~/.local/share/opencode`. Catches the official curl install path and any future package manager installs. ### Hint density improvements Each hint now includes: - The exact base URL to paste - The API key (truncated as `${key:0:8}...${key: -4}` if longer than 16 chars to avoid screenshot leakage; or "(none -- anonymous mode)" message when --key was not provided) - The list of available model IDs, extracted from the actual /v1/models response so the user does not have to guess - The exact menu path or config file location Continue.dev hint specifically shows the YAML snippet under the `models:` top-level key (per reviewer feedback) so the user can paste it directly without schema confusion. opencode hint explicitly says "not yet auto-configured by ocp-connect (PR follow-up)" so users know to use `opencode providers login openai` until a future PR adds direct auth.json writing. opencode does NOT read OPENAI_API_KEY env var (empirically verified) so the existing rc-file export strategy does not help it. ### NOT in scope (deferred) - opencode auto-configure (writing auth.json + opencode.json) -- schema needs more investigation, opencode model whitelist gets in the way of custom claude model IDs - Continue.dev auto-configure -- v1.x config.yaml schema is well enough known but parsing/merging YAML in bash without extra dependencies is awkward - Aider, Cody, Zed, etc. detection -- not in this PR scope These are future work tracked in #12 section 9.6. ### Version bump (per dev iron rule #5) OCP_CONNECT_VERSION 1.1.0 -> 1.2.0. ## Test evidence Offline matrix run on macOS 13 with VSCode 1.115.0, opencode 1.4.3, Cline 3.78.0, Continue.dev 1.2.22, Cursor 3.0.16: - All 4 IDEs installed -> all 4 hints fire with full detail - anonymous mode -> hints fire, key display reads "(none -- anonymous mode...)" instead of blank - HOME=tmpdir mock + only Cline mock dir -> Cline + Cursor (system app) hints fire, others suppressed - HOME=tmpdir mock + nothing -> only Cursor (system app) fires - --version -> "ocp-connect 1.2.0" - --help -> still shows the PR-1 wording for item 5 Hit rate matrix on the test machine (5/5 IDEs installed): | IDE | before PR-2a | after PR-2a | |--------------|--------------|-------------| | OpenClaw | YES (PR-1) | YES | | Cline | NO | YES | | Continue.dev | NO | YES | | Cursor | YES (brew) | YES | | opencode | NO | YES | Effective detection rate: 25% -> ~100%. ## Code review One independent opus reviewer (spec compliance + bash 3.2 compat + UX). Verdict: PASS WITH CONCERNS, 0 blockers. Two non-blocking suggestions both addressed in this commit: 1. Continue.dev YAML hint -- added `models:` top-level key so pasted snippet validates against Continue v1.x schema 2. anonymous mode -- key display now shows "(none -- anonymous mode; most external IDEs require a non-empty API Key)" instead of a blank field B1 (OpenClaw per-agent auth) section is intentionally untouched. Verified by diff line count: all changes fall in lines 347-440 (configure_ides function) + lines 9-13 (version constant). No edits inside the Python heredoc block. Co-authored-by: taodeng <taodeng@Taos-MBP> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
OCP — Open Claude Proxy
Status: Stable (v3.6.0) — Feature-complete. Bug fixes only.
Already paying for Claude Pro/Max? Use your subscription as an OpenAI-compatible API — $0 extra cost.
OCP turns your Claude Pro/Max subscription into a standard OpenAI-compatible API on localhost. Any tool that speaks the OpenAI protocol can use it — no separate API key, no extra billing.
Cline ──┐
OpenCode ───┤
Aider ───┼──→ OCP :3456 ──→ Claude CLI ──→ Your subscription
Continue.dev ───┤
OpenClaw ───┘
One proxy. Multiple IDEs. All models. $0 API cost.
Supported Tools
Any tool that accepts OPENAI_BASE_URL works with OCP:
| Tool | Configuration |
|---|---|
| Cline | Settings → OPENAI_BASE_URL=http://127.0.0.1:3456/v1 |
| OpenCode | OPENAI_BASE_URL=http://127.0.0.1:3456/v1 |
| Aider | aider --openai-api-base http://127.0.0.1:3456/v1 |
| Continue.dev | config.json → apiBase: "http://127.0.0.1:3456/v1" |
| OpenClaw | setup.mjs auto-configures |
| Any OpenAI client | Set base URL to http://127.0.0.1:3456/v1 |
Installation
OCP has two roles: Server (runs the proxy, needs Claude CLI) and Client (connects to a server, zero dependencies).
┌─ Server (always-on device) ─────────────────────────────┐
│ Mac mini / NAS / Raspberry Pi / Desktop │
│ Claude CLI + OCP server → bound to 0.0.0.0:3456 │
└───────────────────────┬─────────────────────────────────┘
│ LAN
┌───────────────────┼───────────────────┐
▼ ▼ ▼
Laptop Phone/Tablet Pi / Server
(client) (browser) (client)
Server Setup
Recommended: Install OCP on a device that stays powered on — Mac mini, NAS, Raspberry Pi, or a desktop that doesn't sleep. This ensures all clients always have access.
Prerequisites:
- Node.js 18+
- Claude CLI installed and authenticated (
claude auth login)
# 1. Clone and run setup
git clone https://github.com/dtzp555-max/ocp.git
cd ocp
node setup.mjs
The setup script will:
- Verify Claude CLI is installed and authenticated
- Start the proxy on port 3456
- Install auto-start (launchd on macOS, systemd on Linux)
- Symlink
ocpto/usr/local/binfor CLI access
Single-machine use — just set your IDE to use the proxy:
export OPENAI_BASE_URL=http://127.0.0.1:3456/v1
LAN mode — share with other devices on your network:
# Enable LAN access with per-user auth (recommended)
node setup.mjs --bind 0.0.0.0 --auth-mode multi
Then create API keys for each person/device:
export OCP_ADMIN_KEY=your-secret-admin-key
ocp keys add wife-laptop
# ✓ Key created for "wife-laptop"
# API Key: ocp_xDYzOB9ZKYzn...
# Copy this key now — you won't see it again.
ocp keys add son-ipad
ocp keys add pi-server
Run ocp lan to see your IP and ready-to-share instructions.
Verify:
curl http://127.0.0.1:3456/v1/models
# Returns: claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4
Client Setup
Clients do not need to install Node.js, Claude CLI, or the OCP repo. Only
curlandpython3are required (pre-installed on most Linux/Mac systems).
One-command setup — download the lightweight ocp-connect script:
curl -fsSL https://raw.githubusercontent.com/dtzp555-max/ocp/main/ocp-connect -o ocp-connect
chmod +x ocp-connect
./ocp-connect <server-ip>
If the server requires a key, pass it with --key:
./ocp-connect <server-ip> --key <your-api-key>
Or as a one-liner (no file saved):
curl -fsSL https://raw.githubusercontent.com/dtzp555-max/ocp/main/ocp-connect | bash -s -- <server-ip>
Example:
$ ./ocp-connect 192.168.1.100
OCP Connect
─────────────────────────────────────
Remote: http://192.168.1.100:3456
Checking connectivity...
✓ Connected
Remote OCP v3.6.0 (auth: multi)
Server allows anonymous access — no key needed.
Testing API access...
✓ API accessible (3 models available)
Shell config:
✓ .bashrc
✓ .zshrc
OPENAI_BASE_URL=http://192.168.1.100:3456/v1
System-level (launchctl):
✓ OPENAI_BASE_URL set for GUI apps and daemons
IDE Configuration
─────────────────────────────────────
Detected: OpenClaw (~/.openclaw/openclaw.json)
Configure OpenClaw to use this OCP? [Y/n] y
Provider name (models show as <name>/model-id) [ocp]: ocp
How should OCP models be configured?
1) Primary — use OCP by default, keep existing models as backup
2) Backup — keep current primary, add OCP as additional option
Choice [1]: 1
✓ OpenClaw configured
Provider: ocp
Models:
• ocp/claude-opus-4-6
• ocp/claude-sonnet-4-6
• ocp/claude-haiku-4
Priority: PRIMARY (default model)
Restart OpenClaw to apply: openclaw gateway restart
Running smoke test...
✓ Smoke test passed: OK
Done. Reload your shell to apply:
source ~/.zshrc
The script automatically:
- Writes env vars to all relevant shell rc files (
.bashrc,.zshrc) - Sets system-level env vars (
launchctl setenvon macOS,environment.don Linux) - Detects and configures IDEs (OpenClaw, Cline, Continue.dev, Cursor)
On macOS, launchctl setenv vars reset on reboot — re-run ocp-connect after restart.
Manual setup — if you prefer not to use the script:
export OPENAI_BASE_URL=http://<server-ip>:3456/v1
export OPENAI_API_KEY=ocp_<your-key>
Add these lines to ~/.bashrc or ~/.zshrc to persist across sessions.
Monitoring (Server-side)
# Per-key usage stats
ocp usage --by-key
# Key Reqs OK Err Avg Time
# wife-laptop 5 5 0 8.0s
# son-ipad 3 3 0 6.2s
# Manage keys
ocp keys # List all keys
ocp keys revoke son-ipad # Revoke a key
Web Dashboard: Open http://<server-ip>:3456/dashboard in any browser for real-time monitoring — per-key usage, request history, plan utilization, and system health.
Auth Modes
| Mode | Env | Use Case |
|---|---|---|
none |
CLAUDE_AUTH_MODE=none |
Trusted home network, no auth needed |
shared |
CLAUDE_AUTH_MODE=shared + PROXY_API_KEY=xxx |
Everyone shares one key |
multi |
CLAUDE_AUTH_MODE=multi + OCP_ADMIN_KEY=xxx |
Per-person keys with usage tracking (recommended) |
Important Notes
- All users share your Claude Pro/Max rate limits (5h session + 7d weekly)
ocp usageshows how much quota remains- Keys are stored in
~/.ocp/ocp.db(SQLite, zero external dependencies) - Admin key is required for key management API endpoints
- The dashboard (
/dashboard) and health check (/health) are always public
Built-in Usage Monitoring
Check your subscription usage from the terminal:
$ ocp usage
Plan Usage Limits
─────────────────────────────────────
Current session 21% used
Resets in 3h 12m (Tue, Mar 28, 10:00 PM)
Weekly (all models) 45% used
Resets in 4d 2h (Tue, Mar 31, 12:00 AM)
Extra usage off
Model Stats
Model Req OK Er AvgT MaxT AvgP MaxP
──────────────────────────────────────────────────────
opus 5 5 0 32s 87s 42K 43K
sonnet 18 18 0 20s 45s 36K 56K
Total 23
Proxy: up 6h 32m | 23 reqs | 0 err | 0 timeout
All Commands
ocp usage Plan usage limits & model stats
ocp usage --by-key Per-key usage breakdown (LAN mode)
ocp status Quick overview
ocp health Proxy diagnostics
ocp keys List all API keys (multi mode)
ocp keys add <name> Create a new API key
ocp keys revoke <name> Revoke an API key
ocp connect <ip> One-command LAN client setup
ocp lan Show LAN connection info & IP
ocp settings View tunable settings
ocp settings <k> <v> Update a setting at runtime
ocp logs [N] [level] Recent logs (default: 20, error)
ocp models Available models
ocp sessions Active sessions
ocp clear Clear all sessions
ocp restart Restart proxy
ocp restart gateway Restart gateway
ocp update Update to latest version
ocp update --check Check for updates without applying
ocp --help Command reference
Install the CLI
# Symlink to PATH (recommended)
sudo ln -sf $(pwd)/ocp /usr/local/bin/ocp
# Verify
ocp --help
Cloud/Linux servers: If
ocp: command not found, the binary isn't in PATH. Full path:~/.openclaw/projects/ocp/ocp
Self-Update
# Check if a new version is available
ocp update --check
# Pull latest, sync plugin, restart proxy — one command
ocp update
Runtime Settings (No Restart Needed)
$ ocp settings maxPromptChars 200000
✓ maxPromptChars = 200000
$ ocp settings maxConcurrent 4
✓ maxConcurrent = 4
How It Works
Your IDE → OCP (localhost:3456) → claude -p CLI → Anthropic (via subscription)
OCP translates OpenAI-compatible /v1/chat/completions requests into claude -p CLI calls. Anthropic sees normal Claude Code usage — no API billing, no separate key needed.
Available Models
| Model ID | Notes |
|---|---|
claude-opus-4-6 |
Most capable, slower |
claude-sonnet-4-6 |
Good balance of speed/quality |
claude-haiku-4 |
Fastest, lightweight |
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/v1/models |
GET | List available models |
/v1/chat/completions |
POST | Chat completion (streaming + non-streaming) |
/health |
GET | Comprehensive health check |
/usage |
GET | Plan usage limits + per-model stats |
/status |
GET | Combined overview (usage + health) |
/settings |
GET/PATCH | View or update settings at runtime |
/logs |
GET | Recent log entries (?n=20&level=error) |
/sessions |
GET/DELETE | List or clear active sessions |
/dashboard |
GET | Web dashboard (always public) |
/api/keys |
GET/POST | List or create API keys (admin only) |
/api/keys/:id |
DELETE | Revoke an API key (admin only) |
/api/usage |
GET | Per-key usage stats (?since=&until=&hours=&limit=) |
OpenClaw Integration
OCP was originally built for OpenClaw and includes deep integration:
setup.mjsauto-configures theclaude-localprovider inopenclaw.json- Gateway plugin registers
/ocpas a native slash command in Telegram/Discord - Multi-agent — 8 concurrent requests sharing one subscription
- No conflicts — uses neutral service names (
dev.ocp.proxy/ocp-proxy) that don't trigger OpenClaw's gateway-like service detection
Install the Gateway Plugin
cp -r ocp-plugin/ ~/.openclaw/extensions/ocp/
Add to ~/.openclaw/openclaw.json:
{
"plugins": {
"allow": ["ocp"],
"entries": { "ocp": { "enabled": true } }
}
}
Restart: openclaw gateway restart
Telegram / Discord Usage
After installing the gateway plugin, use /ocp slash commands in your chat:
/ocp status — Quick overview
/ocp usage — Plan usage limits & model stats
/ocp models — Available models
/ocp health — Proxy diagnostics
/ocp keys — List all API keys (multi mode)
/ocp keys add <name> — Create a new key
/ocp keys revoke <name> — Revoke a key
Note: Terminal CLI uses
ocp <command>, Telegram/Discord uses/ocp <command>.
Troubleshooting
Requests fail or agents stuck
# Clear sessions and restart
ocp clear
ocp restart
# If using OpenClaw gateway
openclaw gateway restart
Usage shows "unknown"
Usually caused by an expired Claude CLI session. Fix:
claude auth login
ocp restart
Environment Variables
| Variable | Default | Description |
|---|---|---|
CLAUDE_PROXY_PORT |
3456 |
Listen port |
CLAUDE_BIND |
127.0.0.1 |
Bind address (0.0.0.0 for LAN access) |
CLAUDE_AUTH_MODE |
none |
Auth mode: none, shared, or multi |
OCP_ADMIN_KEY |
(unset) | Admin key for key management (multi mode) |
CLAUDE_BIN |
(auto-detect) | Path to claude binary |
CLAUDE_TIMEOUT |
600000 |
Request timeout (ms, default: 10 min) |
CLAUDE_MAX_CONCURRENT |
8 |
Max concurrent claude processes |
CLAUDE_MAX_PROMPT_CHARS |
150000 |
Prompt truncation limit (chars) |
CLAUDE_SESSION_TTL |
3600000 |
Session expiry (ms, default: 1 hour) |
CLAUDE_ALLOWED_TOOLS |
Bash,Read,...,Agent |
Comma-separated tools to pre-approve |
CLAUDE_SKIP_PERMISSIONS |
false |
Bypass all permission checks |
CLAUDE_NO_CONTEXT |
false |
Suppress CLAUDE.md and auto-memory injection (pure API mode) |
PROXY_API_KEY |
(unset) | Bearer token for shared-mode authentication |
Security
- Localhost by default — binds to
127.0.0.1; setCLAUDE_BIND=0.0.0.0to enable LAN access - 3-tier auth —
none(trusted network),shared(single key),multi(per-user keys with usage tracking) - Timing-safe key comparison — prevents timing attacks on API keys and admin keys
- Admin-only key management — creating, listing, and revoking keys requires the admin key
- Public endpoints —
/healthand/dashboardare always accessible without auth - No API keys needed — authentication goes through Claude CLI's OAuth session
- Keys stored locally —
~/.ocp/ocp.db(SQLite), never sent to external services - Auto-start — launchd (macOS) / systemd (Linux)
License
MIT
