opencode-openai-multi-auth 5.0.0 → 5.0.1

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.
Files changed (2) hide show
  1. package/README.md +145 -81
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,70 +1,149 @@
1
1
  ![Image 1: opencode-openai-multi-auth](assets/readme-hero.svg)
2
2
 
3
- **Maintained by [ZenysTX](https://x.com/zenysTX)**
4
- **Most of the work and original implementation by [Numman Ali](https://x.com/nummanali)**
5
- **Inspired by [opencode-google-antigravity-auth](https://github.com/shekohex/opencode-google-antigravity-auth)**
6
- [![Twitter Follow](https://img.shields.io/twitter/follow/zenysTX?style=social)](https://x.com/zenysTX)
3
+ [![npm version](https://img.shields.io/npm/v/opencode-openai-multi-auth.svg)](https://www.npmjs.com/package/opencode-openai-multi-auth)
4
+ [![Tests](https://github.com/dkraemerwork/opencode-openai-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/dkraemerwork/opencode-openai-multi-auth/actions)
5
+ [![npm downloads](https://img.shields.io/npm/dm/opencode-openai-multi-auth.svg)](https://www.npmjs.com/package/opencode-openai-multi-auth)
7
6
 
7
+ # Multi-Account ChatGPT OAuth for OpenCode
8
8
 
9
+ **Use multiple ChatGPT Plus/Pro personal or organization accounts with OpenCode. Never hit rate limits again.**
9
10
 
11
+ ```
12
+ ┌────────────────────────────────────────────────────────────────┐
13
+ │ │
14
+ │ Account 1 (rate limited) ──┐ │
15
+ │ Account 2 (rate limited) ──┼──► Auto-rotate ──► Keep coding │
16
+ │ Account 3 (available) ─────┘ │
17
+ │ │
18
+ └────────────────────────────────────────────────────────────────┘
19
+ ```
10
20
 
21
+ ## Why Multi-Account?
11
22
 
12
- [![Twitter Follow](https://img.shields.io/twitter/follow/nummanali?style=social)](https://x.com/nummanali)
13
- [![npm version](https://img.shields.io/npm/v/opencode-openai-multi-auth.svg)](https://www.npmjs.com/package/opencode-openai-multi-auth)
14
- [![Tests](https://github.com/dkraemerwork/opencode-openai-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/dkraemerwork/opencode-openai-multi-auth/actions)
15
- [![npm downloads](https://img.shields.io/npm/dm/opencode-openai-multi-auth.svg)](https://www.npmjs.com/package/opencode-openai-multi-auth)
16
- **One install. Every Codex model. Multi-account ready.**
17
- [Install](#-quick-start) · [Models](#-models) · [Configuration](#-configuration) · [Docs](#-docs)
23
+ | Problem | Solution |
24
+ |---------|----------|
25
+ | Hit ChatGPT rate limits while coding | Add multiple accounts, auto-rotate when limited |
26
+ | Team members share one subscription | Each person adds their own account |
27
+ | Different orgs have separate subscriptions | Use accounts from multiple organizations |
28
+ | One account gets throttled | Seamlessly switch to next available account |
18
29
 
19
30
  ---
20
31
 
21
- ## 💡 Philosophy
32
+ ## Quick Start
22
33
 
23
- > **"One config. Every model."**
24
- > OpenCode should feel effortless. This plugin keeps the setup minimal while giving you full GPT‑5.x + Codex access via ChatGPT OAuth across multiple accounts
25
- > from different organizations.
34
+ ```bash
35
+ # Install
36
+ npx -y opencode-openai-multi-auth@latest
26
37
 
27
- ```
28
- ┌─────────────────────────────────────────────────────────┐
29
- │ │
30
- │ ChatGPT OAuth → Codex backend → OpenCode │
31
- │ One command install, full model presets, done. │
32
- │ │
33
- └─────────────────────────────────────────────────────────┘
38
+ # Add your first account
39
+ opencode auth login
40
+ # Select "ChatGPT Plus/Pro (Codex Subscription)"
41
+
42
+ # Add more accounts (optional but recommended)
43
+ opencode auth login
44
+ # Select "Add Another OpenAI Account"
45
+
46
+ # Start coding - accounts rotate automatically on rate limits
47
+ opencode run "write hello world to test.txt" --model=openai/gpt-5.2 --variant=medium
34
48
  ```
35
49
 
36
50
  ---
37
51
 
38
- ## 🚀 Quick Start
52
+ ## How Multi-Account Works
53
+
54
+ ### Adding Accounts
39
55
 
40
56
  ```bash
41
- npx -y opencode-openai-multi-auth@latest
57
+ # First account
58
+ opencode auth login
59
+ # → Select "ChatGPT Plus/Pro (Codex Subscription)"
60
+ # → Browser opens, login with ChatGPT
61
+ # → Account saved
62
+
63
+ # Second account (different email/org)
64
+ opencode auth login
65
+ # → Select "Add Another OpenAI Account"
66
+ # → Login with different ChatGPT account
67
+ # → Account added to rotation pool
68
+
69
+ # Repeat for as many accounts as you have
42
70
  ```
43
71
 
44
- Then:
72
+ ### Automatic Rotation
73
+
74
+ When you hit a rate limit:
45
75
 
76
+ 1. Plugin detects 429 (rate limited) response
77
+ 2. Marks current account as limited for that model
78
+ 3. Switches to next available account
79
+ 4. Retries your request automatically
80
+ 5. Shows toast notification: `Switched to account2@example.com`
81
+
82
+ ### Account Selection Strategies
83
+
84
+ | Strategy | Behavior | Best For |
85
+ |----------|----------|----------|
86
+ | `sticky` (default) | Stay with one account until rate limited | Single user, predictable usage |
87
+ | `round-robin` | Rotate through accounts on each request | Distribute load evenly |
88
+ | `hybrid` | Sticky within session, rotate across sessions | Multiple terminal sessions |
89
+
90
+ Set via environment variable:
46
91
  ```bash
47
- opencode auth login
48
- opencode run "write hello world to test.txt" --model=openai/gpt-5.2 --variant=medium
92
+ OPENCODE_OPENAI_STRATEGY=round-robin opencode run "task"
49
93
  ```
50
94
 
51
- Legacy OpenCode (v1.0.209 and below):
95
+ ### Team Usage
96
+
97
+ Each team member can add their own ChatGPT account:
52
98
 
53
99
  ```bash
54
- npx -y opencode-openai-multi-auth@latest --legacy
55
- opencode run "write hello world to test.txt" --model=openai/gpt-5.2-medium
100
+ # Developer 1 adds their account
101
+ opencode auth login # logs in as dev1@company.com
102
+
103
+ # Developer 2 adds their account
104
+ opencode auth login # → "Add Another OpenAI Account" → dev2@company.com
105
+
106
+ # Developer 3 adds their account
107
+ opencode auth login # → "Add Another OpenAI Account" → dev3@company.com
56
108
  ```
57
109
 
58
- Uninstall:
110
+ All accounts are pooled - when one person's account is rate limited, the plugin uses the next available.
59
111
 
112
+ ---
113
+
114
+ ## Environment Variables
115
+
116
+ | Variable | Description | Default |
117
+ |----------|-------------|---------|
118
+ | `OPENCODE_OPENAI_QUIET=1` | Disable toast notifications | Off |
119
+ | `OPENCODE_OPENAI_DEBUG=1` | Enable debug logging | Off |
120
+ | `OPENCODE_OPENAI_STRATEGY` | Account selection strategy | `sticky` |
121
+ | `OPENCODE_OPENAI_PID_OFFSET=1` | Offset account selection by PID | Off |
122
+
123
+ ---
124
+
125
+ ## Account Management
126
+
127
+ ### View Accounts
60
128
  ```bash
61
- npx -y opencode-openai-multi-auth@latest --uninstall
62
- npx -y opencode-openai-multi-auth@latest --uninstall --all
129
+ cat ~/.config/opencode/openai-accounts.json | jq '.accounts[] | {email, planType}'
130
+ ```
131
+
132
+ ### Remove All Accounts
133
+ ```bash
134
+ rm ~/.config/opencode/openai-accounts.json
135
+ ```
136
+
137
+ ### Check Rate Limit Status
138
+ ```bash
139
+ cat ~/.config/opencode/openai-accounts.json | jq '.accounts[] | {email, rateLimitResets}'
63
140
  ```
64
141
 
65
142
  ---
66
143
 
67
- ## 📦 Models
144
+ ## Models
145
+
146
+ All GPT-5.2 and GPT-5.1 models with reasoning variants:
68
147
 
69
148
  - **gpt-5.2** (none/low/medium/high/xhigh)
70
149
  - **gpt-5.2-codex** (low/medium/high/xhigh)
@@ -75,71 +154,56 @@ npx -y opencode-openai-multi-auth@latest --uninstall --all
75
154
 
76
155
  ---
77
156
 
78
- ## 🧩 Configuration
157
+ ## Configuration
79
158
 
80
- - Modern (OpenCode v1.0.210+): `config/opencode-modern.json`
81
- - Legacy (OpenCode v1.0.209 and below): `config/opencode-legacy.json`
159
+ - **Modern** (OpenCode v1.0.210+): `config/opencode-modern.json`
160
+ - **Legacy** (v1.0.209 and below): `config/opencode-legacy.json`
82
161
 
83
- Minimal configs are not supported for GPT‑5.x; use the full configs above.
84
- ---
162
+ ```bash
163
+ # Modern install
164
+ npx -y opencode-openai-multi-auth@latest
85
165
 
86
- ## Features
166
+ # Legacy install
167
+ npx -y opencode-openai-multi-auth@latest --legacy
87
168
 
88
- - **Multi-account support** with automatic rotation on rate limits
89
- - ChatGPT Plus/Pro OAuth authentication (official flow)
90
- - 22 model presets across GPT‑5.2 / GPT‑5.2 Codex / GPT‑5.1 families
91
- - Variant system support (v1.0.210+) + legacy presets
92
- - Multimodal input enabled for all models
93
- - Toast notifications for account switches and rate limits
94
- - Usage‑aware errors + automatic token refresh
169
+ # Uninstall
170
+ npx -y opencode-openai-multi-auth@latest --uninstall
171
+ ```
95
172
 
96
173
  ---
97
174
 
98
- ## 🔄 Multi-Account Support
99
-
100
- Add multiple ChatGPT accounts and automatically rotate between them when rate limited:
175
+ ## Features
101
176
 
102
- ```bash
103
- # Add first account
104
- opencode auth login
105
- # Select "ChatGPT Plus/Pro (Codex Subscription)"
106
-
107
- # Add additional accounts
108
- opencode auth login
109
- # Select "Add Another OpenAI Account"
110
- ```
177
+ - **Multi-account rotation** - Add unlimited ChatGPT accounts, auto-rotate on rate limits
178
+ - **Per-model rate tracking** - Each model's limits tracked separately per account
179
+ - **Toast notifications** - Visual feedback when accounts switch
180
+ - **OAuth authentication** - Same secure flow as official Codex CLI
181
+ - **22 model presets** - All GPT-5.2/5.1 variants pre-configured
182
+ - **Automatic token refresh** - Never manually re-authenticate
183
+ - **Multimodal support** - Image input enabled for all models
111
184
 
112
- **Features:**
113
- - Automatic rotation when an account hits rate limits
114
- - Per-model rate limit tracking
115
- - Toast notifications showing active account
116
- - Seamless failover between accounts
117
- - Imports existing tokens from OpenCode auth
185
+ ---
118
186
 
119
- **Environment Variables:**
120
- | Variable | Description |
121
- |----------|-------------|
122
- | `OPENCODE_OPENAI_QUIET=1` | Disable toast notifications |
123
- | `OPENCODE_OPENAI_DEBUG=1` | Enable debug logging |
124
- | `OPENCODE_OPENAI_STRATEGY` | Account selection: `sticky` (default), `round-robin`, `hybrid` |
187
+ ## Documentation
125
188
 
126
- **Accounts storage:** `~/.config/opencode/openai-accounts.json`
189
+ - [Getting Started](docs/getting-started.md)
190
+ - [Configuration Guide](docs/configuration.md)
191
+ - [Troubleshooting](docs/troubleshooting.md)
192
+ - [Architecture](docs/development/ARCHITECTURE.md)
127
193
 
128
194
  ---
129
195
 
130
- ## 📚 Docs
196
+ ## Credits
131
197
 
132
- - Getting Started: `docs/getting-started.md`
133
- - Configuration: `docs/configuration.md`
134
- - Troubleshooting: `docs/troubleshooting.md`
135
- - Architecture: `docs/development/ARCHITECTURE.md`
198
+ **Maintained by [ZenysTX](https://x.com/zenysTX)**
199
+ **Original implementation by [Numman Ali](https://x.com/nummanali)**
200
+ **Inspired by [opencode-google-antigravity-auth](https://github.com/shekohex/opencode-google-antigravity-auth)**
201
+
202
+ [![Twitter Follow](https://img.shields.io/twitter/follow/zenysTX?style=social)](https://x.com/zenysTX)
203
+ [![Twitter Follow](https://img.shields.io/twitter/follow/nummanali?style=social)](https://x.com/nummanali)
136
204
 
137
205
  ---
138
206
 
139
- ## ⚠️ Usage Notice
207
+ ## Usage Notice
140
208
 
141
209
  This plugin is for **personal development use** with your own ChatGPT Plus/Pro subscriptions.
142
-
143
- **Built for developers who value simplicity.**
144
-
145
- ## Force Build 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-openai-multi-auth",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "OpenAI ChatGPT OAuth plugin for opencode with multi-account rotation on rate limits",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",