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
Bug: OpenCode CLI v2.3.0 triggers 429 FreeUsageLimitError due to title request misidentification #178
描述 (Description)
Hello, first of all, thank you for the great project! I am using opencode2api as a local proxy for my API relay station.
I'm encountering a 429 FreeUsageLimitError issue specifically when using the official OpenCode CLI v2.3.0. However, the exact same upstream endpoint and keys work perfectly when called via Python (OpenAI SDK), which means the IP pool and quotas are fine. I suspect the issue is related to how v2.3.0 generates Session Title Requests and how the 2api proxy injects system prompts.
It seems that OpenCode v2.3.0 might have changed the structure of its title generation request (e.g., sending extra history messages, or altering the system prompt format).
Because it fails to match your strict identification logic (<= 3 messages and no tools), 2api mistakenly treats the title request as a standard coding request and injects the official toolset (shell, grep, etc.). The upstream OpenCode server detects tools in a title-generation request and immediately rejects it with 429 FreeUsageLimitError (or 403 FreeTierError).
Reacted by Aes Saputra, oracle8walid-svg, retina20 and Amir Sadeghi
Fixed a confirmed classification inconsistency in main 14faec7: 14faec7 . Title detection now runs before prompt/message mutations. Adding a system message or folding system/developer messages can no longer change the classification used for tool injection versus retries/fallback. Existing title phrases, no-tools/history restrictions, retry budgets and session IDs are unchanged. Offline v1/v2 three/four-message boundary regressions passed. The commit also preserves upstream HTTP errors and Retry-After across later transport failures. Keeping this issue open: the reported OpenCode 2.3.0 payload was not available and no live upstream request was made, so this is not proof its 429 is resolved. Please retest an updated binary; only share a minimal sanitized reproduction, never credentials/auth headers or private prompts.
This is the same cause as #181: the free tier refuses the literal clint_ wire-name prefix, which the gateway prepends to every renamed client tool on a shaped free-model request. It is not the session, the title request, or the injected prompt.
Evidence, one identical official-CLI chat body (75,654 B, 20 tools), same session id, project id and egress, two builds of 14faec7 differing only in that constant:
wire-name prefix
result
clint_ (current main)
429 FreeUsageLimitError in 3.4 s
mcp_
200 in 2.6 s, tool call restored to shell, follow-up with the tool result → 200 with the final answer
CLINT_
429
clint (no underscore)
200
client_, copilot_, mcp_, srv_, fn_, zz_
200
client names passed through, shaping bypassed, prompt injection only
200
Your Python SDK call works for exactly that reason: with no tools array (or with a body that is not shaped), no clint_ name is ever generated.
Fix is #182, head 75bb45d — ClientToolPrefix becomes mcp_, response restoration reads the same constant, so nothing else moves. It is verified live on both the /v1/messages and official-CLI chat paths. A retest with the commit hash is what would close this out; no credentials or private prompts needed.
Activity
fix(gateway): harden free-tier retries and client compatibility
jasonxu114514 commentedon Nov 16, 2026
Fixed a confirmed classification inconsistency in main 14faec7: 14faec7 . Title detection now runs before prompt/message mutations. Adding a system message or folding system/developer messages can no longer change the classification used for tool injection versus retries/fallback. Existing title phrases, no-tools/history restrictions, retry budgets and session IDs are unchanged. Offline v1/v2 three/four-message boundary regressions passed. The commit also preserves upstream HTTP errors and Retry-After across later transport failures. Keeping this issue open: the reported OpenCode 2.3.0 payload was not available and no live upstream request was made, so this is not proof its 429 is resolved. Please retest an updated binary; only share a minimal sanitized reproduction, never credentials/auth headers or private prompts.
unrayed commentedon Nov 16, 2026
This is the same cause as #181: the free tier refuses the literal
clint_wire-name prefix, which the gateway prepends to every renamed client tool on a shaped free-model request. It is not the session, the title request, or the injected prompt.Evidence, one identical official-CLI chat body (75,654 B, 20 tools), same session id, project id and egress, two builds of
14faec7differing only in that constant:clint_(current main)FreeUsageLimitErrorin 3.4 smcp_shell, follow-up with the tool result → 200 with the final answerCLINT_clint(no underscore)client_,copilot_,mcp_,srv_,fn_,zz_Your Python SDK call works for exactly that reason: with no
toolsarray (or with a body that is not shaped), noclint_name is ever generated.Fix is #182, head
75bb45d—ClientToolPrefixbecomesmcp_, response restoration reads the same constant, so nothing else moves. It is verified live on both the/v1/messagesand official-CLI chat paths. A retest with the commit hash is what would close this out; no credentials or private prompts needed.