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

caesar-search

v0.4.0

Published

Official TypeScript SDK for the Caesar search API — web search with provenance, built for agents.

Readme

caesar-search

Official TypeScript SDK for the Caesar search API — web search with provenance, built for agents.

npm install caesar-search

Works in Node 20+, Bun, Deno, and edge runtimes (standard fetch). ESM and CJS, fully typed.

Quickstart

import { Caesar } from "caesar-search";

const caesar = new Caesar(); // requires CAESAR_API_KEY (get one at app.trycaesar.com)

const results = await caesar.search("postgres 17 logical replication failover", {
  maxResults: 5,
});

for (const result of results.results ?? []) {
  console.log(result.rank, result.title, result.canonical_url);
}

// Read a result as clean markdown — pass a doc_id or a URL
const doc = await caesar.read(results.results?.[0]?.doc_id, { maxChars: 8000 });
console.log(doc.content?.text);

// Close the loop: feedback improves ranking
await caesar.feedback("result_helpful", {
  searchId: results.search_id,
  docId: results.results?.[0]?.doc_id,
  rank: 1,
});

The agent loop

search() → pick a doc_idread() → optionally feedback(). Results carry provenance handles (doc_id, canonical_url, source_url, crawl dates) so agents can cite and re-fetch exactly what they used.

Truncated reads

A truncated read sets content.truncated. Continue from where it stopped instead of retrying with a bigger cap:

const next = await caesar.read(docId, {
  startChar: (doc.content?.start_char ?? 0) + (doc.content?.char_count ?? 0),
});

Response shaping

Keep payloads token-efficient with verbosity (ids_only | compact | standard | full) and a hard budget:

await caesar.search("query", { verbosity: "compact", maxCharsTotal: 4000 });

Vercel AI SDK tools

The caesar-search/ai subpath exports ready-made tools (requires the optional ai peer dependency):

import { generateText } from "ai";
import { caesarTools } from "caesar-search/ai";

const { text } = await generateText({
  model,
  tools: caesarTools(),
  prompt: "What changed in Postgres 17 logical replication?",
});

Configuration

| Option | Environment variable | Default | |---|---|---| | apiKey | CAESAR_API_KEY | required; throws MissingAPIKeyError on the public endpoint | | baseUrl | CAESAR_BASE_URL | the public endpoint | | maxRetries | — | 3 (429/5xx, honors Retry-After) | | timeoutMs | — | 30000 |

Errors

import { AuthenticationError, MissingAPIKeyError, RateLimitError, APIStatusError } from "caesar-search";

All API errors carry statusCode, code, requestId, and the raw response. Connection failures throw APIConnectionError; timeouts throw APITimeoutError.

Raw responses

caesar.withResponse.search(...) returns { data, response } when you need headers or status.

Versioning

The client is generated from the live OpenAPI spec (spec/openapi-public.json). Non-breaking spec changes release automatically as patch versions; breaking changes are reviewed first. See CHANGELOG.md.

License

MIT