Feature request: automatic back-off + prompt/token optimiser to avoid rate-limit exits
Resolved 💬 4 comments Opened Apr 27, 2025 by lucasrod Closed Aug 7, 2025
Summary
The CLI currently stops immediately when hitting TPM limits.
Adding an auto-back-off / retry mechanism and an optional token-usage report would:
- Prevent unexpected exits (see related bug report).
- Help users trim prompts before submission.
Current version / environment
- Codex CLI rev: v0.1.2504161551
- Model: o4-mini
- Platform: Darwin 24.4.0 arm64 arm
Proposed behaviour
- Retry logic
- Config flags:
--max-retries,--base-delay-ms,--max-delay-ms. - Respect
x-ratelimit-resetor fallback to the numeric seconds in the error message.
- Token usage insight
- After each request, optionally print:
````
Prompt: 18 452 tok Completion: 53 432 tok Total: 71 884 tok
- Provide tips (“Consider removing large binary blobs or minified JS”).
- Docs update
- Add a “Reducing token usage” section with concrete examples (e.g., strip comments, use
<<file:README.md#L1-L200>>inclusions).
Additional information
Similar SDKs (Python / JS official clients) already expose openai.error.RateLimitError handling examples.
Having parity in the CLI would improve UX and reduce load on the API.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗