npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iamtoricool/opencool-qwen-auth

v0.2.0

Published

Qwen AI OAuth Authentication Plugin for opencode - Access Qwen models via chat.qwen.ai subscription

Downloads

1,327

Readme

OpenCool Qwen Auth Plugin

Qwen AI OAuth Authentication Plugin for opencode - Access Qwen models via your chat.qwen.ai subscription.

Overview

This plugin enables opencode to use Qwen AI's models (Qwen3 Max, Qwen3 Coder, etc.) via OAuth authentication with Qwen's chat platform. Instead of using API keys, you can authenticate using your existing Qwen Chat subscription.

Supported Models

  • qwen3-max - Most capable Qwen3 model for complex tasks
  • qwen3-coder-plus - Optimized for code generation and programming
  • qwen3-vl-plus - Vision language model for image understanding
  • qwen3-235b-a22b - Large mixture-of-experts model

Installation

npm install @iamtoricool/opencool-qwen-auth

Configuration

Add to your ~/.opencode/opencode.json:

{
  "plugin": ["@iamtoricool/opencool-qwen-auth"],
  "provider": {
    "qwen": {
      "options": {}
    }
  },
  "model": "qwen/qwen3-max",
  "models": {
    "qwen3-max": {
      "id": "qwen3-max",
      "name": "Qwen3 Max",
      "variants": {
        "latest": "qwen3-max"
      }
    }
  }
}

Authentication

Run the login command:

opencode providers login qwen

This will:

  1. Open your browser to Qwen's OAuth authorization page
  2. Start a local callback server on port 1455
  3. Exchange the authorization code for access/refresh tokens
  4. Store tokens securely for future use

Features

  • OAuth 2.0 with PKCE - Secure authentication flow
  • Token Refresh - Automatic token refresh when expired
  • Model Configuration - Per-model options support
  • Streaming Support - Full SSE streaming for real-time responses
  • Fallback Options - Manual URL paste if browser auto-open fails

Architecture

The plugin follows the opencode plugin architecture:

index.ts              # Main plugin entry point
lib/
  types.ts            # TypeScript type definitions
  constants.ts        # OAuth endpoints, client IDs, models
  config.ts           # Configuration loading
  logger.ts           # Request logging
  auth/
    auth.ts           # PKCE, token exchange, JWT decode
    server.ts         # Local OAuth callback server
    browser.ts        # Platform-specific browser opening
  request/
    fetch-helpers.ts  # 7-step fetch orchestration
    request-transformer.ts  # Model normalization, body transforms
    response-handler.ts     # SSE parsing
config/
  opencode-modern.json    # Model definitions
test/                 # Comprehensive test suite

Development

# Install dependencies
npm install

# Run type check
npm run typecheck

# Run tests
npm test

# Run tests with watch mode
npm run test:watch

OAuth Configuration

The plugin uses Qwen's OAuth endpoints:

  • Authorization URL: https://auth.qwen.ai/oauth/authorize
  • Token URL: https://auth.qwen.ai/oauth/token
  • API Base: https://chat.qwen.ai/backend-api
  • Redirect URI: http://localhost:1455/auth/callback
  • Scopes: openid profile email offline_access

License

MIT

Contributing

Contributions are welcome! Please ensure tests pass before submitting PRs.