You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: kimi-for-coding provider gets 429 engine overloaded due to missing User-Agent header #27902
The built-in kimi-for-coding provider uses @ai-sdk/anthropic, which sends Anthropic/JS x.x.x as the User-Agent on every request. Kimi's /coding gateway intermittently returns HTTP 429 engine overloaded for requests from non-whitelisted agents — even with a valid paid API key and available quota.
Setting User-Agent: KimiCLI/1.5 (a whitelisted coding agent UA) significantly reduces these 429s in practice. The same fix is documented for other clients using the Anthropic SDK against Kimi's endpoint.
Plugins
none (built-in provider)
OpenCode version
1.15.3
Steps to reproduce
Set up the built-in kimi-for-coding provider with a valid KIMI_API_KEY
Send messages using a kimi-for-coding model (k2p6, k2p5, kimi-k2-thinking)
Observe intermittent 429 {"error":{"type":"rate_limit_error","message":"The engine is currently overloaded, please try again later"}}
The 429s are intermittent but noticeably reduced after overriding the User-Agent to KimiCLI/1.5.
Operating System
macOS 26.0
Reacted by FadoGhani, tapcrapioca, Brian, hesitorremitos, Seabiscuit, Alexandr Klimovich, 椰格, tomatofrommars and CrazyTomatoOo
User-Agent in custom provider options.headers is overridden #24594: User-Agent in custom provider options.headers is overridden — reports that opencode hardcodes its own User-Agent, overriding any user-set value, which would also affect the built-in kimi-for-coding provider
In other words, #24594 is why the fix cannot go in custom() via options.headers (the pattern used by Cloudflare and GitLab providers, which are also silently broken for UA today). The PR uses model.headers in fromModelsDevModel specifically to work around this.
I experienced this issue between 5/11 - 5/13 using both anthropic and openai-compatible. On 5/13, I manually patched OpenCode 1.14.50 to use a KimiCLI User-Agent:
That fixed the issue and I have not received the error since. Others on the Kimi Discord continue to report the error. Those that apply the patch also report that replacing the User-Agent resolves the issue.
Activity
github-actions commentedon May 16, 2026
This issue might be a duplicate of existing issues. Please check:
bzqzheng commentedon May 16, 2026
Not a duplicate — these are related but distinct:
kimi-for-codingprovider having noUser-Agentset at all.options.headersis overridden by the hardcodedopencode/${version}UA inllm.ts— this was broken by the revert in fix: revert change that caused headers to be double merged if provider was authed in multiple places #12072. Our fix sets the UA inmodel.headersinstead, which is spread atllm.ts:382after the default UA at line 380, so it wins.In other words, #24594 is why the fix cannot go in
custom()viaoptions.headers(the pattern used by Cloudflare and GitLab providers, which are also silently broken for UA today). The PR usesmodel.headersinfromModelsDevModelspecifically to work around this.BrianJM commentedon May 16, 2026
I experienced this issue between 5/11 - 5/13 using both
anthropicandopenai-compatible. On 5/13, I manually patched OpenCode1.14.50to use a KimiCLI User-Agent:That fixed the issue and I have not received the error since. Others on the Kimi Discord continue to report the error. Those that apply the patch also report that replacing the User-Agent resolves the issue.
CrazyTomatoOo commentedon May 18, 2026
Is there any workaround for this? I can no longer use my Kimi coding plan.
tapcrapioca commentedon May 18, 2026
The workaround has been mentioned right above your reply. You can ask Kimi on web to help you implement the patch.
bzqzheng commentedon May 18, 2026
Try add this to opencode config
BrianJM commentedon May 19, 2026
This did not work for me due to the open defects: #27902 (comment).
CrazyTomatoOo commentedon May 19, 2026
Use plugin
opencode-kimi-fullcan workaround this, even better than native.CrazyTomatoOo commentedon May 21, 2026
When will this issue be fixed? It's been almost a week already.
github-actions commentedon Jul 21, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.