npm.io
0.3.0 • Published yesterday

@llmref/sdk

Licence
Version
0.3.0
Deps
0
Size
16 kB
Vulns
0
Weekly
0

@llmref/sdk

TypeScript SDK for LLM Reference - a free, versioned documentation registry and semantic search API for AI tools, coding assistants, and retrieval systems.

Thin, typed client over the public API at api.llmref.org. ESM, runs anywhere with a global fetch (Node 18+, Bun, Deno, browsers).

Install

bun add @llmref/sdk
# or: npm install @llmref/sdk

Usage

import { LlmRefClient } from '@llmref/sdk';

const client = new LlmRefClient();

// Fetch the latest docs for a project
const { resolved_version } = await client.resolve('nextjs', 'latest');
const llmsTxt = await client.getLlmsTxt('nextjs', resolved_version);

// Semantic search
const { chunks } = await client.search({
  project: 'nextjs',
  version: resolved_version,
  query: 'how do I configure caching',
  top_k: 5,
});

Client

new LlmRefClient({
  baseUrl?: string,  // default: https://api.llmref.org/v1
  apiKey?: string,   // sent as `Authorization: Bearer`, raises rate limits
  fetch?: typeof fetch,
});

Methods

Method Returns
listProjects(options?) Project[] (fuzzy query, limit, skip)
getProject(slug) Project
resolve(project, version?) ResolveResult
getLlmsTxt(slug, version) string
getLlmsFullTxt(slug, version) string
getMeta(slug, version) SnapshotMeta
getDumps(slug, version) DumpUrls
search(options) SearchResult

Every method returns a Promise and throws on a non-2xx response.

Documentation

Full reference, guides, and a tutorial: llmref.org.

License

MIT