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

@powerhousedao/ph-clint-openrouter

v0.1.0-dev.1

Published

ph-clint plugin: resolve a runtime model config into a Mastra model config for OpenRouter / OpenAI-compatible providers alongside the Anthropic default.

Readme

@powerhousedao/ph-clint-openrouter

A ph-clint plugin that adds OpenRouter and any OpenAI-compatible provider as an opt-in alongside the Anthropic default. It exposes resolveModelConfig, a pure function that maps a ph-clint runtime config (model, modelBaseURL, modelApiKey, per-provider keys) into a Mastra MastraModelConfig.

It is an external counterpart to default ph-clint codegen: core and the codegen builders stay Anthropic-only, so multi-provider support stays out of them. A consumer that wants it pulls in this package and calls resolveModelConfig from its own createAgent factory — no provider logic leaks into core.

Install

pnpm add @powerhousedao/ph-clint-openrouter

Peer dependencies: @powerhousedao/ph-clint and @mastra/core.

Usage

import { Agent } from '@mastra/core/agent';
import { resolveModelConfig } from '@powerhousedao/ph-clint-openrouter';

const agent = new Agent({
  id: 'my-agent',
  name: 'My Agent',
  instructions: '…',
  model: resolveModelConfig({
    model: ctx.config.model, // e.g. 'openrouter/openai/gpt-4o'
    modelBaseURL: ctx.config.modelBaseURL,
    modelApiKey: ctx.config.modelApiKey,
    anthropicApiKey: ctx.config.anthropicApiKey,
    openrouterApiKey: ctx.config.openrouterApiKey,
  }),
  // …
});

Resolution

resolveModelConfig(cfg) returns either an OpenAI-compatible { id, url?, apiKey? } object or a bare model string. It is structurally assignable to Mastra's MastraModelConfig.

| Input | Output | | ------------------------------------------------------ | --------------------------------------------------- | | anthropic/* + key | { id, apiKey } | | anthropic/*, no key | bare model string | | openrouter/* + key | { id, url: openrouter/api/v1, apiKey } | | openrouter/*, no key | bare gateway string (Mastra reads OPENROUTER_API_KEY) | | any modelBaseURL set | { id, url, apiKey? } | | otherwise | { id, apiKey } with a key, else bare model string |

Key precedence: a generic modelApiKey overrides the legacy <provider>ApiKey field (e.g. anthropicApiKey, openrouterApiKey).

OpenRouter model ids

Mastra strips the leading openrouter/ provider segment before calling the gateway, so the remainder must itself be a valid OpenRouter slug (<vendor>/<model>) — e.g. openrouter/openai/gpt-4o is sent as openai/gpt-4o. OpenRouter's own namespaced models (the routers openrouter/free / openrouter/auto, and stealth models) are themselves slugs, so write the prefix twice: openrouter/openrouter/free. A bare openrouter/free would be sent as free and rejected with an opaque 502, so resolveModelConfig throws a descriptive error for that shape instead.

License

MIT