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-go/cli

v1.0.6

Published

CLI to manage OpenCode Go subscription and launch Claude Code with the correct environment variables

Downloads

859

Readme

OpenCode Go CLI

Use OpenCode Go, OpenAI, Qwen, or Z.ai models with Claude Code.

Bridge Claude Code's Anthropic protocol to multiple provider backends through a local Bun proxy. The CLI handles auth, model selection, proxy startup, and Claude Code launch in one flow.

Bun TypeScript Claude Code License

Why

Claude Code speaks Anthropic natively. This project runs a local proxy that translates Claude Code requests into the provider-specific API format and streams responses back in real time.

Core capabilities:

  • OpenCode Go via API key
  • OpenAI/Codex via OAuth
  • Qwen via OAuth device flow with multi-account rotation
  • Z.ai free GLM models via browser-assisted login
  • Interactive provider, model, and permission-mode selection
  • WebSearch interception via local SearXNG
  • Proxy port fallback when the preferred port is busy
  • Shared model injection for Claude Code sub-agents

Providers

OpenCode Go (--provider opencode)

| ID | Name | Description | |----|------|-------------| | minimax-m2.5 | MiniMax M2.5 | Balanced speed and quality | | minimax-m2.7 | MiniMax M2.7 | High performance coding model | | kimi-k2.5 | Kimi K2.5 | Strong reasoning for complex tasks | | glm-5 | GLM-5 | Latest generation from Zhipu AI | | glm-5.1 | GLM-5.1 | Enhanced reasoning from Zhipu AI |

OpenAI (--provider openai)

| ID | Name | Description | |----|------|-------------| | gpt-5.2 | GPT-5.2 | Latest GPT-5 model | | gpt-5.3 | GPT-5.3 | High performance GPT-5 | | gpt-5.4 | GPT-5.4 | Balanced GPT-5 | | gpt-5.1-codex | GPT-5.1 Codex | Code-optimized GPT-5.1 | | gpt-5.2-codex | GPT-5.2 Codex | Code-optimized GPT-5.2 | | gpt-5.3-codex | GPT-5.3 Codex | Code-optimized GPT-5.3 |

Qwen (--provider qwen)

| ID | Name | Description | |----|------|-------------| | qwen3-coder-plus | Qwen3 Coder Plus | High-performance Qwen coding model | | qwen3-coder-flash | Qwen3 Coder Flash | Fast, cost-efficient Qwen coding model |

Qwen support includes:

  • --qwen-login to add an account through device flow
  • --qwen-list to inspect saved accounts
  • --qwen-test to validate saved accounts
  • --qwen-remove <id-or-email> to remove an account
  • automatic fallback across saved accounts when one is cooling down or fails

Z.ai (--provider zai)

| ID | Name | Description | |----|------|-------------| | glm-4.7 | GLM-4.7 | Fast and reliable, stable availability | | glm-5-turbo | GLM-5 Turbo | Fast GLM-5 variant | | glm-5.1 | GLM-5.1 | Latest GLM with stronger reasoning | | glm-5 | GLM-5 | Base GLM-5 model |

Z.ai support uses --zai-login to capture a token through a Chromium-based browser session.

Interactive Flow

When launched without arguments, the CLI shows:

opencode-go
  -> Start / Settings
     -> choose provider
     -> ensure auth for that provider
     -> choose model
     -> choose permission mode
     -> start proxy and launch Claude Code

Settings includes API key management, OpenAI login/logout, Qwen login and account tools, Z.ai login, and full reset.

CLI

# Interactive mode
opencode-go

# Direct launch
opencode-go --model minimax-m2.7
opencode-go --provider openai --model gpt-5.2-codex
opencode-go --provider qwen --model qwen3-coder-plus
opencode-go --provider zai --model glm-4.7

# Auth
opencode-go --setup
opencode-go --oauth-login
opencode-go --oauth-logout
opencode-go --qwen-login
opencode-go --qwen-list
opencode-go --qwen-test
opencode-go --qwen-remove [email protected]
opencode-go --zai-login

# List models
opencode-go --list
opencode-go --list --provider openai
opencode-go --list --provider qwen
opencode-go --list --provider zai

# Proxy only
opencode-go --proxy --port 8080

# Pass extra flags through to Claude Code
opencode-go --provider openai --model gpt-5.4 -- --dangerously-load-development-channels server:bridge

Runtime Model

The CLI runs in two stages:

Stage 1: CLI
  -> resolves config and auth
  -> starts local proxy
  -> starts SearXNG when needed for web_search
  -> launches Claude Code with ANTHROPIC_BASE_URL=http://localhost:PORT

Stage 2: Proxy
  -> receives POST /v1/messages in Anthropic format
  -> routes by provider
  -> translates streaming or non-streaming responses back to Anthropic

Routing:

  • OpenCode Go -> Chat Completions API
  • OpenAI -> Responses API
  • Qwen -> Chat Completions API with per-request account selection and retry/fallback
  • Z.ai -> Free GLM chat API with custom signing and SSE conversion

Setup

Requirements:

  • Bun runtime
  • Claude Code installed and available in PATH
  • OpenCode Go API key if using opencode
  • ChatGPT Plus/Pro account if using openai
  • Browser access for Qwen device-flow approval
  • Chromium-based browser available for zai login

Global install:

bun install -g @opencode-go/cli

For local development:

bun run build
bun link

Quick start:

# OpenCode Go
opencode-go --setup
opencode-go

# OpenAI
opencode-go --oauth-login
opencode-go --provider openai --model gpt-5.2-codex

# Qwen
opencode-go --qwen-login
opencode-go --provider qwen --model qwen3-coder-plus

# Z.ai
opencode-go --zai-login
opencode-go --provider zai --model glm-4.7

Configuration

General config is stored in ~/.opencode-go-cli/config.json.

Example:

{
  "provider": "opencode",
  "apiKey": "sk-opencode-...",
  "openaiTokens": {
    "access": "...",
    "refresh": "...",
    "expiresAt": 1234567890
  },
  "zaiToken": "...",
  "lastModel": "minimax-m2.7",
  "proxyPort": 8080
}

Qwen accounts, rotator settings, and model cooldown locks are stored separately in ~/.opencode-go-cli/qwen.db.

proxyPort is the preferred local proxy port. In interactive mode the CLI automatically falls forward to the next free port if the preferred one is already in use.

Development

bun run src/index.ts
bun run build
bun run typecheck
bun test

The default test command runs the full suite, including the Qwen rotator tests.

Project Structure

src/
|-- cli.ts
|-- constants.ts
|-- env.ts
|-- config.ts
|-- logger.ts
|-- auth/
|   |-- oauth.ts
|   |-- server.ts
|   |-- qwen/
|   `-- zai/
|-- db/
|   |-- index.ts
|   |-- accounts.ts
|   `-- locks.ts
|-- rotator/
|   |-- index.ts
|   `-- fallback.ts
|-- proxy/
|   |-- server.ts
|   |-- qwen-handler.ts
|   |-- zai-handler.ts
|   |-- zai-signature.ts
|   `-- zai-stream.ts
`-- search/
    `-- searxng.ts

Documentation

| Document | Purpose | |----------|---------| | CLAUDE.md | Repository guidance for Claude Code | | .specs/project/ROADMAP.md | Milestones and feature status | | .specs/codebase/ARCHITECTURE.md | Architecture and data flows | | .specs/codebase/STRUCTURE.md | File structure and module organization | | .specs/codebase/INTEGRATIONS.md | External integrations and APIs |

License

MIT