You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-28Lines changed: 14 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ docker compose exec proxy claude login
97
97
curl http://127.0.0.1:3456/health
98
98
```
99
99
100
-
> **Note:** On macOS, `claude login` must be run inside the container (keychain credentials can't be mounted). On Linux, volume-mounting `~/.claude` may work without re-login.
100
+
> **Note:** On macOS, use `./bin/docker-auth.sh` to copy host credentials into the container (handles the keychain/scopes format difference). On Linux, volume-mounting `~/.claude` may work directly.
Each terminal gets its own proxy on a random port. No port conflicts, no concurrency crashes. The proxy starts automatically, connects OpenCode, and cleans up when you exit. Sessions resume across terminals via a shared session file.
110
+
Each terminal gets its own proxy on a random port. Proxy starts automatically, connects OpenCode, and cleans up on exit. Sessions resume across terminals via a shared file store.
111
111
112
-
Add to your shell config for easy access:
112
+
Shell alias:
113
113
114
114
```bash
115
115
# ~/.zshrc or ~/.bashrc
@@ -118,7 +118,7 @@ alias oc='/path/to/opencode-claude-max-proxy/bin/oc.sh'
118
118
119
119
#### Shared Proxy
120
120
121
-
If you prefer a single long-running proxy:
121
+
For a single long-running proxy:
122
122
123
123
```bash
124
124
# Terminal 1: start the proxy
@@ -128,11 +128,11 @@ CLAUDE_PROXY_PASSTHROUGH=1 bun run proxy
The `ANTHROPIC_API_KEY` can be any non-empty string — the proxy doesn't use it. Authentication is handled by your `claude login` session.
131
+
`ANTHROPIC_API_KEY` can be any non-empty string. Authentication is handled by `claude login`.
132
132
133
133
#### OpenCode Desktop / Config File
134
134
135
-
For OpenCode Desktop (or to avoid env vars), add the proxy to `~/.config/opencode/opencode.json`. Start the shared proxy in the background and Desktop connects automatically.
135
+
Set the proxy URL in `~/.config/opencode/opencode.json` to use with Desktop or avoid env vars.
136
136
137
137
```json
138
138
{
@@ -147,7 +147,7 @@ For OpenCode Desktop (or to avoid env vars), add the proxy to `~/.config/opencod
147
147
}
148
148
```
149
149
150
-
> **Tip:** Use the shared proxy with the supervisor for Desktop:`CLAUDE_PROXY_PASSTHROUGH=1 bun run proxy`. Both Desktop and terminal instances share sessions via the file store.
150
+
> Desktop requires the shared proxy on a fixed port. Run`CLAUDE_PROXY_PASSTHROUGH=1 bun run proxy` in the background. Sessions are shared between Desktop and terminal instances.
151
151
152
152
## Modes
153
153
@@ -191,15 +191,11 @@ In internal mode, a `PreToolUse` hook fuzzy-matches agent names as a safety net
191
191
192
192
## Session Resume
193
193
194
-
The proxy tracks SDK session IDs and resumes conversations on follow-up requests:
194
+
The proxy tracks SDK session IDs and resumes conversations on follow-up requests. Sessions are stored in `~/.cache/opencode-claude-max-proxy/sessions.json`, shared across all proxy instances (including per-terminal proxies).
195
195
196
-
-**Faster responses** — no re-processing of conversation history
197
-
-**Better context** — the SDK remembers tool results from previous turns
198
-
-**Works across terminals** — sessions are shared via a file store at `~/.cache/opencode-claude-max-proxy/sessions.json`
196
+
Lookup order:
199
197
200
-
Session tracking works two ways:
201
-
202
-
1.**Header-based** (recommended) — Add the included OpenCode plugin:
198
+
1.**Header-based** — add the included OpenCode plugin to inject session headers:
203
199
204
200
```json
205
201
{
@@ -209,9 +205,9 @@ Session tracking works two ways:
209
205
}
210
206
```
211
207
212
-
2.**Fingerprint-based** (automatic fallback) — hashes the first user message to identify returning conversations
208
+
2.**Fingerprint-based** (automatic fallback) — hashes the first user message to match returning conversations
213
209
214
-
Sessions are cached for 24 hours. When using per-terminal proxies (`oc.sh`), the shared file store ensures a session started in one terminal can be resumed from another.
210
+
Sessions expire after 24 hours.
215
211
216
212
## Configuration
217
213
@@ -226,19 +222,9 @@ Sessions are cached for 24 hours. When using per-terminal proxies (`oc.sh`), the
226
222
227
223
## Concurrency
228
224
229
-
**Per-terminal proxies (`oc.sh`)** are the recommended approach for multiple terminals. Each OpenCode instance gets its own proxy — no concurrency issues at all.
230
-
231
-
**Shared proxy** supports concurrent requests but has a known limitation:
225
+
Per-terminal proxies (`oc.sh`) avoid concurrency issues entirely. Each terminal gets its own proxy.
232
226
233
-
> **⚠️ Known Issue: Bun SSE Crash ([oven-sh/bun#17947](https://github.com/oven-sh/bun/issues/17947))**
234
-
>
235
-
> The Claude Agent SDK's `cli.js` subprocess (compiled with Bun) has a known segfault during cleanup of concurrent streaming responses.
236
-
>
237
-
> -**All responses are delivered correctly** — the crash only occurs after responses complete
238
-
> -**The supervisor auto-restarts** in ~1-3 seconds
239
-
> -**Per-terminal proxies avoid this entirely** — no concurrency, no crash
240
-
>
241
-
> We are monitoring the upstream Bun issue for a fix.
227
+
The shared proxy supports concurrent requests but the SDK's `cli.js` subprocess (compiled with Bun) can segfault during stream cleanup ([oven-sh/bun#17947](https://github.com/oven-sh/bun/issues/17947)). Responses are always delivered correctly; the crash occurs after completion. The supervisor auto-restarts within a few seconds.
0 commit comments