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

pi-qwen-oauth

v0.2.1

Published

Qwen OAuth provider for pi using the Qwen Portal OpenAI-compatible API.

Readme

pi-qwen-oauth

npm version License: MIT GitHub stars

Qwen OAuth provider for pi. Log in with your qwen.ai account and use Qwen models via the Qwen Portal OpenAI-compatible API.

Qwen is a powerful family of large language models developed by Alibaba Cloud's Tongyi Lab, excelling in reasoning, coding, and multilingual tasks. This project was built with the assistance of Qwen 3.6 Plus — most of the implementation and documentation were authored by the model itself.

Features

  • OAuth Device Code login with PKCE — authenticate via chat.qwen.ai without managing API keys
  • Automatic token refresh — seamless session continuity
  • Correct endpoint routing — OAuth sessions route to https://portal.qwen.ai/v1, DashScope hosts fall back to /compatible-mode/v1
  • Request normalization — system messages formatted as Qwen Portal-compatible content parts
  • Thinking mode — toggle thinking on/off via the TUI reasoning selector (Qwen Portal API supports enable_thinking as a boolean)
  • Optional multi-account mode — register extra Qwen accounts as separate providers (qwen-oauth-2, qwen-oauth-3, ...) to avoid cross-session token conflicts

Quick Start

Install

# Via pi package manager
pi install npm:pi-qwen-oauth

# Or from source
git clone https://github.com/RimuruW/pi-qwen-oauth.git
cd pi-qwen-oauth
pi install .

Use

# Log in with Qwen OAuth
/login qwen-oauth

# Follow the browser/device-code flow in your browser

# Select a model
/model qwen-oauth/coder-model

Models

| Alias | Input | Context | Max Tokens | Reasoning | |---|---|---|---|---| | qwen-oauth/coder-model | text | 1M | 65,536 | ✅ |

Thinking Mode

The model has reasoning enabled. The pi TUI displays a thinking effort selector (off / minimal / low / medium / high). The Qwen Portal API only accepts enable_thinking as a boolean:

| TUI Selection | API Parameter | |---|---| | off | enable_thinking: false | | minimal / low / medium / high | enable_thinking: true |

Granular thinking_budget control is not supported by the Qwen Portal API — the model uses its own internal reasoning budget when thinking is enabled.

Why This Exists

Qwen exposes multiple API surfaces with different authentication flows:

| Auth Method | Endpoint | |---|---| | Qwen OAuth (qwen.ai account) | https://portal.qwen.ai/v1 | | Alibaba Cloud / DashScope API key | https://dashscope.aliyuncs.com/compatible-mode/v1 |

A common mistake is authenticating with Qwen OAuth but sending requests to DashScope paths, which returns 404. This extension handles the full OAuth device-code flow and routes requests to the correct endpoint.

Project Structure

├── index.ts                  # Extension entry point — provider registration & OAuth flow
├── docs/
│   └── multi-profile.md      # Multi-account mode documentation (opt-in)
├── tests/
│   └── qwen-oauth.test.ts    # Provider & normalization tests
├── package.json
└── README.md

No build step — pi loads TypeScript extensions directly via node --experimental-strip-types.

Development

npm run check    # Run tests
npm run prepack  # Run tests before publish

Multi-Account Mode

An opt-in feature for managing multiple Qwen OAuth accounts as separate providers. Set PI_QWEN_OAUTH_PROFILES=true to enable. See docs/multi-profile.md for details.

References

License

MIT