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 🙏

© 2025 – Pkg Stats / Ryan Hefner

qw-proxy

v1.0.7

Published

HTTP proxy bridge to AgentRouter API via qwen-code

Readme

qw-proxy

HTTP proxy bridge to AgentRouter API via qwen-code SDK.

Allows you to access AgentRouter models through a simple REST API with minimal token overhead (~21 input tokens vs 12k+ default).

Installation

npm install -g qw-proxy

Quick Start

# Basic usage (12k+ input tokens)
AGENTROUTER_API_KEY=sk-xxx qw-proxy

# Optimized usage (~21 input tokens)
mkdir -p .qwen && echo "You are a helpful assistant." > .qwen/system.md
QWEN_SYSTEM_MD=1 AGENTROUTER_API_KEY=sk-xxx qw-proxy

Server starts on http://localhost:3001

Supported Models

| Model | Status | Notes | |-------|--------|-------| | deepseek-v3.2 | ✅ | Default, recommended | | gpt-5.2 | ✅ | GPT-5.2 via AgentRouter | | claude-haiku-4-5-20251001 | ✅ | Fast Claude model | | claude-sonnet-4-5-20250929 | ✅ | Claude Sonnet 4.5 | | glm-4.5 | ✅ | GLM model | | glm-4.6 | ✅ | GLM model |

Set model via AGENTROUTER_MODEL environment variable.

Environment Variables

| Variable | Required | Default | Description | |----------|----------|---------|-------------| | AGENTROUTER_API_KEY | Yes | - | Your AgentRouter API key | | AGENTROUTER_MODEL | No | deepseek-v3.2 | Model to use | | AGENTROUTER_BASE_URL | No | https://agentrouter.org/v1 | API base URL | | PORT | No | 3001 | Server port | | QWEN_SYSTEM_MD | No | - | Set to 1 for minimal tokens |

API Reference

POST /chat

Send a message and get AI response.

Request:

{
  "user_id": "user123",
  "message": "Hello!",
  "images": ["/path/to/image.png"]
}

| Field | Type | Required | Description | |-------|------|----------|-------------| | user_id | string | Yes | Unique user ID for conversation history | | message | string | Yes | User message | | images | string[] | No | Local image paths (vision models) |

Response:

{
  "success": true,
  "response": "Hello! How can I help you?",
  "history_length": 3
}

Example:

curl http://localhost:3001/chat \
  -H "Content-Type: application/json" \
  -d '{"user_id": "test", "message": "Hello!"}'

GET /health

Health check.

{
  "status": "ok",
  "model": "deepseek-v3.2",
  "active_users": 1,
  "active_clients": 1
}

POST /clear

Clear conversation history.

curl -X POST http://localhost:3001/clear \
  -H "Content-Type: application/json" \
  -d '{"user_id": "user123"}'

POST /cancel/:user_id

Cancel ongoing generation.

curl -X POST http://localhost:3001/cancel/user123

GET /api/compression/stats

Get conversation compression statistics.

Features

  • Minimal tokens: ~21 input tokens with QWEN_SYSTEM_MD=1 (vs 12k+ default)
  • Per-user history: Isolated conversation contexts
  • Auto-compression: LLM-based history compression when limit exceeded
  • Vision support: Send images with messages
  • Request cancellation: Cancel ongoing generations
  • 30s timeout: Protection against hanging requests

How It Works

Your App → qw-proxy (localhost:3001) → qwen-code SDK → AgentRouter API → LLM

qwen-code SDK handles authentication with AgentRouter. This proxy exposes it as a simple REST API.

Token Optimization

Default qwen-code includes ~12k tokens of system prompts, tools, and environment context.

To reduce to ~21 tokens:

  1. Create .qwen/system.md with minimal prompt
  2. Set QWEN_SYSTEM_MD=1

The package has patched qwen-code to disable tools and environment context injection.

License

MIT