pi-agent-1min0.1.0
1min.AI as a Pi Agent provider — 100+ models discovered dynamically (OpenAI messages -> 1min protocol translation, emulated tool-calling).
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.
Reports 0
No reports yet.
Readme
pi-agent-1min — 1min.AI as a Pi Agent provider / 1min.AI 作為 Pi Agent 的 provider
Use your 1min.AI subscription (100+ models via a single key)
as a Pi Agent provider, the same way opencode-1min does for OpenCode.
用一支 1min.AI 訂閱的 key(100+ 模型)作為 Pi Agent 的
provider,就像 opencode-1min 之於 OpenCode。
This port reimplements the translation of the 1min protocol (non
OpenAI-compatible) directly in Pi's streamSimple. No hardcoded model list —
model discovery is 100% dynamic.
此移植版在 Pi 的 streamSimple 中重新實作了 1min 協定(非 OpenAI 相容)的
翻譯。沒有寫死的模型清單——模型發現 100% 動態。
Reference / 參考
This project is a port of opencode-1min
(by plixeuh), which implements the same 1min.AI provider for OpenCode.
The protocol translation, dynamic model discovery, emulated tool-calling,
URL-stripping, and <think> handling are adapted from its source
(src/transform.ts, src/models.ts, src/onemin-fetch.ts).
本專案是由 opencode-1min
(作者 plixeuh)移植而來,該套件為 OpenCode 實作了相同的 1min.AI provider。
協定翻譯、動態模型發現、模擬工具呼叫、URL 剃除,以及 <think> 處理,均改寫
自其原始碼(src/transform.ts、src/models.ts、src/onemin-fetch.ts)。
Installation / 安裝
Install from npm (recommended) / 從 npm 安裝(推薦):
pi install npm:pi-agent-1min
Then restart Pi (or /reload). The 1min provider will appear.
然後重啟 Pi(或 /reload),1min provider 就會出現。
Local development / 本機開發
For local development, download the source and test with -e:
本機開發時,下載原始碼並用 -e 測試:
npm pack pi-agent-1min
tar xzf pi-agent-1min-*.tgz
mv package pi-agent-1min-dev
pi -e ./pi-agent-1min-dev/index.ts
The
node_modules/@earendil-works/*symlinks are only needed for local development (import resolution outside the Pi runtime). Pi resolves these imports to its own copies; you can remove them in production.
node_modules/@earendil-works/*的 symlink 只在本機開發時需要(在 Pi runtime 之外解析 import)。Pi 會把這些 import 解析到它自己的副本;生產環境 可移除。
Authentication / 驗證
/login → 1min.AI → paste your key (https://app.1min.ai/api-access-token)
The key is stored by Pi (~/.pi/agent/auth.json).
Key 由 Pi 儲存(~/.pi/agent/auth.json)。
Alternative without /login — export one of these environment variables:
不經 /login 的另一種方式——匯出下列任一環境變數:
export ONEMIN_API_KEY=... # or ONE_MIN_API_KEY, or 1MIN_API_KEY
Choosing a model / 選擇模型
/model → search "1min" → e.g. 1min/claude-sonnet-4-6, 1min/gpt-4o-mini, ...
How it works / 運作原理
Dynamic discovery / 動態發現:
GET /models?feature=UNIFY_CHAT_WITH_AI(~103) +GET /models?feature=CODE_GENERATOR(~57) → union exposed in/model. Thefeaturesfield decides the route.Route per model / 依模型路由:
CODE_GENERATORonPOST /api/features(plain text, no SSE) ifUNIFY_CHAT_WITH_AIis absent, otherwiseUNIFY_CHAT_WITH_AIonPOST /api/chat-with-ai(SSE). Anot supported for featurerejection ⇒ automatic retry once on the other route.Emulated tool-calling (chat only) / 模擬工具呼叫(僅 chat): blocks
<tool_call>{"name":…,"arguments":…}</tool_call>injected into the prompt, re-parsed astool_calls. Code route = no tools sent or parsed.Prompt without URLs / 無 URL 的 prompt: system prompt trimmed, schemas without
$...keys, and a finalstripUrls— nohttps:///www.ever leaves for 1min.webSearch forced to
false.
Known limitations / 已知限制
Capped context (~512 KB/request) / 上下文上限(約 512 KB/請求): the 1min API rejects oversized bodies (
REQUEST_BODY_VALIDATION_FAILED). Normalized intocontext_too_large:/compactor reduce the context. No silent truncation.Tool-calling emulated in chat only / 工具呼叫僅在 chat 模擬: 1min has no native tool calling.
Images / files ignored / 圖片/檔案被忽略: the
image_url/fileparts are dropped (no upload to the 1min Asset API). Only text is sent.
Uninstall / 移除(完整還原)
Remove the package / 移除套件:
pi remove npm:pi-agent-1minRestart Pi (or
/reload) — the1minprovider disappears. 重啟 Pi(或/reload)——1minprovider 消失。Remove the key in
~/.pi/agent/auth.json(the1minentry), or re-run/loginto overwrite it. 刪除~/.pi/agent/auth.json中的 key(1min條目),或重新/login覆寫。
No resident process, no registry pollution. 沒有常駐行程,不會污染登錄檔。
License / 授權
MIT