Implement exponential back-off when hitting rate limits
OpenAI has some brutal RPM rate limits on tier 1, which will often abruptly stop opencode and requires me to manually resume by sending 'continue' message.
An exponential back-off with auto-retry would keep the agent loop running, it'd just take a bit longer to complete when rate limits are hit.
If that helps here is error you get when you hit rate limit:
{"type":"error","sequence_number":2,"error":{"type":"tokens","code":"rate_limit_exceeded","message":"Rate limit reached
for gpt-5-mini in organization org-XXXXXXXXXXXXXX on tokens per min (TPM): Limit 200000, Used 124035,
Requested 79017. Please try again in 915ms. Visit https://platform.openai.com/account/rate-limits to learn
more.","param":null}}
Same here: {"type":"error","sequence_number":2,"error":{"type":"tokens","code":"rate_limit_exceeded","message":"Rate limit reached for gpt-5 in organization org-************* on tokens per min (TPM): Limit 30000, Used 14582, Requested 21045. Please try again in 11.254s. Visit https://platform.openai.com/account/rate-limits to learn more.","param":null}}
Yeah, Cerebras and Groq are currently unusable with Opencode right now still because of this.
Constant errors like:
AI_RetryError: Failed after 4 attempts. Last error: Too Many Requests
Same, AI_RetryError: Failed after 4 attempts. Last error: Requests per second limit exceeded - too many requests sent.
cerebras with Qwen 3 Coder 480B
I can't get through the /init without the being blocked by this error, and unfortunately you can't resume the init.
Same here. On each message.
After these rate limit stops, what do you type to make it continue? I've not had great luck.. Cerebras is awesome until the brick wall per minute limit
We have backoff for ratelimits, and we respect the retry-after type headers so once it is ready to retry it should automatically go through