@ersintarhan/pi-toolkit
pi extension that registers Kimi, MiniMax, Xiaomi MiMo, and CrofAI providers with cache fix, Anthropic OAuth adapter, and native web search with provider-override support. Search backends include ZAI MCP, Google, OpenAI, xAI, Anthropic, Claude Code, and C
Package details
Install @ersintarhan/pi-toolkit from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@ersintarhan/pi-toolkit- Package
@ersintarhan/pi-toolkit- Version
0.7.2- Published
- Jul 18, 2026
- Downloads
- 1,253/mo · 66/wk
- Author
- ersintarhan
- License
- MIT
- Types
- extension, skill
- Size
- 236.9 KB
- Dependencies
- 1 dependency · 4 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
],
"skills": [
"./skills"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-toolkit
All-in-one pi extension toolkit.
Includes:
- Providers:
minimax,xiaomi-mimo - Cache optimization for Anthropic-compatible providers
- Claude OAuth adapter for Anthropic OAuth sessions
- Native web search with multiple backends + provider override
- Context management (
anchor,view,pivot,recall)
Note: The
kimi-codingandcrofaiproviders have been moved out of this package. For Kimi, install the dedicated provider such aspi-provider-kimi-code. CrofAI can be installed from its own package when needed.
Install
pi install npm:@ersintarhan/pi-toolkit
Local development:
pi -e /Users/ersin/Projects/pi-extensions/pi-toolkit
What this package does
1. Provider registration
Registers these providers:
| Provider | API | Notes |
|---|---|---|
minimax |
Anthropic-compatible | Cache-fixed stream path |
xiaomi-mimo |
Anthropic-compatible | Cache-fixed stream path, MiMo quirks handled |
For Kimi, use an external Kimi provider package (e.g. pi-provider-kimi-code).
2. Cache optimization
For Anthropic-compatible providers (minimax, xiaomi-mimo), this package uses a custom cached stream implementation derived from the better-messages-cache approach.
It does three things:
- marks the last assistant
tool_useblock - marks the last user block
- repairs partial/invalid streaming JSON during tool call parsing
This keeps cache loss lower across long agentic turns.
3. Claude OAuth adapter
When using /model anthropic/... with Anthropic OAuth:
- strips the Claude Code identity block
- injects the billing header Claude Code expects
- shows footer status like
✓ Claude OAuth ready/active - docs re-injection is disabled by default
4. Native search
Adds:
web_searchweb_fetch/search
Supported native search backends:
| Backend | Search | Fetch | Auth |
|---|---|---|---|
| ZAI (GLM) | ✅ | ✅ | ZAI_API_KEY |
| Google Gemini | ✅ | ❌ | GEMINI_API_KEY |
| OpenAI | ✅ | ❌ | OPENAI_API_KEY |
| xAI | ✅ | ❌ | XAI_API_KEY |
| Anthropic | ✅ | ❌ | ANTHROPIC_API_KEY |
| Claude Code bridge | ✅ | ✅ | Claude CLI auth |
| Codex / ChatGPT | ✅ | ❌ | codex login / ~/.codex/auth.json |
| Fallback | DuckDuckGo | HTTP fetch | none |
You can pin search to a provider independently from the active model.
Examples:
/search provider zai
/search provider openai
/search provider codex
/search provider auto
Or choose it from the TUI settings panel with /search.
5. Context management
Adds the context tool with:
viewrecallanchorpivot
Also includes:
- status line (
context=,tool=,anchor=) - tool-result truncation before the last anchor
- anchor-aware cache support in the integrated context flow
Provider usage
MiniMax
/model minimax/MiniMax-M3
/model minimax/MiniMax-M2.7
Requires:
MINIMAX_API_KEY
Xiaomi MiMo
/model xiaomi-mimo/mimo-v2.5
/model xiaomi-mimo/mimo-v2.5-pro
Requires:
XIAOMI_TOKEN_PLAN_API_KEY
Optional region override:
export XIAOMI_MIMO_BASE_URL=https://token-plan-ams.xiaomimimo.com/anthropic
Kimi
The kimi-coding provider is no longer bundled. Install a dedicated Kimi provider package, for example:
pi install npm:pi-provider-kimi-code
# or via local path
pi -e /path/to/pi-provider-kimi-code
Then select Kimi as usual:
/model kimi-for-coding
The upstream
pi-provider-kimi-codepackage is actively maintained and supports Kimi model discovery, OAuth, file uploads, and Kimi-specific payload mutations.
/usage command
Shows quota / plan usage for the active provider.
Supported:
| Provider | Endpoint |
|---|---|
minimax |
https://api.minimax.io/v1/token_plan/remains |
xiaomi-mimo |
https://platform.xiaomimimo.com/api/v1/tokenPlan/usage |
Examples:
/usage
/context command
Shows current context-window usage without adding the generated report to future LLM context.
It includes:
- total context usage and model window
- estimated category breakdown
- active tools and slash commands
- extension allocation by source/package
- cache read/write and cost stats
Example:
/context
Search override examples
Use MiniMax for coding, but ZAI for search:
/model minimax/MiniMax-M3
/search provider zai
Use any model, but force Codex web search:
/search provider codex
Return to auto-detect:
/search provider auto
Context workflow examples
Anchor after a completed phase:
context(anchor, name="search-setup", summary="Search override configured to use ZAI.")
Pivot back to a clean checkpoint:
context(pivot, target="search-setup", carryover="Search override is stable; Claude OAuth adapter handles Anthropic billing header.")
Environment summary
Common env vars:
# MiniMax
export MINIMAX_API_KEY=...
# Xiaomi MiMo
export XIAOMI_TOKEN_PLAN_API_KEY=...
export XIAOMI_MIMO_BASE_URL=...
# Search backends
export ZAI_API_KEY=...
export GEMINI_API_KEY=...
export OPENAI_API_KEY=...
export XAI_API_KEY=...
export ANTHROPIC_API_KEY=...
Compatibility notes
- Do not install older overlapping Kimi provider forks at the same time as a dedicated Kimi provider package.
- Local
pi -e ...development may behave differently from installed npm packages for skill loading. - Codex search requires
codex loginfirst. - Claude OAuth adapter only activates for the
anthropicprovider when OAuth is actually in use. - The
kimi-codingandcrofaiproviders were removed in v0.7.2. Use dedicated provider packages for them.
Changelog
- 0.5.9 — Enforce Anthropic cache-control marker budget; lower default anchor-cache budget to 3.
- 0.5.8 — Stop copying
cache_controlonto synthetic Claude OAuth prompt block; strip foreign thinking signatures on provider switch. - 0.5.7 — Guard Kimi stream bootstrap; restrict native web fetch to
http/https. - 0.5.6 — Show
toolShare=only when tool-output share exceeds 50%. - 0.5.5 — Add
/contextcommand for context-window usage reporting. - 0.5.4 — Initial public release of
@ersintarhan/pi-toolkit.
Full details: CHANGELOG.md.
License
MIT