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

@ramarivera/pi-ts-aperture-provider

v0.2.12

Published

Config-driven aperture provider extraction for Pi-compatible extensions.

Readme

@ramarivera/pi-ts-aperture-provider

Shared Aperture provider runtime for Pi, published as both:

  • a reusable TypeScript runtime library
  • a Pi package with a bundled extension entrypoint in extensions/index.ts

What lives here

  • OpenAI-compatible /models gateway fetching
  • models.dev catalog indexing and metadata enrichment
  • provider-metadata-driven API resolution for Pi-style provider registrations
  • config-driven overrides for provider aliases and individual models
  • a packaged Pi extension that registers the provider directly inside Pi

What does not live here

  • hardcoded Aperture base URLs
  • hardcoded provider names
  • freeform heuristic capability inference from arbitrary model IDs

Quick start

corepack yarn install
corepack yarn test
corepack yarn build

Install as a Pi package

This package is now Pi-installable.

Super simple setup

pi install npm:@ramarivera/[email protected]

That is enough for Pi to load the extension. Pi discovers the packaged extension from package.json -> pi.extensions and loads extensions/index.ts automatically. If you do not provide your own config yet, the extension falls back to the bundled aperture-provider.config.example.json as a bootstrap default; most installs should still copy and customize that file.

If you prefer to do it manually instead of pi install, add this to ~/.pi/agent/settings.json:

{
  "packages": [
    "npm:@ramarivera/[email protected]
  ]
}

Configuration

Copy aperture-provider.config.example.json to one of these locations:

  1. PI_APERTURE_PROVIDER_CONFIG=/absolute/path/to/file.json
  2. <project>/.pi/aperture-provider.config.json
  3. ~/.pi/agent/aperture-provider.config.json
  4. package-local aperture-provider.config.json next to the installed package (mainly useful for local development)
  5. bundled package fallback aperture-provider.config.example.json next to the installed package (used automatically when no higher-priority config exists)

Example:

mkdir -p ~/.pi/agent
cp aperture-provider.config.example.json ~/.pi/agent/aperture-provider.config.json

Adjust at least:

  • providerName
  • baseUrl
  • apiKey
  • modelsDev.providerAliases
  • resolution.apiRules
  • fallbackMetadata
  • modelOverrides

For Aperture, baseUrl should be the primary gateway root the extension uses everywhere. In Ramiro's current setup that is:

{
  "baseUrl": "https://aperture-ai.xalda-procyon.ts.net/v1"
}

Runtime behavior

This runtime resolves capabilities from multiple layers, in order:

  • API type from Aperture provider metadata such as /v1/messages, /v1/responses, or /v1/chat/completions
  • provider compatibility from /aperture/config when available
  • pricing from the Aperture /models payload when present
  • explicit modelOverrides
  • reasoning, modalities, and token limits from models.dev
  • fallbackMetadata from your JSON config
  • bundled conservative fallback metadata for a small set of well-known model families when upstream metadata is missing

The fallback layer is intentionally conservative. It is not freeform model-name guessing. You can edit fallbackMetadata in your aperture-provider.config.json without republishing the library, and those entries override the bundled defaults.

If a model still lacks required capability metadata after those layers, the runtime warns and skips that model by default instead of crashing the entire sync. If you want strict behavior, set resolution.skipModelsMissingCapabilities to false.

Provider sync now uses a persisted registration cache. On startup it reads the cached provider registration first, returns quickly, and refreshes in the background when a cache entry exists. The default cache path is:

~/.pi/agent/cache/aperture-provider/<provider-name>.json

If you want warning output while debugging cache refreshes or missing metadata, set PI_APERTURE_DEBUG=1. In normal mode those warnings are returned in runtime state but not dumped to the console.

Security note: as of 0.2.11, the persisted cache excludes apiKey, and background refresh only updates the cache for future startups instead of re-registering live providers mid-session.

Example config override:

{
  "fallbackMetadata": {
    "k2.5": {
      "reasoning": true,
      "input": ["text"],
      "contextWindow": 262144,
      "maxTokens": 16384
    }
  }
}

Using the library directly

If you want your own custom Pi extension or another integration layer, use the runtime exports directly:

import {
  createApertureProviderRuntime,
  loadResolvedApertureProviderConfig,
} from "@ramarivera/pi-ts-aperture-provider";

const { config } = await loadResolvedApertureProviderConfig();
const runtime = createApertureProviderRuntime(config, {
  cachePath: "/tmp/aperture-provider-cache.json", // optional
  debug: process.env.PI_APERTURE_DEBUG === "1", // optional
});

Repository layout

Publishing

The package is configured to publish to npm as @ramarivera/pi-ts-aperture-provider.

Before publishing:

corepack yarn install
corepack yarn run check
corepack yarn test
corepack yarn typecheck
corepack yarn build
npm whoami

Publish with:

npm publish

For prereleases (for example 0.2.5-beta.0), publish with:

npm publish --tag beta