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

proofpudding

v0.2.0

Published

TypeScript SDK for the ProofPudding document processing API

Downloads

202

Readme

ProofPudding TypeScript SDK

A TypeScript SDK for the ProofPudding API - Document processing and question answering.

Installation

npm install proofpudding

Quick Start

import { PuddingClient } from "proofpudding";

const client = new PuddingClient({
  accessToken: "pk_your_api_key",
});

// Upload a document
const doc = await client.documents.upload({
  filePath: "./invoice.pdf",
});

// Ask a question about it
const job = await client.jobs.create({
  documentId: doc.id,
  question: "What is the total amount due?",
});

console.log(job.result?.answer);
// → "The total amount due is $1,234.56"
console.log(job.result?.citations);
// → [{ page: 1, quote: "Total Due: $1,234.56", type: "text" }]

Streaming

Use Server-Sent Events to get real-time progress updates:

for await (const event of client.jobs.createStream({
  documentId: doc.id,
  question: "Summarize this document",
})) {
  switch (event.event) {
    case "downloading":
      console.log(`Downloading progress ${event.progress}`);
      break;
    case "processing":
      console.log(`Processing page ${event.pages_done}/${event.total_pages}`);
      break;
    case "thinking":
      console.log(`Thinking iteration ${event.iteration}`);
      break;
    case "step":
      console.log(`Step: ${event.message}`);
      break;
    case "verifying":
      console.log(
        `Verifying citation ${event.citation_index + 1}/${event.total_citations}`,
      );
      break;
    case "complete":
      console.log("Result:", event.result);
      break;
    case "error":
      console.error("Error:", event.message);
      break;
  }
}

Structured Output

Extract data into a JSON schema:

const job = await client.jobs.create({
  documentId: doc.id,
  question: "Extract the invoice details",
  config: {
    output_schema: {
      schema: {
        type: "object",
        properties: {
          vendor: { type: "string" },
          total: { type: "number" },
          currency: { type: "string" },
          line_items: {
            type: "array",
            items: {
              type: "object",
              properties: {
                description: { type: "string" },
                amount: { type: "number" },
              },
            },
          },
        },
        required: ["vendor", "total", "currency"],
      },
      strict: true,
    },
  },
});

console.log(job.result?.structured_output);
// → { vendor: "Acme Corp", total: 1234.56, currency: "USD", line_items: [...] }

Configuration

const client = new PuddingClient({
  // Required: your API key
  accessToken: "pk_your_api_key",

  // Optional: override the API base URL (default: https://api.proofpudding.com)
  baseUrl: "https://api.proofpudding.ai",

  // Optional: max retries for failed requests (default: 3)
  maxRetries: 3,

  // Optional: request timeout in milliseconds (default: 30000)
  timeout: 30_000,
});

API Reference

Health

| Method | Description | | ----------------------- | ----------------------------- | | client.health.check() | Basic health check | | client.health.ready() | Readiness check (verifies DB) |

Documents

| Method | Description | | --------------------------------------------- | -------------------------- | | client.documents.upload({ filePath }) | Upload from file path | | client.documents.upload({ file, filename }) | Upload from Buffer | | client.documents.list({ skip?, limit? }) | List documents (paginated) | | client.documents.delete(documentId) | Delete a document | | client.documents.getFormats() | Get supported file formats | | client.documents.getPreviewUrl(documentId) | Get a signed preview URL |

Jobs

| Method | Description | | ----------------------------------------------------------------------- | ------------------------------- | | client.jobs.create({ documentId, question, config?, timeout? }) | Create a job (sync) | | client.jobs.createStream({ documentId, question, config?, timeout? }) | Create a job with SSE streaming | | client.jobs.list({ documentId?, skip?, limit? }) | List jobs (paginated) |

Job Config Options

interface JobConfig {
  verify_citations?: boolean; // Default: true
  reasoning_effort?: "auto" | "low" | "high"; // Default: "auto"
  output_schema?: {
    schema: Record<string, unknown>; // JSON Schema
    strict?: boolean; // Default: true
    include_citations?: boolean;
    include_raw_answer?: boolean;
  };
}

Error Handling

All API errors are thrown as typed exceptions:

import {
  PuddingError,
  ValidationError, // 400
  AuthenticationError, // 401
  NotFoundError, // 404
  RateLimitError, // 429
  ServerError, // 500
  GatewayError, // 502
  TimeoutError, // 504
} from "proofpudding";

try {
  await client.jobs.create({ documentId: "bad-id", question: "test" });
} catch (err) {
  if (err instanceof NotFoundError) {
    console.error("Document not found:", err.message);
  } else if (err instanceof AuthenticationError) {
    console.error("Bad API key");
  } else if (err instanceof RateLimitError) {
    console.error("Slow down!");
  }
}

Requirements

  • Node.js 20+