Zhihu Websearch
Zhihu Web Search as an OpenCode websearch provider
0
19
近 7 天 19
28.0
生态多维模型
3 天前
2026-10-02
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-zhihu-websearch@0.0.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-zhihu-websearch@0.0.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-zhihu-websearchOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
English | 简体中文
Zhihu Web Search (Global Search) as an OpenCode websearch provider.
Zhihu Global Search is a high-trust search service for AI applications, combining high-quality Zhihu content with authoritative web sources to deliver real-time, structured, and traceable results. It offers high-quality, highly relevant results for Chinese-language queries.
Requirements
- OpenCode v2
- A Zhihu Open Platform account with an Access Secret: https://developer.zhihu.com/profile
Install
opencode plugin add opencode-zhihu-websearch
Or add it to opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"plugins": ["opencode-zhihu-websearch"],
"websearch": { "provider": "zhihu" },
}
Without websearch.provider, OpenCode asks you to pick a provider the first time you search.
Credentials
Run /connect and pick Zhihu, or set ZHIHU_ACCESS_SECRET before starting OpenCode. A stored credential takes priority over the environment variable.
Options
Plugin options are optional:
{
"plugins": [
{
"package": "opencode-zhihu-websearch",
"options": { "count": 8, "searchDB": "realtime" },
},
],
}
| Option | Values | Default | Description |
|---|---|---|---|
count |
1-20 | 10 |
Number of results |
searchDB |
all, realtime, static |
all |
Search index |
filter |
Filter expression | none | Filter results by site or publish time |
endpoint |
URL | Zhihu Global Search API | Override the search endpoint |
filter uses Zhihu's filter syntax: host supports == and != with a double-quoted value, publish_time (Unix seconds) supports ==, !=, >, >=, < and <=, and conditions combine with uppercase AND/OR and parentheses. Filtering on zhihu.com itself is not supported. Escape the quotes in JSON:
"options": { "filter": "host!=\"example.com\" AND publish_time>=1735689600" }
Development
bun install
bun run typecheck
bun run test
# optional: hits the real API, needs ZHIHU_ACCESS_SECRET
LIVE=1 bun run test:live
License
同类生态推荐
Codebase Index
@bandonker/opencode-codebase-index
Index a codebase and run BM25-ranked full-text search over it with SQLite FTS5.
Omniroute V2
@piyush97/opencode-omniroute-v2
OpenCode v2 plugin for live OmniRoute model discovery, combos, authentication, and metadata.
Raven
opencode-raven
Context-saving search and on-demand MCP routing for OpenCode through focused Raven agents.