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

openapi-llm-docs

v1.0.4

Published

Convert OpenAPI specifications to LLM-friendly documentation format

Readme

openapi-llm-docs

Convert OpenAPI specifications to LLM-friendly documentation format. This package converts OpenAPI/Swagger specifications into a clear, consistent format that's easy for Large Language Models (LLMs) to process and understand. This package provides both a standalone formatter and Express middleware for serving OpenAPI documentation in a format optimized for Large Language Models (LLMs).

Installation

npm install openapi-llm-docs

Usage

Express Middleware

import express from 'express';
import { createOpenAPILLMDocsMiddleware } from 'openapi-llm-docs';

const app = express();

/**
 * @openapi
 * /users:
 *   get:
 *     summary: Get all users
 *     description: Returns a list of all users
 *     parameters:
 *       - in: query
 *         name: page
 *         schema:
 *           type: integer
 *         description: Page number
 *         example: 1
 */
app.get('/users', (req, res) => {
  // Your route handler
});

// Add the middleware after your routes
app.use(createOpenAPILLMDocsMiddleware({
  spec: app, // Pass your Express app instance
  path: '/docs-llm',
  includeExamples: true,
  format: 'plain',
  requireDescription: true // Only include documented items
}));

Standalone Formatter

import { OpenAPILLMFormatter } from 'openapi-llm-docs';
import * as fs from 'fs';

// Load your OpenAPI spec
const spec = JSON.parse(fs.readFileSync('./openapi.json', 'utf8'));

// Create formatter instance
const formatter = new OpenAPILLMFormatter({
  includeExamples: true,
  includeDeprecated: false,
  format: 'plain',
  requireDescription: true // Only include documented items
});

// Format the spec
const formattedDocs = formatter.format(spec);
console.log(formattedDocs);

Options

Formatter Options

  • includeExamples (boolean, default: true): Include example values in the output
  • includeDeprecated (boolean, default: false): Include deprecated endpoints
  • format ('plain' | 'markdown', default: 'plain'): Output format
  • requireDescription (boolean, default: false): Only include endpoints, parameters, schemas, and properties that have descriptions. Useful for reducing token usage and ensuring complete documentation.

Middleware Options

Includes all formatter options plus:

  • path (string, default: '/docs-llm'): Route path for the documentation
  • spec (OpenAPIV3.Document | () => OpenAPIV3.Document): OpenAPI specification object or function that returns it

Output Format

The formatted output is structured as follows:

API Documentation

Title: Your API Title
Version: 1.0.0
Description: Your API Description

=== Endpoints ===

Endpoint: /users

Method: GET
Summary: Get all users
Description: Returns a list of all users
Parameters:
- page (query):
  Description: Page number
  Required: No
  Type: integer
  Example: 1

...

=== Schemas ===

Schema: User
Type: object
Properties:
- id:
  Type: string
  Description: User ID
  Required: Yes
  Example: "123e4567-e89b-12d3-a456-426614174000"
...

License

MIT