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

opencode-zen-oauth

v1.2.5

Published

OpenCode Zen provider for pi via console device-flow OAuth (workspace member login)

Readme

opencode-zen-oauth

English | Tiếng Việt

Dùng OpenCode Zen trong pi — khỏi cần API key. Member trong workspace cũng xài được.

Cài đặt

pi install npm:opencode-zen-oauth

Vì sao có extension này

Console v2 của OpenCode giấu API key với member, còn token OAuth đem gọi thẳng thì bị từ chối ngoài client chính chủ. Ba bức tường, một extension gỡ hết:

  1. Khỏi quản lý key. /login opencode-zen hiện trang device-code, bạn approve một lần trên browser, pi tự lưu và tự refresh token.
  2. An toàn theo workspace. Approve xong về terminal chọn workspace (cứ để trang web ở "All workspaces"). Mọi request tự gắn đúng header org, /model chỉ hiện model mà workspace đó cho phép.
  3. Danh sách model tự cập nhật. Model list refresh từ chính workspace — model bị disable hay ngoài whitelist của admin tự biến mất, context limit và giá/1M token map tự động.

Đăng nhập

/login opencode-zen        # device code + link hiện trong TUI

Approve trên browser, quay lại terminal chọn workspace, xong. Model nằm dưới opencode-zen/ trong /model. Không cần cài opencode — tất cả chạy qua HTTPS tới opencode.ai.

Dự phòng: set OPENCODE_API_KEY để dùng Zen API key thay vì OAuth.

Models

Ví dụ thật từ một workspace (list của bạn tùy theo workspace):

| id | input | output | cache read | inputs | |----|-------|--------|------------|--------| | glm-5.3-flash | $0.15 | $0.50 | $0.03 | text, image | | deepseek-v4.1-flash | $0.30 | $1.20 | $0.006 | text, image | | big-pickle | $0 | $0 | $0 | text | | muse-spark-1.3-contributor-free | $0 | $0 | $0 | text, image |

Giá/1 triệu token, tính vào workspace đã chọn. Các dòng zero-cost là free tier của Zen: dùng được qua extension này (request mang sẵn các tín hiệu coding-agent mà gateway kiểm tra), xem src/free-tier.ts.

Bảo mật

  • Extension không bao giờ in hay log token và workspace ID của bạn.
  • Đừng tự paste token hay workspace ID vào chat — pi lưu session file những gì bạn gõ. Lỡ lộ thì revoke trong console OpenCode rồi /login opencode-zen lại.

Cấu trúc

  • index.ts — entry point pi load; re-export src/extension.ts
  • src/extension.ts — ráp provider và đăng ký
  • src/auth.ts — login device-flow, chọn workspace, refresh token
  • src/models.ts — map model từ console sang pi, wire protocol từng route
  • src/free-tier.ts — tín hiệu gateway free-tier theo từng route
  • test/ — test suite bun với fetch mock (bun test)

License

MIT