This plugin provides OAuth authentication for Qwen Code models in OpenCode.
- When no credentials exist, the plugin initiates OAuth Device Flow
- User authenticates via browser at
chat.qwen.ai - Tokens are stored securely and automatically refreshed
- Credentials stored in:
~/.config/opencode/qwen-accounts.json - Configuration stored in:
~/.config/opencode/qwen-auth.json - Each account gets ~2000 requests/day
The plugin handles rate limits automatically:
- Parses
retry-after-msandx-error-codeheaders - Implements exponential backoff
- Switches to healthy accounts when rate-limited
Enable debug logging:
OPENCODE_QWEN_DEBUG=1 opencode ...Or set quiet_mode: false in config.
When asked to sync with Qwen Code or check for updates:
- Load the skill:
qwen-code-updater - Follow the steps in SKILL.md
- Compare:
src/constants.tsandsrc/qwen/oauth.tswith QwenLM/qwen-code
Key values to check:
- Client ID:
f0304373b74a44d2b584a3fb70ca9e56 - OAuth URL:
https://chat.qwen.ai - Scope:
openid profile email model.completion
bun test