{"id":41781548,"url":"https://github.com/ndycode/opencode-openai-codex-auth-multi","last_synced_at":"2026-01-25T04:03:07.882Z","repository":{"id":334200893,"uuid":"1128282387","full_name":"ndycode/opencode-openai-codex-auth-multi","owner":"ndycode","description":"Fork of opencode-openai-codex-auth with multi-account rotation","archived":false,"fork":false,"pushed_at":"2026-01-23T11:07:02.000Z","size":658,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-24T03:00:49.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ndycode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-05T12:06:53.000Z","updated_at":"2026-01-23T11:04:02.000Z","dependencies_parsed_at":"2026-01-24T03:01:13.806Z","dependency_job_id":null,"html_url":"https://github.com/ndycode/opencode-openai-codex-auth-multi","commit_stats":null,"previous_names":["ndycode/opencode-openai-codex-auth-multi"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ndycode/opencode-openai-codex-auth-multi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndycode%2Fopencode-openai-codex-auth-multi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndycode%2Fopencode-openai-codex-auth-multi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndycode%2Fopencode-openai-codex-auth-multi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndycode%2Fopencode-openai-codex-auth-multi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndycode","download_url":"https://codeload.github.com/ndycode/opencode-openai-codex-auth-multi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndycode%2Fopencode-openai-codex-auth-multi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28742983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T02:46:29.005Z","status":"ssl_error","status_checked_at":"2026-01-25T02:44:29.968Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-25T04:03:06.336Z","updated_at":"2026-01-25T04:03:07.868Z","avatar_url":"https://github.com/ndycode.png","language":"TypeScript","readme":"# OpenAI Codex Auth Plugin for OpenCode\n\n[![npm version](https://img.shields.io/npm/v/opencode-openai-codex-auth-multi.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)\n[![npm downloads](https://img.shields.io/npm/dw/opencode-openai-codex-auth-multi.svg)](https://www.npmjs.com/package/opencode-openai-codex-auth-multi)\n[![Tests](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/opencode-openai-codex-auth-multi/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nEnable OpenCode to authenticate against **OpenAI's Codex backend** via OAuth so you can use ChatGPT Plus/Pro rate limits and access models like `gpt-5.2`, `gpt-5.2-codex`, and `gpt-5.1-codex-max` with your ChatGPT credentials.\n\n## What You Get\n\n- **GPT-5.2, GPT-5.2 Codex, GPT-5.1 Codex Max** and all GPT-5.x variants via ChatGPT OAuth\n- **Multi-account support** — add multiple ChatGPT accounts, health-aware rotation with automatic failover\n- **Auto-update notifications** — get notified when a new version is available\n- **22 model presets** — full variant system with reasoning levels (none/low/medium/high/xhigh)\n- **Prompt caching** — session-based caching for faster multi-turn conversations\n- **Usage-aware errors** — friendly messages with rate limit reset timing\n- **Plugin compatible** — works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)\n\n---\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003eTerms of Service Warning — Read Before Installing\u003c/b\u003e\u003c/summary\u003e\n\n\u003e [!CAUTION]\n\u003e This plugin uses OpenAI's official OAuth authentication (the same method as OpenAI's official Codex CLI) for personal development use with your ChatGPT Plus/Pro subscription.\n\u003e\n\u003e **This plugin is for personal development only:**\n\u003e - Not for commercial services, API resale, or multi-user applications\n\u003e - For production use, see [OpenAI Platform API](https://platform.openai.com/)\n\u003e\n\u003e **By using this plugin, you acknowledge:**\n\u003e - This is an unofficial tool not endorsed by OpenAI\n\u003e - Users are responsible for compliance with [OpenAI's Terms of Use](https://openai.com/policies/terms-of-use/)\n\u003e - You assume all risks associated with using this plugin\n\n\u003c/details\u003e\n\n---\n\n## Installation\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003eFor Humans\u003c/b\u003e\u003c/summary\u003e\n\n**Option A: Let an LLM do it**\n\nPaste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):\n\n```\nInstall the opencode-openai-codex-auth-multi plugin and add the OpenAI model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/ndycode/opencode-openai-codex-auth-multi/main/README.md\n```\n\n**Option B: One-command install**\n\n```bash\nnpx -y opencode-openai-codex-auth-multi@latest\n```\n\nThis writes the config to `~/.config/opencode/opencode.json`, backs up existing config, and clears the plugin cache.\n\n\u003e Want legacy config (OpenCode v1.0.209 and below)? Add `--legacy` flag.\n\n**Option C: Manual setup**\n\n1. **Add the plugin** to `~/.config/opencode/opencode.json`:\n\n   ```json\n   {\n     \"plugin\": [\"opencode-openai-codex-auth-multi@latest\"]\n   }\n   ```\n\n2. **Login** with your ChatGPT account:\n\n   ```bash\n   opencode auth login\n   ```\n\n3. **Add models** — copy the [full configuration](#models) below\n\n4. **Use it:**\n\n   ```bash\n   opencode run \"Hello\" --model=openai/gpt-5.2 --variant=medium\n   ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eFor LLM Agents\u003c/b\u003e\u003c/summary\u003e\n\n### Step-by-Step Instructions\n\n1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`\n   \n   \u003e **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\\Users\\YourName`).\n\n2. Add the plugin to the `plugin` array:\n   ```json\n   {\n     \"plugin\": [\"opencode-openai-codex-auth-multi@latest\"]\n   }\n   ```\n\n3. Add the model definitions from the [Full models configuration](#full-models-configuration-copy-paste-ready) section\n\n4. Set `provider` to `\"openai\"` and choose a model\n\n### Verification\n\n```bash\nopencode run \"Hello\" --model=openai/gpt-5.2 --variant=medium\n```\n\n\u003c/details\u003e\n\n---\n\n## Models\n\n### Model Reference\n\n| Model | Variants | Notes |\n|-------|----------|-------|\n| `gpt-5.2` | none, low, medium, high, xhigh | Latest GPT-5.2 with reasoning levels |\n| `gpt-5.2-codex` | low, medium, high, xhigh | GPT-5.2 Codex for code generation |\n| `gpt-5.1-codex-max` | low, medium, high, xhigh | Maximum context Codex |\n| `gpt-5.1-codex` | low, medium, high | Standard Codex |\n| `gpt-5.1-codex-mini` | medium, high | Lightweight Codex |\n| `gpt-5.1` | none, low, medium, high | GPT-5.1 base model |\n\n**Using variants:**\n```bash\n# Modern OpenCode (v1.0.210+)\nopencode run \"Hello\" --model=openai/gpt-5.2 --variant=high\n\n# Legacy OpenCode (v1.0.209 and below)\nopencode run \"Hello\" --model=openai/gpt-5.2-high\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eFull models configuration (copy-paste ready)\u003c/b\u003e\u003c/summary\u003e\n\nAdd this to your `~/.config/opencode/opencode.json`:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"plugin\": [\"opencode-openai-codex-auth-multi@latest\"],\n  \"provider\": {\n    \"openai\": {\n      \"options\": {\n        \"reasoningEffort\": \"medium\",\n        \"reasoningSummary\": \"auto\",\n        \"textVerbosity\": \"medium\",\n        \"include\": [\"reasoning.encrypted_content\"],\n        \"store\": false\n      },\n      \"models\": {\n        \"gpt-5.2\": {\n          \"name\": \"GPT 5.2 (OAuth)\",\n          \"limit\": { \"context\": 272000, \"output\": 128000 },\n          \"modalities\": { \"input\": [\"text\", \"image\", \"pdf\"], \"output\": [\"text\"] },\n          \"variants\": {\n            \"none\": { \"reasoningEffort\": \"none\" },\n            \"low\": { \"reasoningEffort\": \"low\" },\n            \"medium\": { \"reasoningEffort\": \"medium\" },\n            \"high\": { \"reasoningEffort\": \"high\" },\n            \"xhigh\": { \"reasoningEffort\": \"xhigh\" }\n          }\n        },\n        \"gpt-5.2-codex\": {\n          \"name\": \"GPT 5.2 Codex (OAuth)\",\n          \"limit\": { \"context\": 272000, \"output\": 128000 },\n          \"modalities\": { \"input\": [\"text\", \"image\", \"pdf\"], \"output\": [\"text\"] },\n          \"variants\": {\n            \"low\": { \"reasoningEffort\": \"low\" },\n            \"medium\": { \"reasoningEffort\": \"medium\" },\n            \"high\": { \"reasoningEffort\": \"high\" },\n            \"xhigh\": { \"reasoningEffort\": \"xhigh\" }\n          }\n        },\n        \"gpt-5.1-codex-max\": {\n          \"name\": \"GPT 5.1 Codex Max (OAuth)\",\n          \"limit\": { \"context\": 272000, \"output\": 128000 },\n          \"modalities\": { \"input\": [\"text\", \"image\", \"pdf\"], \"output\": [\"text\"] },\n          \"variants\": {\n            \"low\": { \"reasoningEffort\": \"low\" },\n            \"medium\": { \"reasoningEffort\": \"medium\" },\n            \"high\": { \"reasoningEffort\": \"high\" },\n            \"xhigh\": { \"reasoningEffort\": \"xhigh\" }\n          }\n        },\n        \"gpt-5.1-codex\": {\n          \"name\": \"GPT 5.1 Codex (OAuth)\",\n          \"limit\": { \"context\": 272000, \"output\": 128000 },\n          \"modalities\": { \"input\": [\"text\", \"image\", \"pdf\"], \"output\": [\"text\"] },\n          \"variants\": {\n            \"low\": { \"reasoningEffort\": \"low\" },\n            \"medium\": { \"reasoningEffort\": \"medium\" },\n            \"high\": { \"reasoningEffort\": \"high\" }\n          }\n        },\n        \"gpt-5.1-codex-mini\": {\n          \"name\": \"GPT 5.1 Codex Mini (OAuth)\",\n          \"limit\": { \"context\": 272000, \"output\": 128000 },\n          \"modalities\": { \"input\": [\"text\", \"image\", \"pdf\"], \"output\": [\"text\"] },\n          \"variants\": {\n            \"medium\": { \"reasoningEffort\": \"medium\" },\n            \"high\": { \"reasoningEffort\": \"high\" }\n          }\n        },\n        \"gpt-5.1\": {\n          \"name\": \"GPT 5.1 (OAuth)\",\n          \"limit\": { \"context\": 272000, \"output\": 128000 },\n          \"modalities\": { \"input\": [\"text\", \"image\", \"pdf\"], \"output\": [\"text\"] },\n          \"variants\": {\n            \"none\": { \"reasoningEffort\": \"none\" },\n            \"low\": { \"reasoningEffort\": \"low\" },\n            \"medium\": { \"reasoningEffort\": \"medium\" },\n            \"high\": { \"reasoningEffort\": \"high\" }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nFor legacy OpenCode (v1.0.209 and below), use `config/opencode-legacy.json` which has individual model entries like `gpt-5.2-low`, `gpt-5.2-medium`, etc.\n\n\u003c/details\u003e\n\n---\n\n## Multi-Account Setup\n\nAdd multiple ChatGPT accounts for higher combined quotas. The plugin uses **health-aware rotation** with automatic failover.\n\n```bash\nopencode auth login  # Run again to add more accounts\n```\n\n**Manage accounts:**\n- `openai-accounts` — List all accounts\n- `openai-accounts-switch` — Switch active account\n- `openai-accounts-status` — Show rate limit status\n\n**How rotation works (v4.4.0+):**\n- Health scoring tracks success/failure per account\n- Token bucket prevents hitting rate limits\n- Hybrid selection prefers healthy accounts with available tokens\n- Always retries when all accounts are rate-limited (waits for reset)\n\n**Storage:** `~/.opencode/openai-codex-accounts.json`\n\n---\n\n## Troubleshoot\n\n\u003e **Quick Reset**: Most issues can be resolved by deleting `~/.opencode/auth/openai.json` and running `opencode auth login` again.\n\n### Configuration Path (All Platforms)\n\nOpenCode uses `~/.config/opencode/` on **all platforms** including Windows.\n\n| File | Path |\n|------|------|\n| Main config | `~/.config/opencode/opencode.json` |\n| Auth tokens | `~/.opencode/auth/openai.json` |\n| Multi-account | `~/.opencode/openai-codex-accounts.json` |\n| Plugin config | `~/.opencode/openai-codex-auth-config.json` |\n| Debug logs | `~/.opencode/logs/codex-plugin/` |\n\n\u003e **Windows users**: `~` resolves to your user home directory (e.g., `C:\\Users\\YourName`).\n\n---\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e401 Unauthorized Error\u003c/b\u003e\u003c/summary\u003e\n\n**Cause:** Token expired or not authenticated.\n\n**Solutions:**\n1. Re-authenticate:\n   ```bash\n   opencode auth login\n   ```\n2. Check auth file exists:\n   ```bash\n   cat ~/.opencode/auth/openai.json\n   ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eBrowser Doesn't Open for OAuth\u003c/b\u003e\u003c/summary\u003e\n\n**Cause:** Port 1455 conflict or SSH/WSL environment.\n\n**Solutions:**\n1. **Manual URL paste:**\n   - Re-run `opencode auth login`\n   - Select **\"ChatGPT Plus/Pro (Manual URL Paste)\"**\n   - Paste the full redirect URL after login\n\n2. **Check port availability:**\n   ```bash\n   # macOS/Linux\n   lsof -i :1455\n   \n   # Windows\n   netstat -ano | findstr :1455\n   ```\n\n3. **Stop Codex CLI if running** — both use port 1455\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eModel Not Found\u003c/b\u003e\u003c/summary\u003e\n\n**Cause:** Missing provider prefix or config mismatch.\n\n**Solutions:**\n1. Use `openai/` prefix:\n   ```bash\n   # Correct\n   --model=openai/gpt-5.2\n   \n   # Wrong\n   --model=gpt-5.2\n   ```\n\n2. Verify model is in your config:\n   ```json\n   { \"models\": { \"gpt-5.2\": { ... } } }\n   ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eRate Limit Exceeded\u003c/b\u003e\u003c/summary\u003e\n\n**Cause:** ChatGPT subscription usage limit reached.\n\n**Solutions:**\n1. Wait for reset (plugin shows timing in error message)\n2. Add more accounts: `opencode auth login`\n3. Switch to a different model family\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMulti-Turn Context Lost\u003c/b\u003e\u003c/summary\u003e\n\n**Cause:** Old plugin version or missing config.\n\n**Solutions:**\n1. Update plugin:\n   ```bash\nnpx -y opencode-openai-codex-auth-multi@latest\n   ```\n2. Ensure config has:\n   ```json\n   {\n     \"include\": [\"reasoning.encrypted_content\"],\n     \"store\": false\n   }\n   ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eOAuth Callback Issues (Safari/WSL/Docker)\u003c/b\u003e\u003c/summary\u003e\n\n**Safari HTTPS-Only Mode:**\n- Use Chrome or Firefox instead, or\n- Temporarily disable Safari \u003e Settings \u003e Privacy \u003e \"Enable HTTPS-Only Mode\"\n\n**WSL2:**\n- Use VS Code's port forwarding, or\n- Configure Windows → WSL port forwarding\n\n**SSH / Remote:**\n```bash\nssh -L 1455:localhost:1455 user@remote\n```\n\n**Docker / Containers:**\n- OAuth with localhost redirect doesn't work in containers\n- Use SSH port forwarding or manual URL flow\n\n\u003c/details\u003e\n\n---\n\n## Plugin Compatibility\n\n### oh-my-opencode\n\nWorks alongside oh-my-opencode. No special configuration needed.\n\n```json\n{\n  \"plugin\": [\n    \"opencode-openai-codex-auth-multi@latest\",\n    \"oh-my-opencode@latest\"\n  ]\n}\n```\n\n### @tarquinen/opencode-dcp\n\nList this plugin BEFORE DCP:\n\n```json\n{\n  \"plugin\": [\n    \"opencode-openai-codex-auth-multi@latest\",\n    \"@tarquinen/opencode-dcp@latest\"\n  ]\n}\n```\n\n### Plugins you don't need\n\n- **openai-codex-auth** — Not needed. This plugin replaces the original.\n\n---\n\n## Configuration\n\nCreate `~/.opencode/openai-codex-auth-config.json` for optional settings:\n\n### Model Behavior\n\n| Option | Default | What it does |\n|--------|---------|--------------|\n| `codexMode` | `true` | Uses Codex-OpenCode bridge prompt (synced with latest Codex CLI) |\n\n### Retry Behavior (v4.4.0+)\n\n| Option | Default | What it does |\n|--------|---------|--------------|\n| `retryAllAccountsRateLimited` | `true` | Wait and retry when all accounts are rate-limited |\n| `retryAllAccountsMaxWaitMs` | `0` | Max wait time (0 = unlimited) |\n| `retryAllAccountsMaxRetries` | `Infinity` | Max retry attempts |\n\n### Environment Variables\n\n```bash\nDEBUG_CODEX_PLUGIN=1 opencode                    # Enable debug logging\nENABLE_PLUGIN_REQUEST_LOGGING=1 opencode         # Log all API requests\nCODEX_PLUGIN_LOG_LEVEL=debug opencode            # Set log level (debug|info|warn|error)\nCODEX_MODE=0 opencode                            # Temporarily disable bridge prompt\n```\n\nFor all options, see [docs/configuration.md](docs/configuration.md).\n\n---\n\n## Documentation\n\n- [Getting Started](docs/getting-started.md) — Complete installation guide\n- [Configuration](docs/configuration.md) — All configuration options\n- [Troubleshooting](docs/troubleshooting.md) — Common issues and fixes\n- [Architecture](docs/development/ARCHITECTURE.md) — How the plugin works\n\n---\n\n## Credits\n\n- [numman-ali/opencode-openai-codex-auth](https://github.com/numman-ali/opencode-openai-codex-auth) by [numman-ali](https://github.com/numman-ali) — Original plugin\n- [ndycode](https://github.com/ndycode) — Multi-account support and maintenance\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eLegal\u003c/b\u003e\u003c/summary\u003e\n\n### Intended Use\n\n- Personal / internal development only\n- Respect subscription quotas and data handling policies\n- Not for production services or bypassing intended limits\n\n### Warning\n\nBy using this plugin, you acknowledge:\n\n- **Terms of Service risk** — This approach may violate ToS of AI model providers\n- **No guarantees** — APIs may change without notice\n- **Assumption of risk** — You assume all legal, financial, and technical risks\n\n### Disclaimer\n\n- Not affiliated with OpenAI. This is an independent open-source project.\n- \"ChatGPT\", \"GPT-5\", \"Codex\", and \"OpenAI\" are trademarks of OpenAI, L.L.C.\n\n\u003c/details\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndycode%2Fopencode-openai-codex-auth-multi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndycode%2Fopencode-openai-codex-auth-multi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndycode%2Fopencode-openai-codex-auth-multi/lists"}