跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    gustavodiasdev

    Qwencode Auth

    v1.3.0认证与凭证
    opencode-qwencode-auth

    Qwen OAuth authentication plugin for OpenCode - Access Qwen AI models (Coder, Vision) with your qwen.ai account

    GitHub 星标

    78

    近 30 天 +1

    月装机量

    291

    近 7 天 90

    综合评分SCORE

    48.2

    生态多维模型

    最近提交

    2 个月前

    2026-06-02

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-qwencode-auth@1.3.0"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    npm version License GitHub stars

    OpenCode with Qwen Code

    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-code client. The coder-model alias 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:

    1. Re-authenticate: Run opencode auth login again.
    2. 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