oc-codex-multi-auth 6.0.0
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/LICENSE +21 -0
- package/README.md +162 -0
- package/assets/opencode-logo-ornate-dark.svg +18 -0
- package/assets/readme-hero.svg +31 -0
- package/config/README.md +96 -0
- package/config/minimal-opencode.json +13 -0
- package/config/opencode-legacy.json +871 -0
- package/config/opencode-modern.json +358 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5008 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/accounts/rate-limits.d.ts +22 -0
- package/dist/lib/accounts/rate-limits.d.ts.map +1 -0
- package/dist/lib/accounts/rate-limits.js +63 -0
- package/dist/lib/accounts/rate-limits.js.map +1 -0
- package/dist/lib/accounts.d.ts +134 -0
- package/dist/lib/accounts.d.ts.map +1 -0
- package/dist/lib/accounts.js +795 -0
- package/dist/lib/accounts.js.map +1 -0
- package/dist/lib/audit.d.ts +45 -0
- package/dist/lib/audit.d.ts.map +1 -0
- package/dist/lib/audit.js +154 -0
- package/dist/lib/audit.js.map +1 -0
- package/dist/lib/auth/auth.d.ts +51 -0
- package/dist/lib/auth/auth.d.ts.map +1 -0
- package/dist/lib/auth/auth.js +191 -0
- package/dist/lib/auth/auth.js.map +1 -0
- package/dist/lib/auth/browser.d.ts +17 -0
- package/dist/lib/auth/browser.d.ts.map +1 -0
- package/dist/lib/auth/browser.js +90 -0
- package/dist/lib/auth/browser.js.map +1 -0
- package/dist/lib/auth/device-code.d.ts +28 -0
- package/dist/lib/auth/device-code.d.ts.map +1 -0
- package/dist/lib/auth/device-code.js +215 -0
- package/dist/lib/auth/device-code.js.map +1 -0
- package/dist/lib/auth/login-runner.d.ts +55 -0
- package/dist/lib/auth/login-runner.d.ts.map +1 -0
- package/dist/lib/auth/login-runner.js +631 -0
- package/dist/lib/auth/login-runner.js.map +1 -0
- package/dist/lib/auth/server.d.ts +10 -0
- package/dist/lib/auth/server.d.ts.map +1 -0
- package/dist/lib/auth/server.js +98 -0
- package/dist/lib/auth/server.js.map +1 -0
- package/dist/lib/auth/token-utils.d.ts +60 -0
- package/dist/lib/auth/token-utils.d.ts.map +1 -0
- package/dist/lib/auth/token-utils.js +416 -0
- package/dist/lib/auth/token-utils.js.map +1 -0
- package/dist/lib/auth-rate-limit.d.ts +20 -0
- package/dist/lib/auth-rate-limit.d.ts.map +1 -0
- package/dist/lib/auth-rate-limit.js +91 -0
- package/dist/lib/auth-rate-limit.js.map +1 -0
- package/dist/lib/auto-update-checker.d.ts +10 -0
- package/dist/lib/auto-update-checker.d.ts.map +1 -0
- package/dist/lib/auto-update-checker.js +129 -0
- package/dist/lib/auto-update-checker.js.map +1 -0
- package/dist/lib/circuit-breaker.d.ts +34 -0
- package/dist/lib/circuit-breaker.d.ts.map +1 -0
- package/dist/lib/circuit-breaker.js +124 -0
- package/dist/lib/circuit-breaker.js.map +1 -0
- package/dist/lib/cli.d.ts +46 -0
- package/dist/lib/cli.d.ts.map +1 -0
- package/dist/lib/cli.js +192 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/config.d.ts +42 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +314 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/constants.d.ts +90 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +90 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/context-overflow.d.ts +27 -0
- package/dist/lib/context-overflow.d.ts.map +1 -0
- package/dist/lib/context-overflow.js +124 -0
- package/dist/lib/context-overflow.js.map +1 -0
- package/dist/lib/errors.d.ts +113 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +103 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/health.d.ts +33 -0
- package/dist/lib/health.d.ts.map +1 -0
- package/dist/lib/health.js +70 -0
- package/dist/lib/health.js.map +1 -0
- package/dist/lib/index.d.ts +20 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +20 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/logger.d.ts +40 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +337 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/oauth-success.html +712 -0
- package/dist/lib/parallel-probe.d.ts +28 -0
- package/dist/lib/parallel-probe.d.ts.map +1 -0
- package/dist/lib/parallel-probe.js +97 -0
- package/dist/lib/parallel-probe.js.map +1 -0
- package/dist/lib/proactive-refresh.d.ts +67 -0
- package/dist/lib/proactive-refresh.d.ts.map +1 -0
- package/dist/lib/proactive-refresh.js +161 -0
- package/dist/lib/proactive-refresh.js.map +1 -0
- package/dist/lib/prompts/codex-opencode-bridge.d.ts +20 -0
- package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -0
- package/dist/lib/prompts/codex-opencode-bridge.js +126 -0
- package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -0
- package/dist/lib/prompts/codex.d.ts +41 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -0
- package/dist/lib/prompts/codex.js +400 -0
- package/dist/lib/prompts/codex.js.map +1 -0
- package/dist/lib/prompts/opencode-codex.d.ts +25 -0
- package/dist/lib/prompts/opencode-codex.d.ts.map +1 -0
- package/dist/lib/prompts/opencode-codex.js +223 -0
- package/dist/lib/prompts/opencode-codex.js.map +1 -0
- package/dist/lib/recovery/constants.d.ts +12 -0
- package/dist/lib/recovery/constants.d.ts.map +1 -0
- package/dist/lib/recovery/constants.js +25 -0
- package/dist/lib/recovery/constants.js.map +1 -0
- package/dist/lib/recovery/index.d.ts +12 -0
- package/dist/lib/recovery/index.d.ts.map +1 -0
- package/dist/lib/recovery/index.js +12 -0
- package/dist/lib/recovery/index.js.map +1 -0
- package/dist/lib/recovery/storage.d.ts +24 -0
- package/dist/lib/recovery/storage.d.ts.map +1 -0
- package/dist/lib/recovery/storage.js +362 -0
- package/dist/lib/recovery/storage.js.map +1 -0
- package/dist/lib/recovery/types.d.ts +116 -0
- package/dist/lib/recovery/types.d.ts.map +1 -0
- package/dist/lib/recovery/types.js +7 -0
- package/dist/lib/recovery/types.js.map +1 -0
- package/dist/lib/recovery.d.ts +31 -0
- package/dist/lib/recovery.d.ts.map +1 -0
- package/dist/lib/recovery.js +313 -0
- package/dist/lib/recovery.js.map +1 -0
- package/dist/lib/refresh-queue.d.ts +131 -0
- package/dist/lib/refresh-queue.d.ts.map +1 -0
- package/dist/lib/refresh-queue.js +297 -0
- package/dist/lib/refresh-queue.js.map +1 -0
- package/dist/lib/request/fetch-helpers.d.ts +142 -0
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -0
- package/dist/lib/request/fetch-helpers.js +749 -0
- package/dist/lib/request/fetch-helpers.js.map +1 -0
- package/dist/lib/request/helpers/input-utils.d.ts +7 -0
- package/dist/lib/request/helpers/input-utils.d.ts.map +1 -0
- package/dist/lib/request/helpers/input-utils.js +214 -0
- package/dist/lib/request/helpers/input-utils.js.map +1 -0
- package/dist/lib/request/helpers/model-map.d.ts +22 -0
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -0
- package/dist/lib/request/helpers/model-map.js +183 -0
- package/dist/lib/request/helpers/model-map.js.map +1 -0
- package/dist/lib/request/helpers/tool-utils.d.ts +29 -0
- package/dist/lib/request/helpers/tool-utils.d.ts.map +1 -0
- package/dist/lib/request/helpers/tool-utils.js +117 -0
- package/dist/lib/request/helpers/tool-utils.js.map +1 -0
- package/dist/lib/request/rate-limit-backoff.d.ts +17 -0
- package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -0
- package/dist/lib/request/rate-limit-backoff.js +83 -0
- package/dist/lib/request/rate-limit-backoff.js.map +1 -0
- package/dist/lib/request/request-transformer.d.ts +107 -0
- package/dist/lib/request/request-transformer.d.ts.map +1 -0
- package/dist/lib/request/request-transformer.js +930 -0
- package/dist/lib/request/request-transformer.js.map +1 -0
- package/dist/lib/request/response-handler.d.ts +23 -0
- package/dist/lib/request/response-handler.d.ts.map +1 -0
- package/dist/lib/request/response-handler.js +245 -0
- package/dist/lib/request/response-handler.js.map +1 -0
- package/dist/lib/request/retry-budget.d.ts +19 -0
- package/dist/lib/request/retry-budget.d.ts.map +1 -0
- package/dist/lib/request/retry-budget.js +99 -0
- package/dist/lib/request/retry-budget.js.map +1 -0
- package/dist/lib/rotation.d.ts +130 -0
- package/dist/lib/rotation.d.ts.map +1 -0
- package/dist/lib/rotation.js +301 -0
- package/dist/lib/rotation.js.map +1 -0
- package/dist/lib/runtime-contracts.d.ts +16 -0
- package/dist/lib/runtime-contracts.d.ts.map +1 -0
- package/dist/lib/runtime-contracts.js +24 -0
- package/dist/lib/runtime-contracts.js.map +1 -0
- package/dist/lib/schemas.d.ts +457 -0
- package/dist/lib/schemas.d.ts.map +1 -0
- package/dist/lib/schemas.js +283 -0
- package/dist/lib/schemas.js.map +1 -0
- package/dist/lib/shutdown.d.ts +7 -0
- package/dist/lib/shutdown.d.ts.map +1 -0
- package/dist/lib/shutdown.js +43 -0
- package/dist/lib/shutdown.js.map +1 -0
- package/dist/lib/storage/migrations.d.ts +65 -0
- package/dist/lib/storage/migrations.d.ts.map +1 -0
- package/dist/lib/storage/migrations.js +44 -0
- package/dist/lib/storage/migrations.js.map +1 -0
- package/dist/lib/storage/paths.d.ts +16 -0
- package/dist/lib/storage/paths.d.ts.map +1 -0
- package/dist/lib/storage/paths.js +92 -0
- package/dist/lib/storage/paths.js.map +1 -0
- package/dist/lib/storage.d.ts +157 -0
- package/dist/lib/storage.d.ts.map +1 -0
- package/dist/lib/storage.js +1169 -0
- package/dist/lib/storage.js.map +1 -0
- package/dist/lib/table-formatter.d.ts +32 -0
- package/dist/lib/table-formatter.d.ts.map +1 -0
- package/dist/lib/table-formatter.js +44 -0
- package/dist/lib/table-formatter.js.map +1 -0
- package/dist/lib/types.d.ts +131 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/ui/ansi.d.ts +22 -0
- package/dist/lib/ui/ansi.d.ts.map +1 -0
- package/dist/lib/ui/ansi.js +38 -0
- package/dist/lib/ui/ansi.js.map +1 -0
- package/dist/lib/ui/auth-menu.d.ts +39 -0
- package/dist/lib/ui/auth-menu.d.ts.map +1 -0
- package/dist/lib/ui/auth-menu.js +186 -0
- package/dist/lib/ui/auth-menu.js.map +1 -0
- package/dist/lib/ui/beginner.d.ts +62 -0
- package/dist/lib/ui/beginner.d.ts.map +1 -0
- package/dist/lib/ui/beginner.js +259 -0
- package/dist/lib/ui/beginner.js.map +1 -0
- package/dist/lib/ui/confirm.d.ts +2 -0
- package/dist/lib/ui/confirm.d.ts.map +1 -0
- package/dist/lib/ui/confirm.js +21 -0
- package/dist/lib/ui/confirm.js.map +1 -0
- package/dist/lib/ui/format.d.ts +9 -0
- package/dist/lib/ui/format.d.ts.map +1 -0
- package/dist/lib/ui/format.js +49 -0
- package/dist/lib/ui/format.js.map +1 -0
- package/dist/lib/ui/runtime.d.ts +11 -0
- package/dist/lib/ui/runtime.d.ts.map +1 -0
- package/dist/lib/ui/runtime.js +31 -0
- package/dist/lib/ui/runtime.js.map +1 -0
- package/dist/lib/ui/select.d.ts +20 -0
- package/dist/lib/ui/select.d.ts.map +1 -0
- package/dist/lib/ui/select.js +343 -0
- package/dist/lib/ui/select.js.map +1 -0
- package/dist/lib/ui/theme.d.ts +34 -0
- package/dist/lib/ui/theme.d.ts.map +1 -0
- package/dist/lib/ui/theme.js +84 -0
- package/dist/lib/ui/theme.js.map +1 -0
- package/dist/lib/utils.d.ts +29 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +54 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +113 -0
- package/scripts/audit-dev-allowlist.js +114 -0
- package/scripts/copy-oauth-success.js +37 -0
- package/scripts/install-oc-codex-multi-auth-core.js +381 -0
- package/scripts/install-oc-codex-multi-auth.js +15 -0
- package/scripts/test-all-models.sh +260 -0
- package/scripts/validate-model-map.sh +97 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Numman Ali
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# oc-codex-multi-auth
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/oc-codex-multi-auth)
|
|
4
|
+
[](https://www.npmjs.com/package/oc-codex-multi-auth)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Use your ChatGPT Plus/Pro subscription inside OpenCode with OAuth login, GPT-5/Codex model presets, and multi-account failover.
|
|
8
|
+
|
|
9
|
+
`oc-codex-multi-auth` is an OpenCode plugin for developers who want Codex-first GPT-5 workflows in OpenCode without switching to separate Platform API credentials for personal use. It uses the same official OAuth flow as the Codex CLI, adds model templates for current GPT-5 families, and can rotate across multiple ChatGPT accounts when one account is rate-limited or unavailable.
|
|
10
|
+
|
|
11
|
+
## What This Project Does
|
|
12
|
+
|
|
13
|
+
- Adds an OpenCode plugin that authenticates with ChatGPT Plus/Pro through official OAuth
|
|
14
|
+
- Ships ready-to-use model templates for `gpt-5.4`, `gpt-5-codex`, and related GPT-5 families
|
|
15
|
+
- Routes requests through a stateless Codex-compatible request pipeline with automatic token refresh
|
|
16
|
+
- Supports multi-account rotation, per-project account storage, and guided onboarding commands
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 1. Install or refresh the plugin config
|
|
22
|
+
npx -y oc-codex-multi-auth@latest
|
|
23
|
+
|
|
24
|
+
# 2. Sign in with ChatGPT Plus/Pro
|
|
25
|
+
opencode auth login
|
|
26
|
+
|
|
27
|
+
# 3. Run a prompt in OpenCode
|
|
28
|
+
opencode run "Explain this repository" --model=openai/gpt-5.4 --variant=medium
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
What the installer does:
|
|
32
|
+
|
|
33
|
+
- writes `~/.config/opencode/opencode.json`
|
|
34
|
+
- backs up an existing config before changing it
|
|
35
|
+
- normalizes the plugin entry to `"oc-codex-multi-auth"`
|
|
36
|
+
- clears the cached plugin copy so OpenCode reinstalls the latest package
|
|
37
|
+
|
|
38
|
+
By default, the installer now writes a full catalog config that includes both:
|
|
39
|
+
- modern base model entries such as `gpt-5.4` for `--variant` workflows
|
|
40
|
+
- explicit preset entries such as `gpt-5.4-high` so the shipped catalog is visible directly in model pickers
|
|
41
|
+
|
|
42
|
+
## Example Usage
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# General GPT-5 workflow
|
|
46
|
+
opencode run "Summarize the failing test and suggest a fix" --model=openai/gpt-5.4 --variant=medium
|
|
47
|
+
|
|
48
|
+
# Codex-focused workflow
|
|
49
|
+
opencode run "Refactor the retry logic and update the tests" --model=openai/gpt-5-codex --variant=high
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage Notice
|
|
53
|
+
|
|
54
|
+
> [!CAUTION]
|
|
55
|
+
> This project is for personal development use with your own ChatGPT Plus/Pro subscription.
|
|
56
|
+
>
|
|
57
|
+
> - It is not intended for commercial resale, shared multi-user access, or production services.
|
|
58
|
+
> - It uses official OAuth authentication, but it is an independent open-source project and is not affiliated with OpenAI.
|
|
59
|
+
> - For production applications, use the [OpenAI Platform API](https://platform.openai.com/).
|
|
60
|
+
> - You are responsible for complying with [OpenAI's Terms of Use](https://openai.com/policies/terms-of-use/).
|
|
61
|
+
|
|
62
|
+
## Why This Exists
|
|
63
|
+
|
|
64
|
+
OpenCode users often want the same GPT-5 and Codex model experience they use in ChatGPT, but inside a local terminal workflow. This plugin exists to bridge that gap cleanly:
|
|
65
|
+
|
|
66
|
+
- official OAuth instead of scraped cookies or unofficial auth flows
|
|
67
|
+
- OpenCode-ready model definitions instead of hand-rolled config every time
|
|
68
|
+
- account rotation and recovery features for people who work across multiple ChatGPT accounts or workspaces
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- Official OAuth login flow compatible with ChatGPT Plus/Pro access
|
|
73
|
+
- GPT-5 and Codex model templates for modern and legacy OpenCode versions
|
|
74
|
+
- Multi-account rotation with health-aware failover
|
|
75
|
+
- Per-project account storage support
|
|
76
|
+
- Beginner-focused commands such as `codex-setup`, `codex-help`, `codex-doctor`, and `codex-next`
|
|
77
|
+
- Interactive account switching, labeling, tagging, and backup/import commands
|
|
78
|
+
- Stateless request handling with `reasoning.encrypted_content` for multi-turn sessions
|
|
79
|
+
- Request logging and troubleshooting hooks for debugging OpenCode integration issues
|
|
80
|
+
|
|
81
|
+
## Common Workflows
|
|
82
|
+
|
|
83
|
+
- Personal coding sessions in OpenCode using `gpt-5.4` or `gpt-5-codex`
|
|
84
|
+
- Switching between personal and workspace-linked ChatGPT accounts
|
|
85
|
+
- Keeping separate account pools per project or monorepo
|
|
86
|
+
- Recovering from unsupported-model, auth, or rate-limit issues with guided commands
|
|
87
|
+
|
|
88
|
+
## How It Works
|
|
89
|
+
|
|
90
|
+
The plugin sits between OpenCode and the ChatGPT-backed Codex workflow:
|
|
91
|
+
|
|
92
|
+
1. OpenCode loads the plugin and sends model requests through the plugin fetch pipeline.
|
|
93
|
+
2. The plugin authenticates with ChatGPT OAuth and refreshes tokens when needed.
|
|
94
|
+
3. Requests are normalized for the Codex backend and sent with `store: false`.
|
|
95
|
+
4. The plugin chooses the best account/workspace candidate, retries intelligently, and preserves conversation continuity through encrypted reasoning state.
|
|
96
|
+
|
|
97
|
+
See [Architecture](docs/development/ARCHITECTURE.md) for implementation details.
|
|
98
|
+
|
|
99
|
+
## Installation
|
|
100
|
+
|
|
101
|
+
Use the quick-start path above for the fastest setup. For full setup, local development installs, legacy OpenCode support, and verification steps, see [Getting Started](docs/getting-started.md).
|
|
102
|
+
|
|
103
|
+
If you prefer the compact variant-only config on OpenCode `v1.0.210+`, use:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx -y oc-codex-multi-auth@latest --modern
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
Detailed configuration lives outside this README:
|
|
112
|
+
|
|
113
|
+
- [Getting Started](docs/getting-started.md) for install and first-run setup
|
|
114
|
+
- [Configuration Reference](docs/configuration.md) for config keys, env vars, and fallback behavior
|
|
115
|
+
- [Config Templates](config/README.md) for modern vs legacy OpenCode examples
|
|
116
|
+
|
|
117
|
+
## Troubleshooting
|
|
118
|
+
|
|
119
|
+
Start here if the plugin does not load or authenticate correctly:
|
|
120
|
+
|
|
121
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
122
|
+
- [Privacy & Data Handling](docs/privacy.md)
|
|
123
|
+
- [FAQ](docs/faq.md)
|
|
124
|
+
- [Security Policy](SECURITY.md)
|
|
125
|
+
|
|
126
|
+
Common first checks:
|
|
127
|
+
|
|
128
|
+
- confirm `"plugin": ["oc-codex-multi-auth"]` is present in your OpenCode config
|
|
129
|
+
|
|
130
|
+
## 6.0.0 Cutover
|
|
131
|
+
|
|
132
|
+
This release intentionally breaks the old package line and moves the runtime to package-aligned storage names.
|
|
133
|
+
|
|
134
|
+
- Rename the GitHub repository to `ndycode/oc-codex-multi-auth`
|
|
135
|
+
- Publish `oc-codex-multi-auth@6.0.0`
|
|
136
|
+
- Deprecate `oc-chatgpt-multi-auth` on npm with a pointer to the new package
|
|
137
|
+
- Verify docs, badges, repo links, and OpenCode config examples all resolve to `oc-codex-multi-auth`
|
|
138
|
+
- rerun `opencode auth login`
|
|
139
|
+
- inspect `~/.opencode/logs/codex-plugin/` after running one request with `ENABLE_PLUGIN_REQUEST_LOGGING=1`
|
|
140
|
+
|
|
141
|
+
## FAQ
|
|
142
|
+
|
|
143
|
+
Short answers for the most common questions live in [docs/faq.md](docs/faq.md), including:
|
|
144
|
+
|
|
145
|
+
- who this plugin is for
|
|
146
|
+
- which OpenCode versions it supports
|
|
147
|
+
- how the modern and legacy config templates differ
|
|
148
|
+
- when to use this plugin versus the OpenAI Platform API
|
|
149
|
+
|
|
150
|
+
## Contributing
|
|
151
|
+
|
|
152
|
+
Contributions are welcome if they keep the project accurate, maintainable, and aligned with its personal-use scope.
|
|
153
|
+
|
|
154
|
+
- [Contributing Guide](CONTRIBUTING.md)
|
|
155
|
+
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
156
|
+
- [Security Policy](SECURITY.md)
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT. See [LICENSE](LICENSE).
|
|
161
|
+
|
|
162
|
+
ChatGPT, GPT-5, Codex, and OpenAI are trademarks of OpenAI, L.L.C.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg width="234" height="42" viewBox="0 0 234 42" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M18 30H6V18H18V30Z" fill="#4B4646"/>
|
|
3
|
+
<path d="M18 12H6V30H18V12ZM24 36H0V6H24V36Z" fill="#B7B1B1"/>
|
|
4
|
+
<path d="M48 30H36V18H48V30Z" fill="#4B4646"/>
|
|
5
|
+
<path d="M36 30H48V12H36V30ZM54 36H36V42H30V6H54V36Z" fill="#B7B1B1"/>
|
|
6
|
+
<path d="M84 24V30H66V24H84Z" fill="#4B4646"/>
|
|
7
|
+
<path d="M84 24H66V30H84V36H60V6H84V24ZM66 18H78V12H66V18Z" fill="#B7B1B1"/>
|
|
8
|
+
<path d="M108 36H96V18H108V36Z" fill="#4B4646"/>
|
|
9
|
+
<path d="M108 12H96V36H90V6H108V12ZM114 36H108V12H114V36Z" fill="#B7B1B1"/>
|
|
10
|
+
<path d="M144 30H126V18H144V30Z" fill="#4B4646"/>
|
|
11
|
+
<path d="M144 12H126V30H144V36H120V6H144V12Z" fill="#F1ECEC"/>
|
|
12
|
+
<path d="M168 30H156V18H168V30Z" fill="#4B4646"/>
|
|
13
|
+
<path d="M168 12H156V30H168V12ZM174 36H150V6H174V36Z" fill="#F1ECEC"/>
|
|
14
|
+
<path d="M198 30H186V18H198V30Z" fill="#4B4646"/>
|
|
15
|
+
<path d="M198 12H186V30H198V12ZM204 36H180V6H198V0H204V36Z" fill="#F1ECEC"/>
|
|
16
|
+
<path d="M234 24V30H216V24H234Z" fill="#4B4646"/>
|
|
17
|
+
<path d="M216 12V18H228V12H216ZM234 24H216V30H234V36H210V6H234V24Z" fill="#F1ECEC"/>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="300" viewBox="0 0 1200 300" role="img" aria-label="oc-codex-multi-auth">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0%" stop-color="#0f172a" />
|
|
5
|
+
<stop offset="100%" stop-color="#1f2937" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="accent" x1="0" y1="0" x2="1" y2="0">
|
|
8
|
+
<stop offset="0%" stop-color="#38bdf8" />
|
|
9
|
+
<stop offset="100%" stop-color="#22d3ee" />
|
|
10
|
+
</linearGradient>
|
|
11
|
+
</defs>
|
|
12
|
+
<rect width="1200" height="300" rx="28" fill="url(#bg)" />
|
|
13
|
+
<g opacity="0.12">
|
|
14
|
+
<circle cx="1020" cy="70" r="120" fill="#38bdf8" />
|
|
15
|
+
<circle cx="150" cy="260" r="140" fill="#22d3ee" />
|
|
16
|
+
</g>
|
|
17
|
+
<g fill="none" stroke="url(#accent)" stroke-width="8" stroke-linecap="round" stroke-linejoin="round">
|
|
18
|
+
<path d="M160 95 L100 150 L160 205" />
|
|
19
|
+
<path d="M280 95 L340 150 L280 205" />
|
|
20
|
+
<path d="M205 80 L235 220" />
|
|
21
|
+
</g>
|
|
22
|
+
<text x="420" y="120" fill="#e2e8f0" font-size="42" font-family="'IBM Plex Sans','Segoe UI',Arial,sans-serif" font-weight="600">
|
|
23
|
+
oc-codex-multi-auth
|
|
24
|
+
</text>
|
|
25
|
+
<text x="420" y="170" fill="#cbd5f5" font-size="24" font-family="'IBM Plex Sans','Segoe UI',Arial,sans-serif">
|
|
26
|
+
Codex-first ChatGPT Plus/Pro auth for OpenCode
|
|
27
|
+
</text>
|
|
28
|
+
<text x="420" y="220" fill="#7dd3fc" font-size="18" font-family="'IBM Plex Sans','Segoe UI',Arial,sans-serif">
|
|
29
|
+
One-command install, account migration, modern variants
|
|
30
|
+
</text>
|
|
31
|
+
</svg>
|
package/config/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
This directory contains the official OpenCode config templates for `oc-codex-multi-auth`.
|
|
4
|
+
|
|
5
|
+
## Required: choose the right config file
|
|
6
|
+
|
|
7
|
+
| File | OpenCode version | Description |
|
|
8
|
+
|------|------------------|-------------|
|
|
9
|
+
| [`opencode-modern.json`](./opencode-modern.json) | **v1.0.210+** | Variant-based config: 9 base models with 34 total presets |
|
|
10
|
+
| [`opencode-legacy.json`](./opencode-legacy.json) | **v1.0.209 and below** | Legacy explicit entries: 34 individual model definitions |
|
|
11
|
+
|
|
12
|
+
The installer currently uses a merged full-catalog mode by default so users get both the modern base entries and the explicit preset entries without having to hand-edit `opencode.json`.
|
|
13
|
+
|
|
14
|
+
## Quick pick
|
|
15
|
+
|
|
16
|
+
If your OpenCode version is v1.0.210 or newer:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cp config/opencode-modern.json ~/.config/opencode/opencode.json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If your OpenCode version is v1.0.209 or older:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cp config/opencode-legacy.json ~/.config/opencode/opencode.json
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Check your version with:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
opencode --version
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Why there are two templates
|
|
35
|
+
|
|
36
|
+
OpenCode v1.0.210+ added model `variants`, so one model entry can expose multiple reasoning levels. That keeps modern config much smaller while preserving the same effective presets.
|
|
37
|
+
|
|
38
|
+
Both templates include:
|
|
39
|
+
- GPT-5.4, GPT-5.4 Pro, GPT-5.4 Mini, GPT-5.4 Nano, GPT-5 Codex, GPT-5.1, GPT-5.1 Codex, GPT-5.1 Codex Max, GPT-5.1 Codex Mini
|
|
40
|
+
- Reasoning variants per model family
|
|
41
|
+
- `store: false` and `include: ["reasoning.encrypted_content"]`
|
|
42
|
+
- Context metadata (`gpt-5.4`/`gpt-5.4-pro`: 1,050,000; `gpt-5.4-mini`/`gpt-5.4-nano`/Codex models: 400,000; `gpt-5.1`: 272,000; all output: 128,000)
|
|
43
|
+
|
|
44
|
+
Use `opencode debug config` to verify that these template entries were merged into your effective config. `opencode models openai` currently shows OpenCode's built-in provider catalog and can omit config-defined entries such as `gpt-5.4-mini`.
|
|
45
|
+
|
|
46
|
+
If your OpenCode runtime supports global compaction tuning, you can also set:
|
|
47
|
+
- `model_context_window = 1050000`
|
|
48
|
+
- `model_auto_compact_token_limit = 950000`
|
|
49
|
+
|
|
50
|
+
## Spark model note
|
|
51
|
+
|
|
52
|
+
The templates intentionally do **not** include `gpt-5.3-codex-spark` by default. Spark is often entitlement-gated at the account/workspace level, so shipping it by default causes avoidable startup failures for many users.
|
|
53
|
+
|
|
54
|
+
If your workspace is entitled, you can add Spark model IDs manually.
|
|
55
|
+
|
|
56
|
+
## Usage examples
|
|
57
|
+
|
|
58
|
+
Modern template (v1.0.210+):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
opencode run "task" --model=openai/gpt-5.4 --variant=medium
|
|
62
|
+
opencode run "task" --model=openai/gpt-5-codex --variant=high
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Legacy template (v1.0.209 and below):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
opencode run "task" --model=openai/gpt-5.4-medium
|
|
69
|
+
opencode run "task" --model=openai/gpt-5-codex-high
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Minimal config (advanced)
|
|
73
|
+
|
|
74
|
+
A barebones debug template is available at [`minimal-opencode.json`](./minimal-opencode.json). It omits the full preset catalog.
|
|
75
|
+
|
|
76
|
+
## Unsupported-model behavior
|
|
77
|
+
|
|
78
|
+
Current defaults are strict entitlement handling:
|
|
79
|
+
- `unsupportedCodexPolicy: "strict"` returns entitlement errors directly
|
|
80
|
+
- set `unsupportedCodexPolicy: "fallback"` (or `CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback`) to enable automatic fallback retries
|
|
81
|
+
- `fallbackToGpt52OnUnsupportedGpt53: true` keeps the legacy `gpt-5.3-codex -> gpt-5.2-codex` edge inside fallback mode
|
|
82
|
+
- `gpt-5.4-pro -> gpt-5.4` is included by default in fallback mode (relevant only if you add `gpt-5.4-pro` manually)
|
|
83
|
+
- `unsupportedCodexFallbackChain` lets you override fallback order per model
|
|
84
|
+
|
|
85
|
+
Default fallback chain (when policy is `fallback`):
|
|
86
|
+
- `gpt-5.4-pro -> gpt-5.4` (if you manually select `gpt-5.4-pro`)
|
|
87
|
+
- `gpt-5.3-codex -> gpt-5-codex -> gpt-5.2-codex`
|
|
88
|
+
- `gpt-5.3-codex-spark -> gpt-5-codex -> gpt-5.3-codex -> gpt-5.2-codex` (only relevant if Spark IDs are added manually)
|
|
89
|
+
- `gpt-5.2-codex -> gpt-5-codex`
|
|
90
|
+
- `gpt-5.1-codex -> gpt-5-codex`
|
|
91
|
+
|
|
92
|
+
## Additional docs
|
|
93
|
+
|
|
94
|
+
- Main config reference: [`docs/configuration.md`](../docs/configuration.md)
|
|
95
|
+
- Getting started: [`docs/getting-started.md`](../docs/getting-started.md)
|
|
96
|
+
- Troubleshooting: [`docs/troubleshooting.md`](../docs/troubleshooting.md)
|