VernLLMVernLLM
Customization

Overview

The seams VernLLM lets you plug your own implementation into

VernLLM is built around a handful of small interfaces rather than one monolithic config object. Anywhere behavior is opinionated (how logs are written, how a cache is stored, how tokens are estimated), there's a matching interface you can implement instead of accepting the default.

These are all optional. Every one of them has a working default, logger falls back to console, cache is simply unused until you call cachedCall, estimateTokens falls back to a chars/4 heuristic, and schema is only checked when you provide one. Customize the ones that matter for your setup and leave the rest alone.

Where each option lives

All of these are passed into the VernLLM constructor, alongside client and model:

customization-surface.ts
const llm = new VernLLM({
  client: openai, // provider: an LLMClient (adapter or fromFetch)
  model: 'gpt-4o',
  logger: myLogger, // logging: a Logger
  cache: myCacheAdapter, // caching: a CacheAdapter
  rateLimit: {
    tokensPerMinute: 200_000,
    estimateTokens: myTokenizer, // tokenizer: an estimateTokens function
  },
});

const result = await llm.call({
  systemPrompt,
  userContent,
  schema: MySchema, // schema: anything exposing safeParse
});

Tokenizer and schema aren't standalone options, they're parameters of two other features: estimateTokens configures rate limiting, and schema configures structured output. The pages under this section describe the same options from the "how do I plug in my own implementation" angle; the Core pages describe the full behavior of the feature they belong to.

On this page