From 6d0e43ec3760fe4264fb2692f41f13dc46677d4c Mon Sep 17 00:00:00 2001 From: dtzp555 Date: Sat, 11 Apr 2026 13:42:00 +1000 Subject: [PATCH] fix: ocp-connect tries anonymous access before requiring key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In zero-config auth mode, the server allows anonymous access even in multi mode. The script now probes /v1/models first — if it succeeds, no key is needed. Also updated README examples and version to 3.5.1. Co-Authored-By: Claude Opus 4.6 --- README.md | 16 +++++++++++----- ocp-connect | 22 ++++++++++++++-------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 068c908..cfef64a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OCP — Open Claude Proxy -> **Status: Stable (v3.5.0)** — Feature-complete. Bug fixes only. +> **Status: Stable (v3.5.1)** — Feature-complete. Bug fixes only. > **Already paying for Claude Pro/Max? Use your subscription as an OpenAI-compatible API — $0 extra cost.** @@ -111,17 +111,22 @@ curl http://127.0.0.1:3456/v1/models ```bash curl -fsSL https://raw.githubusercontent.com/dtzp555-max/ocp/main/ocp-connect -o ocp-connect chmod +x ocp-connect +./ocp-connect +``` + +If the server requires a key, pass it with `--key`: +```bash ./ocp-connect --key ``` Or as a one-liner (no file saved): ```bash -curl -fsSL https://raw.githubusercontent.com/dtzp555-max/ocp/main/ocp-connect | bash -s -- --key +curl -fsSL https://raw.githubusercontent.com/dtzp555-max/ocp/main/ocp-connect | bash -s -- ``` Example: ``` -$ ./ocp-connect 192.168.1.100 --key ocp_xDYzOB9ZKYzn +$ ./ocp-connect 192.168.1.100 OCP Connect ───────────────────────────────────── @@ -130,14 +135,15 @@ OCP Connect Checking connectivity... ✓ Connected - Remote OCP v3.5.0 (auth: multi) + Remote OCP v3.5.1 (auth: multi) + + Server allows anonymous access — no key needed. Testing API access... ✓ API accessible (3 models available) Written to /home/user/.bashrc: OPENAI_BASE_URL=http://192.168.1.100:3456/v1 - OPENAI_API_KEY=ocp_xDYz... Running smoke test... ✓ Smoke test passed: OK diff --git a/ocp-connect b/ocp-connect index 65c6d72..1446d43 100755 --- a/ocp-connect +++ b/ocp-connect @@ -103,15 +103,21 @@ main() { # Step 3: Determine if key is needed if [[ "$auth_mode" != "none" && -z "$key" ]]; then - echo " Remote requires authentication." - echo " Ask the OCP admin to run: ocp keys add " - printf " Enter API key (or press Enter to skip): " - read -rs key /dev/null 2>&1; then + echo " Server allows anonymous access — no key needed." echo "" - echo " ✗ No key provided — cannot connect to an auth-required remote without a key." - exit 1 + else + echo " Remote requires authentication." + echo " Ask the OCP admin to run: ocp keys add " + printf " Enter API key (or press Enter to skip): " + read -rs key