omp packages

pi-opencode-zen0.4.1

[DEPRECATED 2026-09-23] Zen anonymous free tier was closed to non-official clients — extension NO LONGER WORKS. Historical/educational only.

feng-h Published 26 days ago MIT ~1.1K downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-opencode-zen

🚫 DEPRECATED — THIS EXTENSION NO LONGER WORKS

Status: UNUSABLE since 2026-09-23. Do NOT install.

OpenCode Zen shut down anonymous free-tier access on its public API for all non-official clients (FreeTierError: "OpenCode's free tier can only be used from within OpenCode"). This cannot be bypassed by any headers or client emulation — the official opencode v2 client uses a private, server-dispatched endpoint. The only remaining access path is a paid API key ($20 prepaid, pay-per-request), which contradicts this extension's free-access purpose.

  • If you installed this before 2026-09-23: remove it with pi remove npm:pi-opencode-zen
  • For free models in pi, use providers with a genuine free tier (e.g. OpenRouter :free models, Groq, Google AI Studio)
  • Full post-mortem (Chinese): pi-tutor tutorial #12 — anti-forgery engineering

以下为历史文档,扩展已不可用。/ Everything below is historical documentation.

npm version npm downloads License: MIT pi-package

English | 简体中文

(Historical) Use OpenCode Zen's free models (e.g. nemotron-3.5-lightning-free, mimo-v2.5-free) inside the pi coding agent. No API key, no account, no login. — This stopped working on 2026-09-23, see notice above.

Install

Install via npm (recommended):

pi install npm:pi-opencode-zen

Or install directly from GitHub:

pi install git:github.com/Feng-H/pi-opencode-zen

Zero config — after installing, switch models with /model inside pi and pick a free model under opencode-zen.

How it works

OpenCode Zen exposes an OpenAI-compatible endpoint at https://opencode.ai/zen/v1. As of 2026-09 it grants free-tier access when a request:

  • carries an empty Authorization: Bearer header (any non-empty invalid token is rejected with 401), and
  • includes an x-session-id header — without it, Zen rejects with MissingSessionID: OpenCode's free tier can only be used in OpenCode. The extension generates one stable UUID per client startup, which is sufficient.

The extension registers an opencode-zen provider that points pi at the Zen endpoint, sets both headers, and fetches the live model list from /models at startup (falling back to a static list on failure).

Models

Fetched dynamically; only free models (id containing -free) are registered. Current pool (verified 2026-09-15):

Model Reasoning Notes
nemotron-3.5-lightning-free yes verified working
nemotron-3-ultra-free yes
mimo-v2.5-free yes often rate-limited
muse-spark-1.3-contributor-free no currently 500s upstream
muse-spark-1.2-contributor-free no currently 500s upstream
ling-3.0-flash-fin-free no Ant Ling (finance-tuned)
deepseek-v4-flash-free — retired upstream

The pool rotates: new -free models appear automatically; individual models may be rate-limited or unavailable at any time — try another one.


中文说明

在 pi 中使用 OpenCode Zen 的免费模型(如 nemotron-3.5-lightning-free、mimo-v2.5-free)。无需 API key、无需注册、无需登录。

⚠️ 2026-09-23 匿名免费层关闭(v0.4.0)

OpenCode Zen 公共端点 (/zen/v1) 的匿名免费层已对非官方客户端关闭:任何非 opencode v2 客户端的请求都会收到 FreeTierError: OpenCode's free tier can only be used from within OpenCode(与 headers/指纹无关,官方 v2 走 Console 内部路由)。API key 通道独立且不受此限制。

配置方法:在 Zen Console 注册获取 API key,然后:

# shell 配置里加
export OPENCODE_API_KEY="sk-你的key"

无 key 时扩展仍会注册(models 列表可拉取),但 provider 名称会标注 key missing,实际对话会被 Zen 拒绝。

安装方式

通过 npm 官方镜像 安装(推荐):

pi install npm:pi-opencode-zen

或者直接从 GitHub 安装:

pi install git:github.com/Feng-H/pi-opencode-zen

零配置 —— 装好后 pi 对话里 /model 切换,选 opencode-zen 下的免费模型即可。

工作原理

OpenCode Zen 提供 OpenAI 兼容端点 https://opencode.ai/zen/v1。2026-09 起免费访问需同时满足:

  • Authorization: Bearer (空 Bearer —— 填任何非空无效 token 反而被 401 拒绝);
  • 携带 x-session-id 请求头 —— 缺了直接报 MissingSessionID: OpenCode's free tier can only be used in OpenCode。扩展每次启动生成一个稳定 UUID 即可满足。

扩展注册 opencode-zen provider,带上上述两个头,启动时从 /models 动态拉取模型列表(失败则回退静态列表)。

模型

动态拉取,只注册 id 含 -free 的免费模型(非免费模型匿名访问会被 401)。当前免费池(2026-09-15 实测):

模型 推理 说明
nemotron-3.5-lightning-free 是 实测可用
nemotron-3-ultra-free 是
mimo-v2.5-free 是 经常限流
muse-spark-1.3-contributor-free 否 上游目前 500
muse-spark-1.2-contributor-free 否 上游目前 500
ling-3.0-flash-fin-free 否 蚂蚁 Ling(金融向)
deepseek-v4-flash-free — 上游已下线

免费池会轮换:新 -free 模型自动出现;个别模型可能随时限流或不可用 —— 换一个试即可。

限制

  • 有限流:免费模型共享公共配额,不适合重度/自动化使用;
  • 尽力而为:依赖第三方免费服务,策略随时可能变化(如 2026-09 的 SessionID 门禁);
  • 成本按零上报(访问本身免费)。

License

MIT