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

@openagentry/adapter-llm-openrouter

v0.1.0-alpha.0

Published

OpenAgentry LlmAdapter for OpenRouter (plain fetch against OpenAI-compatible REST API)

Downloads

24

Readme

@openagentry/adapter-llm-openrouter

Third concrete LlmAdapter for OpenAgentry — runtime LLM access via OpenRouter (plain fetch against their OpenAI-compatible REST API). Joins @openagentry/adapter-llm-cli (operator/CLI) and @openagentry/adapter-llm-aigateway (runtime/SDK).

Install

npm install @openagentry/adapter-llm-openrouter
# or
pnpm add @openagentry/adapter-llm-openrouter

Quick start

import llm from '@openagentry/adapter-llm-openrouter';

// Set OA_OPENROUTER_API_KEY in env, then:
const models = await llm.listModels();
const out = await llm.generate('Hello!', { model: 'openai/gpt-5.2' });
console.log(out.text);

Configuration

| Env var | Required | Purpose | |---|---|---| | OA_OPENROUTER_API_KEY | yes | OpenRouter API key (https://openrouter.ai/keys) | | OA_OPENROUTER_DEFAULT_MODEL | no | Default model when opts.model unset | | OA_OPENROUTER_BASE_URL | no | Override base URL (default: https://openrouter.ai/api/v1) | | OA_OPENROUTER_APP_URL | no | Sent as HTTP-Referer (opt-in attribution) | | OA_OPENROUTER_APP_TITLE | no | Sent as X-OpenRouter-Title (opt-in attribution) |

Operator vs runtime

This adapter is the runtime flavor — for deployed apps that call the LLM at request time. For build-time/operator-side calls (no API key needed), use @openagentry/adapter-llm-cli.

What's NOT in v0

  • Tool/function-calling support
  • Vision/image inputs
  • Embeddings endpoint
  • Provider-routing preferences (route, provider: {...} body params; pass model: 'openrouter/auto' for auto-routing instead)
  • Retry logic on transient 5xx
  • Cost tracking from response headers
  • Cache-Control parsing helpers (no equivalent need on this adapter)

Documentation

  • LLM-targeted reference: LLM.md
  • License: Apache-2.0
  • Issues: https://github.com/timncox/openagentry/issues

Architecture notes

Plain fetch everywhere — no ai / openai / @openrouter/sdk dependency. SSE streaming uses a hand-rolled line-buffered parser (src/sse.ts). Mocking in tests uses pure MSW (no vi.mock shenanigans, since globalThis.fetch is the only external call surface).

The deliberately-different transport shape (CLI shell-out / SDK wrapper / raw HTTP) across the three LLM adapters strengthens the abstraction proof for the category — the same LlmAdapter interface fits all three.