npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-mimo-web-search

v1.0.2

Published

Web search for Xiaomi MiMo models in Pi

Readme

MiMo Web Search Extension for Pi

Enables web search for Xiaomi MiMo models in Pi by automatically injecting the web_search tool into every request.

What It Does

When you ask MiMo about current events, recent news, or anything that benefits from up-to-date information, the model will search the web and use the results to answer — just like it would through the MiMo web UI.

The extension hooks into Pi's before_provider_request event and injects the web_search tool into every outgoing request to a MiMo direct API provider. No manual configuration or keywords needed — the model decides when to search based on your query.

Prerequisites

  1. MiMo direct API key — a pay-as-you-go key from api.xiaomimimo.com, not a token plan key.

  2. Web Search plugin activated — enable it on the MiMo platform console: 👉 https://platform.xiaomimimo.com/#/console/plugin

  3. Pi configured with MiMo — add your API key to ~/.pi/agent/auth.json:

    {
      "xiaomi": {
        "type": "api_key",
        "key": "sk-your-api-key-here"
      }
    }

Install

Copy the extension to Pi's global extensions directory:

mkdir -p ~/.pi/agent/extensions/mimo-web-search
cp index.ts ~/.pi/agent/extensions/mimo-web-search/

Then restart Pi or run /reload.

You should see [mimo-web-search] in the extensions list at startup, and a notification confirming it loaded.

How It Works

The extension registers a single event handler:

before_provider_request → injects {"type": "web_search", "web_search": {}} into tools array

It targets only the xiaomi provider (direct API). Token plan providers are explicitly skipped because MiMo does not support web search on token plan endpoints.

Billing

Web search uses pay-as-you-go credits, separate from your API key usage or any token plan subscription. Each search request consumes credits based on the number of searches performed and pages crawled. Check your usage on the MiMo platform console.

Limitations

No Structured Citations in Pi

MiMo returns structured URL annotations (url_citation objects with title, URL, and summary) in the streaming response. However, Pi's openai-completions handler drops these annotations from the stream — it only processes content, tool_calls, and reasoning_content fields.

This means:

  • ✅ The model receives search results and uses them to answer
  • ✅ The model can mention sources by name in its text (e.g., "according to Reuters")
  • ❌ Structured citations (clickable URLs, source cards) are not displayed in the TUI

The model will often cite sources naturally in its response text, but the links themselves won't be rendered. This is a Pi limitation, not a MiMo limitation — the annotations are sent by MiMo but discarded by Pi's streaming handler.

Token Plan Not Supported

Web search is not available on MiMo token plan endpoints (token-plan-sgp, token-plan-cn, token-plan-ams). If you try to use web search with a token plan key, MiMo returns:

web search tool found in the request body, but webSearchEnabled is false

This extension automatically skips token plan providers to avoid this error. If you switch between token plan and direct API, the extension will only activate web search when using the xiaomi (direct API) provider.

Model-Driven Search

The web_search tool is sent with force_search: false (the default), meaning the model decides when to search. It will search for current events, recent news, or real-time information, but won't search when you're asking it to write code, explain concepts, or do tasks that don't require up-to-date information. This is usually the desired behavior — it avoids wasting credits on queries that don't need web search.

Development

The extension is a single TypeScript file. To modify it:

  1. Edit ~/.pi/agent/extensions/mimo-web-search/index.ts
  2. Run /reload in Pi
  3. Test with a query that benefits from web search (e.g., "what's the latest news on X?")

Extension Structure

export default function (pi: any) {
  // Notify on load
  pi.on("session_start", ...);

  // Inject web_search tool into MiMo requests
  pi.on("before_provider_request", (event, ctx) => {
    // Check if current model is a MiMo direct API provider
    // Inject web_search tool into the tools array
    // Return modified payload
  });
}

Relevant Pi Extension API

  • before_provider_request — fires before each LLM request, can modify the payload
  • session_start — fires when a session starts, used for the load notification
  • ctx.model.provider — the current model's provider ID (e.g., "xiaomi", "xiaomi-token-plan-sgp")

References