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-ifm

v0.2.0

Published

IFM (Institute of Foundation Models) provider for Pi: live model discovery, native auth, and OpenAI-compatible streaming.

Readme

pi-ifm

pi-ifm connects Pi to the IFM hosted API at https://api.ifm.ai/v1. It finds the chat models that your API key can use, stores that list for offline startup, and streams through Pi's OpenAI Completions adapter. You do not need to edit models.json.

Install

pi install git:github.com/iamaamir/pi-ifm

Try it without installing:

pi -e git:github.com/iamaamir/pi-ifm

Authenticate

Set an environment variable. IFM_API_TOKEN is checked first, then IFM_API_KEY:

export IFM_API_KEY="IFM-..."

Or log in once inside Pi:

/login ifm

Pi stores the credential in its normal credential store. pi-ifm does not log or write the key anywhere else.

Use

After authentication, IFM models appear in the standard model picker:

pi --list-models ifm
/model

Select a model and start working. Model discovery runs at startup, after login, and when you refresh. Discovery does not run for each chat message.

Commands

| Command | Purpose | |---|---| | /ifm status | Show credential readiness, catalog freshness, model count, compatibility state, and discovery errors. | | /ifm refresh | Force a live catalog refresh. Keeps the last catalog if the request fails. | | /ifm config | Configure the IFM base URL interactively. Reload or restart Pi after changing it. |

Model discovery

pi-ifm reads the authenticated GET /v1/models endpoint. For every entry that is not an obvious non-chat family (speech, embeddings, and so on), it confirms chat support with a one-token /chat/completions probe. Model IDs are used exactly as IFM returns them.

The successful catalog is cached by Pi and restored on the next launch, so Pi started without network still shows the last known models. A failed or empty refresh never replaces a healthy catalog.

IFM's model list does not publish output limits, prices, or per-model capabilities. Known models use their documented context windows; other models use conservative defaults. You can override any field per model through models.json if your account needs different limits.

Wire compatibility

Verified against api.ifm.ai:

  • Text-only user content arrays are converted to strings. IFM rejects typed content arrays with Invalid value for 'messages.content'.
  • store is disabled (supportsStore: false).
  • The unsupported developer role is disabled (supportsDeveloperRole: false).
  • Reasoning effort is sent as a top-level reasoning_effort field. IFM's hosted endpoint currently loops when asked for medium reasoning, so Pi's default medium is mapped to IFM low; high and above map to IFM high. Use /think high for deeper reasoning.
  • Every replayed assistant message includes a thinking field. reasoning_content is the canonical field. An empty string is valid. A missing or null field causes a 400 error.
  • Traces are replayed verbatim, so multi-turn history stays consistent.
  • Session routing uses one stable X-Session-ID for the whole conversation.
  • The base URL can be changed with IFM_BASE_URL or /ifm config.
  • System, assistant, tool-call, and tool-result messages are passed through unchanged, so tool-call correlation IDs and multi-turn history are preserved.
  • Image and multimodal input are not supported by IFM. pi-ifm fails with a clear error instead of silently dropping the attachment.
  • thinking_token_budget, tool_call_format, and tool_presentation_format were tested and are rejected by the current API, so they are not sent.

Pi's own streaming, tool-call parsing, usage accounting, cancellation, and retry handling are used unchanged. Streaming tool calls, tool results, follow-up completions, and cancellation were verified live against the hosted API.

Diagnostics

If an IFM response identifies a model different from the one Pi requested, /ifm status and a one-time warning explain the mismatch. The requested model id is never silently rewritten.

Known limitations

  • GET /v1/models publishes no per-model metadata. Known models use documented context windows; other models use conservative defaults (131,072-token context, 32,768 output tokens, zero cost). Override a model in models.json to change these.
  • IFM chat models return a reasoning field and support tool calling; both are enabled for every discovered chat model.
  • /login ifm and IFM_API_KEY both work in a normal Pi session. Use /ifm status to check auth.

Development

npm install
npm test
npm run typecheck

Tests use mock HTTP fixtures for discovery, refreshes, malformed responses, catalog outages, request normalization, and command behavior.

License

MIT