opencode-with-claude 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,6 +4,16 @@
4
4
 
5
5
  Use [OpenCode](https://opencode.ai) with your [Claude Max](https://claude.ai) subscription.
6
6
 
7
+ ## What this is
8
+
9
+ An [OpenCode](https://opencode.ai) plugin that runs [opencode-claude-max-proxy](https://github.com/rynfar/opencode-claude-max-proxy) for you: **start OpenCode once** and the proxy comes up with it; **quit OpenCode** and the proxy stops. No separate proxy CLI or Docker container to manage.
10
+
11
+ **Compared to running the proxy yourself:**
12
+
13
+ - **One process to think about** — OpenCode owns the proxy lifecycle (start/stop) instead of you juggling two things.
14
+ - **Several OpenCode windows at once** — each instance gets its own proxy on an OS-assigned port, so ports do not collide and you avoid session issues from sharing one proxy across instances.
15
+ - **Explicit session headers** — the plugin adds session tracking on outgoing API calls, so the proxy does not have to infer sessions from fingerprints alone.
16
+
7
17
  ## How It Works
8
18
 
9
19
  ```
@@ -14,24 +24,24 @@ Use [OpenCode](https://opencode.ai) with your [Claude Max](https://claude.ai) su
14
24
  └─────────────┘ └────────────────────┘ └─────────────────┘
15
25
  ```
16
26
 
17
- [OpenCode](https://opencode.ai) speaks the Anthropic REST API. Claude Max provides access via the [Claude Agent SDK](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) (not the REST API). The [opencode-claude-max-proxy](https://github.com/rynfar/opencode-claude-max-proxy) bridges the gap — it accepts API requests from OpenCode and translates them into Agent SDK calls using your Claude Max session.
18
-
19
27
  ## Quick Start
20
28
 
21
- There are three ways to get started: the **plugin** (recommended), the **standalone installer**, or **Docker**.
29
+ The plugin hooks into OpenCode's plugin system. When OpenCode launches, it starts the proxy, configures the Anthropic provider, and cleans everything up on exit.
22
30
 
23
- ### Option A: OpenCode Plugin (recommended)
31
+ **1. Install the plugin**
24
32
 
25
- The plugin manages the proxy lifecycle automatically — it starts the proxy when OpenCode launches, configures the Anthropic provider, and cleans up on exit. Each OpenCode instance gets its own proxy on an OS-assigned port, so multiple instances can run simultaneously without conflicts.
33
+ ```bash
34
+ npm install -g opencode-with-claude
35
+ ```
26
36
 
27
- **1. Authenticate with Claude (one-time)**
37
+ **2. Authenticate with Claude (one-time)**
28
38
 
29
39
  ```bash
30
40
  npm install -g @anthropic-ai/claude-code
31
41
  claude login
32
42
  ```
33
43
 
34
- **2. Add to your `opencode.json`**
44
+ **3. Add to your `opencode.json`**
35
45
 
36
46
  Global (`~/.config/opencode/opencode.json`) or project-level:
37
47
 
@@ -50,7 +60,7 @@ Global (`~/.config/opencode/opencode.json`) or project-level:
50
60
  }
51
61
  ```
52
62
 
53
- The `apiKey` is a dummy value — authentication goes through your Claude Max session, not an API key. The `baseURL` points to the default proxy port (3456). If that port is already in use (e.g. another opencode instance), the plugin automatically starts the proxy on a different port and overrides the `baseURL` at runtime.
63
+ > **Note:** The `apiKey` is a placeholder — authentication goes through your Claude Max session via `claude login`, not an API key. The `baseURL` is the default proxy port. If port 3456 is already in use (e.g., another OpenCode instance), the plugin automatically starts the proxy on a different port and overrides the `baseURL` at runtime.
54
64
 
55
65
  **3. Run OpenCode**
56
66
 
@@ -58,106 +68,6 @@ The `apiKey` is a dummy value — authentication goes through your Claude Max se
58
68
  opencode
59
69
  ```
60
70
 
61
- ### Option B: Standalone Installer (`oc` launcher)
62
-
63
- A one-liner that installs all dependencies and gives you the `oc` command — no config files to edit.
64
-
65
- ```bash
66
- curl -fsSL https://raw.githubusercontent.com/ianjwhite99/opencode-with-claude/main/install.sh | bash
67
- ```
68
-
69
- This installs:
70
- - [Claude Code CLI](https://www.npmjs.com/package/@anthropic-ai/claude-code) — authentication with Claude
71
- - [OpenCode](https://www.npmjs.com/package/opencode-ai) — the coding assistant
72
- - [opencode-claude-max-proxy](https://www.npmjs.com/package/opencode-claude-max-proxy) — bridges OpenCode to Claude Max
73
- - **`oc`** — launcher that ties it all together
74
-
75
- Then run:
76
-
77
- ```bash
78
- cd your-project
79
- oc
80
- ```
81
-
82
- The `oc` command starts the proxy in the background, waits for it to be ready, and launches OpenCode.
83
-
84
- ### Option C: Docker
85
-
86
- Run everything in a container with the OpenCode web UI exposed on port 4096.
87
-
88
- ```bash
89
- git clone https://github.com/ianjwhite99/opencode-with-claude.git
90
- cd opencode-with-claude
91
-
92
- # Build and start
93
- docker compose -f docker/docker-compose.yml up -d
94
-
95
- # Authenticate (first time only)
96
- docker exec -it -u opencode opencode-with-claude claude login
97
-
98
- # Open the web UI
99
- open http://localhost:4096
100
- ```
101
-
102
- The container runs the proxy and OpenCode web UI together. Your `~/workspace` directory is mounted into the container, and Claude auth, OpenCode data, and config are persisted across restarts via Docker volumes.
103
-
104
- ## Prerequisites
105
-
106
- - **Node.js >= 18** — [nodejs.org](https://nodejs.org) (or Bun/Deno) — not needed for Docker
107
- - **Claude Max subscription** — the $100/mo plan on [claude.ai](https://claude.ai)
108
-
109
- ## `oc` Launcher Reference
110
-
111
- The `oc` launcher handles everything — starts the proxy, waits for health, launches OpenCode, and cleans up on exit:
112
-
113
- ```bash
114
- oc # Start OpenCode TUI in current directory
115
- oc web # Start OpenCode web UI on port 4096
116
- oc update # Update all components to latest versions
117
- oc --help # Show help
118
- oc --version # Show component versions
119
- ```
120
-
121
- All arguments are passed through to `opencode`, so anything that works with `opencode` works with `oc`.
122
-
123
- ### Installer Options
124
-
125
- ```bash
126
- # Skip the Claude login prompt
127
- curl -fsSL ... | bash -s -- --no-auth
128
-
129
- # Don't modify shell PATH
130
- curl -fsSL ... | bash -s -- --no-modify-path
131
-
132
- # Show help
133
- curl -fsSL ... | bash -s -- --help
134
- ```
135
-
136
- ### Uninstalling
137
-
138
- Remove the `oc` launcher and clean up PATH entries:
139
-
140
- ```bash
141
- curl -fsSL https://raw.githubusercontent.com/ianjwhite99/opencode-with-claude/main/install.sh | bash -s -- --uninstall
142
- ```
143
-
144
- This removes the `oc` launcher from `~/.opencode/bin` and cleans up any PATH entries added to your shell config. To also remove the underlying tools:
145
-
146
- ```bash
147
- npm uninstall -g @anthropic-ai/claude-code opencode-ai opencode-claude-max-proxy
148
- ```
149
-
150
- ## Configuration
151
-
152
- ### Environment Variables
153
-
154
- | Variable | Default | Description |
155
- |----------|---------|-------------|
156
- | `CLAUDE_PROXY_PORT` | `3456` | Preferred port for the proxy (falls back to a random port if in use) |
157
- | `CLAUDE_PROXY_WORKDIR` | `$PWD` | Working directory for the proxy |
158
- | `OC_SKIP_AUTH_CHECK` | unset | Set to `1` to skip Claude auth check on `oc` launch |
159
- | `OC_AUTO_UPDATE` | unset | Set to `true` or `1` to auto-update components on Docker container start |
160
-
161
71
  ## Troubleshooting
162
72
 
163
73
  ### "Claude Code CLI not found"
@@ -180,19 +90,6 @@ This opens a browser for OAuth. Your Claude Max subscription credentials are nee
180
90
  2. Ensure your internet connection is working
181
91
  3. If using a manual port override, check if it's in use: `lsof -i :$CLAUDE_PROXY_PORT`
182
92
 
183
- ### Updating components
184
-
185
- ```bash
186
- # oc launcher
187
- oc update
188
-
189
- # Plugin / manual
190
- npm install -g @anthropic-ai/claude-code opencode-ai opencode-claude-max-proxy
191
-
192
- # Docker
193
- docker compose -f docker/docker-compose.yml build --no-cache && docker compose -f docker/docker-compose.yml up -d
194
- ```
195
-
196
93
  ## Development
197
94
 
198
95
  ### Project Structure
@@ -203,13 +100,6 @@ opencode-with-claude/
203
100
  │ ├── index.ts # Plugin entry point
204
101
  │ ├── proxy.ts # Proxy lifecycle management
205
102
  │ └── logger.ts # Plugin logger
206
- ├── bin/
207
- │ └── oc # Standalone launcher
208
- ├── docker/
209
- │ ├── Dockerfile # All-in-one Docker image
210
- │ ├── docker-compose.yml # Docker Compose config
211
- │ └── entrypoint.sh # Docker entrypoint
212
- ├── install.sh # curl | bash installer
213
103
  ├── test/
214
104
  │ ├── run.sh # Test runner
215
105
  │ └── opencode.json # Test config
@@ -235,27 +125,19 @@ npm run build
235
125
 
236
126
  **Do I need an Anthropic API key?**
237
127
 
238
- No. The proxy authenticates through your Claude Max subscription via `claude login`. The plugin automatically sets a dummy API key — it's never actually used for authentication.
239
-
240
- **What happens if my Claude Max subscription expires?**
241
-
242
- The proxy will fail to authenticate. Run `claude auth status` to check. You'll need an active Claude Max ($100/mo) or Claude Max with Team ($200/mo) subscription.
243
-
244
- **Plugin, `oc`, or Docker — which should I use?**
245
-
246
- The **plugin** is recommended if you already use OpenCode — it integrates with OpenCode's plugin system and requires no extra commands. Use the **`oc` launcher** if you want a one-command install from scratch or prefer not to edit config files. Use **Docker** if you want an isolated environment or want to run the web UI as a service.
128
+ No. Claude Max is not authenticated with API keys here. Run `claude login` once; the proxy uses that session (Agent SDK via OAuth). OpenCode still expects an `apiKey` field, so the plugin supplies a placeholder — it is not used for real auth.
247
129
 
248
- **Can I use this with multiple projects at the same time?**
130
+ **What if my Claude Max subscription lapses?**
249
131
 
250
- Yes. The first instance uses port 3456 by default. Additional instances automatically fall back to a random OS-assigned port, so they all work simultaneously without any extra configuration.
132
+ The proxy will fail to authenticate. Run `claude auth status`. You need an active Claude Max plan; see [claude.ai](https://claude.ai) for current options and pricing.
251
133
 
252
- **Is this the same as using the Anthropic API?**
134
+ **Can I run several OpenCode instances at once?**
253
135
 
254
- Not exactly. The proxy translates between the Anthropic REST API format and the Claude Agent SDK. From OpenCode's perspective it looks like the API, but under the hood it uses your Claude Max session. Rate limits are determined by your Claude Max subscription, not API tier limits.
136
+ Yes. The first instance uses port **3456** by default; others get a free OS-assigned port, so nothing extra to configure.
255
137
 
256
- **Why `claude login` instead of an API key?**
138
+ **Is this the same as using the Anthropic API directly?**
257
139
 
258
- Claude Max doesn't provide API access. Authentication goes through the Claude Code CLI's OAuth flow, which grants an Agent SDK session token tied to your subscription.
140
+ Not exactly. OpenCode speaks Anthropic-style HTTP to the local proxy; the proxy maps requests to the Claude Agent SDK and your Claude Max session. Usage limits follow your Max subscription, not Anthropic API billing tiers.
259
141
 
260
142
  ## Disclaimer
261
143
 
package/dist/index.d.ts CHANGED
@@ -1,15 +1,5 @@
1
1
  import { Plugin } from '@opencode-ai/plugin';
2
2
 
3
- /**
4
- * OpenCode plugin that manages the Claude Max proxy lifecycle.
5
- *
6
- * On init:
7
- * 1. Verifies the Claude CLI is installed and authenticated
8
- * 2. Starts the proxy (port 3456, or falls back to a random port if in use)
9
- * 3. Registers cleanup handlers to stop the proxy on exit
10
- * 4. Returns a `config` hook that injects the proxy's baseURL into
11
- * the Anthropic provider so each opencode instance gets its own proxy.
12
- */
13
3
  declare const ClaudeMaxPlugin: Plugin;
14
4
 
15
5
  export { ClaudeMaxPlugin };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function l(n){return(t,o)=>n.app.log({body:{service:"opencode-with-claude",level:t,message:o}})}import{startProxyServer as d}from"opencode-claude-max-proxy";var y=process.platform==="win32",f=3456;async function u(n){let{port:t=f,log:o}=n,e=console.error;console.error=(...r)=>{let a=r.map(String).join(" ");if(a.startsWith("[PROXY]")){o("debug",a);return}e.apply(console,r)};let c=async r=>{try{return await d({port:r,host:"127.0.0.1",silent:!0})}catch(a){if(r!==0&&a instanceof Error&&"code"in a&&a.code==="EADDRINUSE")return await o("info",`Port ${r} in use, starting on a random port instead...`),d({port:0,host:"127.0.0.1",silent:!0});throw a}},i;try{i=await c(t)}catch(r){throw console.error=e,r}let s=i.server.address().port;return await o("info",`Claude Max proxy running on port ${s}`),{port:s,close:async()=>{console.error=e,await i.close()}}}function g(n){let t=!1,o=()=>{t||(t=!0,n.close())};process.on("exit",o),process.on("SIGINT",o),y||process.on("SIGTERM",o)}var v=async({client:n,$:t,directory:o})=>{let e=l(n);try{await t`claude --version`}catch{throw new Error("Claude Code CLI not found. Install it with: npm install -g @anthropic-ai/claude-code")}let c;try{c=await t`claude auth status`.text()}catch{throw new Error("Failed to check Claude auth status. Run: claude login")}if(!c.includes('"loggedIn": true'))throw new Error("Claude not authenticated. Run: claude login");await e("info","Claude authentication verified");let i=parseInt(process.env.CLAUDE_PROXY_PORT||"",10)||void 0;await e("info","Starting Claude Max proxy...");let p=await u({port:i,log:e}),s=`http://127.0.0.1:${p.port}`;return await e("info",`Claude Max proxy ready at ${s}`),g(p),{async config(r){r.provider??={},r.provider.anthropic??={},r.provider.anthropic.options??={},r.provider.anthropic.options.baseURL=s,r.provider.anthropic.options.apiKey="claude-max-proxy"}}};export{v as ClaudeMaxPlugin};
1
+ function l(t){return(n,r)=>t.app.log({body:{service:"opencode-with-claude",level:n,message:r}})}import{startProxyServer as d}from"opencode-claude-max-proxy";var y=process.platform==="win32",f=3456;async function u(t){let{port:n=f,log:r}=t,a=console.error;console.error=(...e)=>{let s=e.map(String).join(" ");if(s.startsWith("[PROXY]")){r("debug",s);return}a.apply(console,e)};let p=async e=>{try{return await d({port:e,host:"127.0.0.1",silent:!0})}catch(s){if(e!==0&&s instanceof Error&&"code"in s&&s.code==="EADDRINUSE")return await r("info",`Port ${e} in use, starting on a random port instead...`),d({port:0,host:"127.0.0.1",silent:!0});throw s}},i;try{i=await p(n)}catch(e){throw console.error=a,e}let o=i.server.address().port;return await r("info",`Claude Max proxy running on port ${o}`),{port:o,close:async()=>{console.error=a,await i.close()}}}function g(t){let n=!1,r=()=>{n||(n=!0,t.close())};process.on("exit",r),process.on("SIGINT",r),y||process.on("SIGTERM",r)}var L=async({client:t,$:n,directory:r})=>{let a=l(t),p=parseInt(process.env.CLAUDE_PROXY_PORT||"",10)||void 0,i=await u({port:p,log:a}),c=`http://127.0.0.1:${i.port}`;return await a("info",`proxy ready at ${c}`),g(i),{async config(o){o.provider??={},o.provider.anthropic??={},o.provider.anthropic.options??={},o.provider.anthropic.options.baseURL=c,o.provider.anthropic.options.apiKey="claude-max-proxy"}}};export{L as ClaudeMaxPlugin};
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "opencode-with-claude",
3
3
  "description": "OpenCode plugin to use your Claude Max subscription via local proxy",
4
- "version": "1.1.6",
4
+ "version": "1.1.8",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "dependencies": {
9
- "opencode-claude-max-proxy": "^1.17.0"
9
+ "opencode-claude-max-proxy": "^1.17.1"
10
10
  },
11
11
  "devDependencies": {
12
- "@opencode-ai/plugin": "^1.3.0",
12
+ "@opencode-ai/plugin": "^1.3.2",
13
13
  "@types/node": "^25.5.0",
14
- "tsup": "^8.4.0",
14
+ "tsup": "^8.5.1",
15
15
  "typescript": "^6.0.2"
16
16
  },
17
17
  "scripts": {