Skip to content

feat(v1.5.0): fix rate limiting (#4) + dynamic endpoints + official h…#8

Open
luanweslley77 wants to merge 1 commit intogustavodiasdev:mainfrom
luanweslley77:feat/v1.5.0-rate-limit-fix
Open

feat(v1.5.0): fix rate limiting (#4) + dynamic endpoints + official h…#8
luanweslley77 wants to merge 1 commit intogustavodiasdev:mainfrom
luanweslley77:feat/v1.5.0-rate-limit-fix

Conversation

@luanweslley77
Copy link

📋 Summary

This PR resolves the critical rate limiting issue (#4) and introduces dynamic API endpoint resolution with official Qwen Code headers for proper quota recognition.

Fixes #4

✨ Key Changes
Rate Limiting Fix (Issue #4)

Added QWEN_OFFICIAL_HEADERS with required identification headers

Session tracking with unique sessionId per plugin instance

Prompt tracking with unique promptId per request

Full 2,000 requests/day quota now available

Dynamic API Endpoint Resolution

Automatic region detection based on OAuth token resource_url

Support for portal.qwen.ai, dashscope, and dashscope-intl

Works globally with any Qwen account region

Latest Model Support

Added qwen3.5-plus – Latest flagship hybrid model

Vision capabilities with dynamic modalities

Enhanced config hook with proper headers

📁 Files Modified

src/constants.ts – Official headers + qwen3.5-plus model

src/index.ts – Session tracking + headers in loader

src/plugin/auth.ts – loadCredentials() + resolveBaseUrl()

package.json – Version 1.5.0

🧪 Testing

Tested with:

Fresh OAuth authentication

Multiple consecutive requests (no rate limiting)

Session persistence across restarts

qwen3.5-plus model

🔄 Comparison with PR #7

This PR includes all features from PR #7 plus:

✅ Complete official headers (not just DashScope-specific)

✅ Session and prompt tracking for quota recognition

✅ qwen3.5-plus model support

✅ Vision capabilities in modalities

✅ Direct fix for Issue #4

…s + official headers

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@ahmedtohamy1
Copy link

@luanweslley77 hey thanks for the good updated fork as title says it happens too much and not happening in the cli
opencode stuck on nothing and cant stop

@luanweslley77
Copy link
Author

@luanweslley77 hey thanks for the good updated fork as title says it happens too much and not happening in the cli opencode stuck on nothing and cant stop

Thank you for letting me know. I've been working on my fork, and I'll be posting another PR here soon. You can download the source code from my main branch at https://github.com/luanweslley77/opencode-qwencode-auth, take the directory and replace ~/.config/opencode/node_modules/opencode-qwencode-auth with my code. It's also necessary to replace ~/.cache/opencode/node_modules/opencode-qwencode-auth. This is working well for me. If you encounter any problems, initially delete the file ~/.qwen/oauth_creds.json.

@slkiser
Copy link

slkiser commented Mar 14, 2026

I don't think Qwen has 2000 req/day. The official docs say 1000 req/day here: https://qwenlm.github.io/qwen-code-docs/en/users/configuration/auth/

Cost & quota: free, with a quota of 60 requests/minute and 1**,000 requests/day**.

@bendtherules
Copy link

bendtherules commented Mar 14, 2026

Thanks @kozlov-aa for fix.
To install this branch: npm install github:luanweslley77/opencode-qwencode-auth.git#feat/v1.5.0-rate-limit-fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Getting rate limited really fast

4 participants