{"_id":"@bdliyq/opencode-rate-limit-retry","_rev":"4-320d37e7a446076cd0ceee8eb1d00ece","name":"@bdliyq/opencode-rate-limit-retry","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@bdliyq/opencode-rate-limit-retry","version":"1.0.0","keywords":["opencode","plugin","rate-limit","retry","exponential-backoff"],"license":"MIT","_id":"@bdliyq/opencode-rate-limit-retry@1.0.0","maintainers":[{"name":"bdliyq","email":"bdlittlebear@gmail.com"}],"dist":{"shasum":"5951741cac406d5099d2ae81037f1e049ac49fc3","tarball":"https://registry.npmjs.org/@bdliyq/opencode-rate-limit-retry/-/opencode-rate-limit-retry-1.0.0.tgz","fileCount":5,"integrity":"sha512-z5mAhS6fFAFsZ1G81TqxJmpImN32iwmU4gbuavE7hXbCfRK8oTrB8TTAbwDyriGd32m5Ooim2udjMRrYkokfKw==","signatures":[{"sig":"MEQCIAEKaHObrax3U1ehhuXCYdPaxB3282p+QhVopYaIJBoxAiBfjCJFOFmYmOaV6LQG3O7z7D2NndneQWNy1/i1M5UJ/A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14682},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"e04a3b7edecc41df01b346d8c586e16f97d82fb3","scripts":{"dev":"tsc --watch","build":"tsc"},"_npmUser":{"name":"bdliyq","email":"bdlittlebear@gmail.com"},"_npmVersion":"11.12.1","description":"OpenCode plugin that retries the same model with exponential backoff on rate limit errors","directories":{},"_nodeVersion":"25.9.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.5.2","@opencode-ai/plugin":"^1.0.0"},"peerDependencies":{"@opencode-ai/plugin":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/opencode-rate-limit-retry_1.0.0_1775553638580_0.5084964884921244","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bdliyq/opencode-rate-limit-retry","version":"1.0.1","keywords":["opencode","plugin","rate-limit","retry","exponential-backoff"],"license":"MIT","_id":"@bdliyq/opencode-rate-limit-retry@1.0.1","maintainers":[{"name":"bdliyq","email":"bdlittlebear@gmail.com"}],"dist":{"shasum":"64ecfdb3b94b71b4b01d2b9d619ace499dcca31d","tarball":"https://registry.npmjs.org/@bdliyq/opencode-rate-limit-retry/-/opencode-rate-limit-retry-1.0.1.tgz","fileCount":5,"integrity":"sha512-UuIDOb6MRosr9foBsrodNPGKTunSYBeFCg1GV7UdVqyYebFCYto5AUITEMX/8IxWZnU2/WRYa2Vp4AZeEKAaXw==","signatures":[{"sig":"MEYCIQDQ8y5WhTy/MfNmD1VnHdMAJYKaPyzZ1zEwLJx03D7JMQIhAKzAHofnKqwxmR01NQXRH1c2pPYjL5GSQtV2fh5wxQYY","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14641},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"e04a3b7edecc41df01b346d8c586e16f97d82fb3","scripts":{"dev":"tsc --watch","build":"tsc"},"_npmUser":{"name":"bdliyq","email":"bdlittlebear@gmail.com"},"_npmVersion":"11.12.1","description":"OpenCode plugin that retries the same model with exponential backoff on rate limit errors","directories":{},"_nodeVersion":"25.9.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.5.2","@opencode-ai/plugin":"^1.0.0"},"peerDependencies":{"@opencode-ai/plugin":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/opencode-rate-limit-retry_1.0.1_1775555651575_0.7902865474570249","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bdliyq/opencode-rate-limit-retry","version":"1.0.2","keywords":["opencode","plugin","rate-limit","retry","exponential-backoff"],"license":"MIT","_id":"@bdliyq/opencode-rate-limit-retry@1.0.2","maintainers":[{"name":"bdliyq","email":"bdlittlebear@gmail.com"}],"dist":{"shasum":"200a4e5103872a69b01df4c11f61bbfaa96267b1","tarball":"https://registry.npmjs.org/@bdliyq/opencode-rate-limit-retry/-/opencode-rate-limit-retry-1.0.2.tgz","fileCount":5,"integrity":"sha512-CE3x+r64btEeXGWoSq/l1yLX8hhiM5tiOAWoY+Q3GlkIW7y6fsth2QindTxY/+pf7Sjct/zGU5DAC8uvC8FRWA==","signatures":[{"sig":"MEUCIQCecInvI620iQM2X8Qs4qId6/Q2+1U61IPybx2WiRZBbwIgSuDJSWGehHBRA7AyAeOSs8HTdPtpNoUH13PWmsNaRnk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13339},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"e04a3b7edecc41df01b346d8c586e16f97d82fb3","scripts":{"dev":"tsc --watch","build":"tsc"},"_npmUser":{"name":"bdliyq","email":"bdlittlebear@gmail.com"},"_npmVersion":"11.12.1","description":"OpenCode plugin that retries the same model with exponential backoff on rate limit errors","directories":{},"_nodeVersion":"25.9.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^25.5.2","@opencode-ai/plugin":"^1.0.0"},"peerDependencies":{"@opencode-ai/plugin":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/opencode-rate-limit-retry_1.0.2_1775556630491_0.9797618783078412","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bdliyq/opencode-rate-limit-retry","version":"1.0.3","description":"OpenCode plugin that retries the same model with exponential backoff on rate limit errors","type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","dev":"tsc --watch"},"keywords":["opencode","plugin","rate-limit","retry","exponential-backoff"],"license":"MIT","peerDependencies":{"@opencode-ai/plugin":"^1.0.0"},"devDependencies":{"@opencode-ai/plugin":"^1.0.0","@types/node":"^25.5.2","typescript":"^5.0.0"},"gitHead":"e04a3b7edecc41df01b346d8c586e16f97d82fb3","_id":"@bdliyq/opencode-rate-limit-retry@1.0.3","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-xqcLCT4RGPO4THO9ha+dukPKC2Oa5vcWuhm2Ql5qcGFlAd0p4ft/TIRQMfC8yRczMT6iKXX2HlFDmWmM0SXqPg==","shasum":"6399b5693734a52798a010ff0266084eb81a4c4a","tarball":"https://registry.npmjs.org/@bdliyq/opencode-rate-limit-retry/-/opencode-rate-limit-retry-1.0.3.tgz","fileCount":5,"unpackedSize":13479,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCkm2bTqyjktpIBZcLwTG47bhbWxXaNukaJEjXwDSt1pwIhAPIpBouJU+yuMo8FDZbr860Qmj11O+tW24VNS8wAVKh1"}]},"_npmUser":{"name":"bdliyq","email":"bdlittlebear@gmail.com"},"directories":{},"maintainers":[{"name":"bdliyq","email":"bdlittlebear@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-rate-limit-retry_1.0.3_1775557758793_0.6702481861053329"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-07T09:20:38.471Z","modified":"2026-04-07T10:29:19.047Z","1.0.0":"2026-04-07T09:20:38.722Z","1.0.1":"2026-04-07T09:54:11.712Z","1.0.2":"2026-04-07T10:10:30.636Z","1.0.3":"2026-04-07T10:29:18.931Z"},"license":"MIT","keywords":["opencode","plugin","rate-limit","retry","exponential-backoff"],"description":"OpenCode plugin that retries the same model with exponential backoff on rate limit errors","maintainers":[{"name":"bdliyq","email":"bdlittlebear@gmail.com"}],"readme":"# @bdliyq/opencode-rate-limit-retry\n\nOpenCode plugin that retries the **same model** with exponential backoff when rate limited. Unlike model-switching fallback plugins, this keeps using your configured model and waits before retrying.\n\n## When to Use\n\n- You only have access to a single model (e.g., OpenCode Zen free tier)\n- You encounter rate limit errors like `\"Request rate increased too quickly\"` and want automatic retry instead of session termination\n- You want configurable backoff rather than relying on OpenCode's built-in (non-configurable) retry\n\n## Installation\n\n### Option 1: Local Plugin File\n\nCopy `src/index.ts` to your OpenCode plugins directory:\n\n```bash\nmkdir -p ~/.config/opencode/plugins\ncp src/index.ts ~/.config/opencode/plugins/rate-limit-retry.ts\n```\n\nAdd to `~/.config/opencode/opencode.json`:\n\n```json\n{\n  \"plugin\": [\n    \"./plugins/rate-limit-retry.ts\"\n  ]\n}\n```\n\n### Option 2: npm Package\n\n```bash\nnpm install @bdliyq/opencode-rate-limit-retry\n```\n\nAdd to `~/.config/opencode/opencode.json`:\n\n```json\n{\n  \"plugin\": [\n    \"@bdliyq/opencode-rate-limit-retry\"\n  ]\n}\n```\n\n## Configuration\n\nCreate `~/.config/opencode/rate-limit-retry.json`:\n\n```json\n{\n  \"enabled\": true,\n  \"maxRetries\": 5,\n  \"baseDelayMs\": 5000,\n  \"maxDelayMs\": 120000,\n  \"jitterFactor\": 0.2,\n  \"errorPatterns\": [\n    \"rate increased too quickly\",\n    \"scale requests more smoothly\",\n    \"ensure system stability\",\n    \"rate limit\",\n    \"rate_limit\",\n    \"too many requests\",\n    \"quota exceeded\",\n    \"usage exceeded\"\n  ]\n}\n```\n\n### Config Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `enabled` | `boolean` | `true` | Enable/disable the plugin |\n| `maxRetries` | `number` | `5` | Maximum retry attempts before giving up |\n| `baseDelayMs` | `number` | `5000` | Initial delay in milliseconds |\n| `maxDelayMs` | `number` | `120000` | Maximum delay cap (2 minutes) |\n| `jitterFactor` | `number` | `0.2` | Random jitter factor (0.2 = ±20%) |\n| `errorPatterns` | `string[]` | See above | Error strings to detect as rate limits |\n\n### Config File Locations\n\nThe plugin searches for config in this order (highest priority first):\n\n1. `~/.config/opencode/rate-limit-retry.json`\n2. `<project>/.opencode/rate-limit-retry.json`\n3. `<project>/rate-limit-retry.json`\n\n## How It Works\n\n```\nRequest → Rate Limit Error Detected → Abort Session\n                                        ↓\n                              Exponential Backoff\n                              (5s → 10s → 20s → ...)\n                                        ↓\n                              Retry Same Model\n                                        ↓\n                              Success / Max Retries\n```\n\n### Retry Timeline\n\n| Attempt | Delay | Cumulative |\n|---------|-------|------------|\n| 1st | ~5s | ~5s |\n| 2nd | ~10s | ~15s |\n| 3rd | ~20s | ~35s |\n| 4th | ~40s | ~75s |\n| 5th | ~80s | ~155s (~2.6 min) |\n\n## Build\n\n```bash\nnpm install\nnpm run build\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}