opencode-qwencode-authQwen OAuth authentication plugin for OpenCode - Access Qwen AI models (Coder, Vision) with your qwen.ai account
78
+1 in 30 days
291
90 in 7 days
48.2
Multi-signal model
2 months ago
2026-06-02
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-qwencode-auth@1.3.0"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-qwencode-auth@1.3.0"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-qwencode-authopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
Authenticate OpenCode CLI with your qwen.ai account. This plugin enables you to use the coder-model with 1,000 free requests per day — powered by Qwen 3.6 Plus with video and vision support. No API key or credit card required!
🇧🇷 Leia em Português | 📜 Changelog
✨ Features
- 🔐 OAuth Device Flow - Secure browser-based authentication (RFC 8628)
- 🆓 1,000 req/day free - Free quota reset daily at midnight UTC
- ⚡ 60 req/min - Rate limit of 60 requests per minute
- 🧠 1M context window - Massive context support for large projects
- 🔄 Auto-refresh - Tokens renewed automatically before expiration
- ⏱️ Reliability - Built-in request throttling and automatic retry for transient errors
- 🔗 qwen-code compatible - Reuses credentials from
~/.qwen/oauth_creds.json
🚀 Installation
Edit ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-qwencode-auth"]
}
That's it! OpenCode will automatically install the plugin at startup.
Alternative installation methods
From npm (explicit version)
{
"plugin": ["opencode-qwencode-auth@latest"]
}
From Git repository
{
"plugin": ["opencode-qwencode-auth@git+https://github.com/gustavodiasdev/opencode-qwencode-auth.git#main"]
}
Specific version
{
"plugin": ["opencode-qwencode-auth@1.3.0"]
}
⚠️ Limits & Quotas
- Rate Limit: 60 requests per minute
- Daily Quota: 1,000 requests per day (reset at midnight UTC)
- Web Search: 200 requests/minute, 1,000/day (separate quota)
Note: These limits are set by the Qwen OAuth API and may change. For professional use with higher quotas, consider using a DashScope API Key.
🔑 Usage
1. Login
Run the following command to start the OAuth flow:
opencode auth login
2. Select Provider
Choose "Other" and type qwen-code.
3. Authenticate
Select "Qwen Code (qwen.ai OAuth)".
- A browser window will open for you to authorize.
- The plugin automatically detects when you complete authorization.
- No need to copy/paste codes or press Enter!
🎯 Available Models
Coding Model
| Model | Context | Max Output | Features |
|---|---|---|---|
coder-model |
1M tokens | Up to 64K tokens | Qwen 3.6 Plus — video & vision support |
Note: This plugin aligns with the official
qwen-codeclient. Thecoder-modelalias maps to Qwen 3.6 Plus with hybrid reasoning, vision, and video input capabilities.
Using the model
opencode --provider qwen-code --model coder-model
🔧 Troubleshooting
"Invalid access token" or "Token expired"
The plugin usually handles refresh automatically. If you see this error immediately:
- Re-authenticate: Run
opencode auth loginagain. - Clear cache: Delete the credentials file and login again:
rm ~/.qwen/oauth_creds.json opencode auth login
Rate limit exceeded (429 errors)
If you hit the 60 req/min or 1,000 req/day limits:
- Rate limit (60/min): Wait a few minutes before trying again
- Daily quota (1,000/day): Wait until midnight UTC for the quota to reset
- Web Search (200/min, 1,000/day): Separate quota for web search tool
- Consider using a DashScope API Key for professional use with higher quotas
Enable Debug Logs
If something isn't working, you can see detailed logs by setting the debug environment variable:
OPENCODE_QWEN_DEBUG=1 opencode
🛠️ Development
# Clone the repository
git clone https://github.com/gustavodiasdev/opencode-qwencode-auth.git
cd opencode-qwencode-auth
# Install dependencies
bun install
# Run tests
bun run tests/debug.ts full
Project Structure
src/
├── qwen/ # OAuth implementation
├── plugin/ # Token management & caching
├── utils/ # Retry, locking and logging utilities
├── constants.ts # Models and endpoints
└── index.ts # Plugin entry point
📄 License
MIT
Made with ❤️ for the OpenCode community