跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    maxchang3

    Zhihu Websearch

    opencode-zhihu-websearch·v0.0.1·模型接入

    Zhihu Web Search as an OpenCode websearch provider

    GitHub 星标

    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"]
    }

    OpenCode 启动时会通过内嵌运行时自动加载 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

    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

    MIT

    同类生态推荐