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-fix

v1.0.1

Published

Fixes Qwen API compatibility issues with tool calling and developer role

Readme

pi-qwen-fix

A pi extension that fixes Qwen API compatibility issues with the alibaba-qwen provider.

Problem

Qwen's DashScope API has two incompatibilities with the standard OpenAI API format:

  1. Tool arguments: Qwen expects function.arguments to be a JSON object, not a stringified JSON string
  2. Developer role: Qwen doesn't support the developer role (used by OpenAI for reasoning models)

This causes errors like:

Error: <400> InternalError.Algo.InvalidParameter: The "function.arguments" parameter of the code model must be in JSON format.
Error: 400 developer is not one of ['system', 'assistant', 'user', 'tool', 'function']

Solution

This extension overrides the alibaba-qwen provider with the correct compatibility settings:

  • stringifyToolArguments: false - Sends tool arguments as JSON objects
  • supportsDeveloperRole: false - Uses "system" role instead of "developer"

Installation

Option 1: Local Installation

  1. Clone or download this repository to your pi extensions directory:

    git clone https://github.com/ricardo-nth/pi-qwen-fix.git ~/.pi/agent/extensions/qwen-fix
  2. Add the extension to your ~/.pi/agent/settings.json:

    {
      "packages": [
        "./extensions/qwen-fix"
      ]
    }
  3. Restart pi

Option 2: NPM Package (Recommended)

Once published to npm:

npm install -g pi-qwen-fix

Then add to ~/.pi/agent/settings.json:

{
  "packages": [
    "npm:[email protected]"
  ]
}

Usage

After installation, all Qwen models from the alibaba-qwen provider will work correctly with tool calling and reasoning features.

Available Models

  • qwen-max-latest - Qwen Max (Latest)
  • qwen3.5-plus - Qwen 3.5 Plus (Free)
  • qwen3.5-397b-a17b - Qwen 3.5 397B A17B (Free)
  • qwen3.5-flash - Qwen 3.5 Flash (Free)
  • And 15+ more Qwen models

Configuration

The extension automatically configures all Qwen models with the correct compatibility settings. No additional configuration is needed.

If you need to customize your API key, edit the extension's index.ts file and update the apiKey field.

Why This Exists

This fix should ideally be part of pi's core alibaba-qwen provider definition. However, until it's merged upstream, this extension provides a workaround that survives pi updates.

For pi Maintainers

The fix requires adding these compat settings to the alibaba-qwen provider in pi's models.json:

{
  "id": "qwen3.5-plus",
  "name": "Qwen 3.5 Plus",
  "reasoning": true,
  "input": ["text", "image"],
  "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
  "contextWindow": 128000,
  "maxTokens": 32768,
  "compat": {
    "stringifyToolArguments": false,
    "supportsDeveloperRole": false
  }
}

And updating the auto-detection in openai-completions.ts to recognize Qwen's DashScope API.

License

MIT

Contributing

Feel free to submit issues or PRs if you encounter other Qwen API compatibility issues!