@sakiko233/pi-native-search
Minimal Pi extension for provider-native web search on OpenAI Codex, Kimi For Coding, DeepSeek, and GLM Coding (China).
Package details
Install @sakiko233/pi-native-search from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@sakiko233/pi-native-search- Package
@sakiko233/pi-native-search- Version
0.4.0- Published
- Nov 12, 2026
- Downloads
- 314/mo · 248/wk
- Author
- sakiko233
- License
- MIT
- Types
- extension
- Size
- 25.6 KB
- Dependencies
- 0 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./extensions/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@sakiko233/pi-native-search
A minimal Pi extension that enables provider-native web search for OpenAI Codex, Kimi For Coding, DeepSeek, and GLM Coding (Z.ai).
Supported providers
| Provider | Search mode | Auth source |
|---|---|---|
| OpenAI Codex | Main-request injection of { "type": "web_search" } |
Pi's openai-codex OAuth resolver |
| Kimi For Coding | Claude Code-style nested Anthropic Messages request declaring web_search_20250305 |
KIMI_API_KEY or Kimi OAuth |
| DeepSeek | Claude Code-style nested Anthropic Messages request declaring web_search_20250305 against https://api.deepseek.com/anthropic |
DEEPSEEK_API_KEY |
| GLM Coding (Z.ai) | Claude Code-style nested Anthropic Messages request declaring web_search_20250305 against https://open.bigmodel.cn/api/anthropic |
ZAI_API_KEY or zai-coding-cn key in auth.json |
GLM support currently targets the China Coding Plan provider zai-coding-cn (live-tested with glm-5.3), not the global Z.ai provider. Search requests use the Anthropic endpoint rather than the model's OpenAI-compatible Coding endpoint.
All other providers are intentionally unsupported.
Install
pi install npm:@sakiko233/pi-native-search
Usage
For OpenAI Codex, the extension does not register a client-side search tool. It appends a server-side { "type": "web_search" } entry to the outgoing request's existing tools list and sets tool_choice to auto:
{
"tools": [...existingTools, { "type": "web_search" }],
"tool_choice": "auto"
}
Codex keeps full access to its local tools (read, bash, edit, write) while gaining web search. The server-side web_search tool produces no client tool card.
For Kimi For Coding, DeepSeek, and GLM Coding (Z.ai), the extension registers a web_search tool. When the main model calls it, the extension sends a nested Anthropic Messages request declaring:
{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 8
}
The provider performs the search server-side and returns text plus search-result blocks, which the extension formats as an ordinary tool result.
Configuration
/search # open settings
/search providers # show supported providers
/search config # print current configuration
/search on # enable web search
/search off # disable web search
Configuration persists in ~/.pi/agent/search-config.json.
Roadmap
Selectable search protocol via
/searchToday the search protocol is hardwired per provider. The plan is to decouple provider from protocol so users can choose which protocol each provider uses directly from the
/searchsettings UI — e.g. Kimi For Coding and DeepSeek offer the Anthropic server-tool protocol (web_search_20250305), while OpenAI Codex offers the OpenAI request-injection protocol ({ "type": "web_search" }). This is especially useful for providers that expose multiple compatible endpoints (for example DeepSeek's OpenAI- and Anthropic-compatible APIs).Third-party search tools via MCP
Add an option to route search through a third-party search tool exposed via MCP (Model Context Protocol) instead of relying on the active provider's native server-side search, letting users plug in external search backends.
Development
npm install --ignore-scripts
npm run typecheck
npm test
The extension is a single TypeScript file, extensions/index.ts, loaded directly by Pi.
License
MIT — see LICENSE.