# Show HN: VernLLM – The AI resilience layer for TypeScript

> Source: <https://vernllm.vercel.app>
> Published: 2026-07-29 17:05:25+00:00

# Reliable LLM calls,

by default.

A lightweight resilience layer for LLM chat completions. Retries, timeouts, caching, and circuit breaking, dependency-light and typed from the start.

`$ npm install vern-llm`

## What this call actually does.

`maxRetries: 3`

→ 3 attempts with exponential backoff`timeoutMs: 10_000`

→ 10s hard timeout per attempt`circuitBreaker: true`

→ Trips after repeated failures`onUsage`

→ Token usage reported per call`cachedLLMCall`

→ Identical calls skip the network`schema`

→ Response validated and typed via Zod

`maxRetries: 3`

### Retry with backoff

Retries a failed call up to N times with exponential backoff and jitter between attempts.

`timeoutMs: 10_000`

### Per-attempt timeout

Each attempt is raced against a hard timeout, so no single request can hang the call.

`circuitBreaker: true`

### Circuit breaker

Trips after repeated failures and rejects immediately while open. Call getCircuitState() to inspect it.

`nonRetryableStatus: [400, 401, 403, 404]`

### Fail-fast status codes

Status codes you mark as non-retryable skip the retry loop entirely.

`llm.cachedLLMCall({ cacheKey, ttl, call })`

### Caching

Wraps call() with a pluggable cache adapter. Identical calls return without hitting the network.

`schema: HiringSummarySchema`

### Structured output

Pass a Zod schema inside call params and receive validated, typed JSON.

`onUsage: ({ totalTokens }) => {}`

### Usage tracking

Reports prompt, completion, and total tokens whenever the provider returns usage data.

`logger: myLogger`

### Pluggable logger

Bring your own Logger implementation or fall back to the built-in console logger.

[OpenAI](/docs/adapters)

[Anthropic](/docs/adapters/anthropic)

[Gemini](/docs/adapters/gemini)

[Groq](/docs/adapters/openai-compatible)

[Mistral](/docs/adapters/openai-compatible)

[DeepSeek](/docs/adapters/openai-compatible)

[Cerebras](/docs/adapters/openai-compatible)

[Together AI](/docs/adapters/openai-compatible)

[Fireworks AI](/docs/adapters/openai-compatible)

[Ollama](/docs/adapters/openai-compatible)

[OpenRouter](/docs/adapters/openai-compatible)

[Perplexity](/docs/adapters/openai-compatible)

[DeepInfra](/docs/adapters/openai-compatible)

[Novita](/docs/adapters/openai-compatible)

[Hyperbolic](/docs/adapters/openai-compatible)

[Moonshot (Kimi)](/docs/adapters/openai-compatible)

[Zhipu (GLM)](/docs/adapters/openai-compatible)

[LM Studio](/docs/adapters/openai-compatible)

[vLLM](/docs/adapters/openai-compatible)

[xAI (Grok)](/docs/adapters/openai-compatible)

[NVIDIA NIM](/docs/adapters/openai-compatible)

[Vercel AI Gateway](/docs/adapters/openai-compatible)

[Cloudflare Workers AI](/docs/adapters/openai-compatible)

[GitHub Models](/docs/adapters/openai-compatible)

[Nebius AI Studio](/docs/adapters/openai-compatible)

[SambaNova Cloud](/docs/adapters/openai-compatible)

[Baseten](/docs/adapters/openai-compatible)

[Featherless AI](/docs/adapters/openai-compatible)

[Friendli AI](/docs/adapters/openai-compatible)

[SiliconFlow](/docs/adapters/openai-compatible)

[Parasail](/docs/adapters/openai-compatible)

[StepFun](/docs/adapters/openai-compatible)

[MiniMax](/docs/adapters/openai-compatible)

[Lambda Labs](/docs/adapters/openai-compatible)

[Snowflake Cortex](/docs/adapters/openai-compatible)

[Anyscale](/docs/adapters/openai-compatible)

[Lepton AI](/docs/adapters/openai-compatible)

[kluster.ai](/docs/adapters/openai-compatible)

[Inference.net](/docs/adapters/openai-compatible)

[Infermatic](/docs/adapters/openai-compatible)

[AtlasCloud](/docs/adapters/openai-compatible)

[01.AI (Yi)](/docs/adapters/openai-compatible)

[AWS Bedrock](/docs/adapters/bedrock)

[Custom HTTPS API](/docs/adapters/custom-fetch)

Every project calling an LLM API ends up writing the same defensive code: retry logic, timeouts, a circuit breaker, a cache layer, usually copied between projects and slightly wrong each time. VernLLM gives you those primitives with sensible defaults out of the box, so you keep your existing client and just wrap it.

No. VernLLM wraps the client you already have, OpenAI, Anthropic, Gemini, Bedrock, or anything OpenAI-compatible, so you keep your existing setup and just route calls through it.

Yes. cachedLLMCall works with any adapter implementing get/set/delete, so you can plug in Redis, a database, or your own store instead of the built-in in-memory cache.

Yes, written in TypeScript from the ground up. Structured output schemas, call params, and errors are all typed, so mistakes surface at compile time instead of at runtime.

Zero bundled dependencies. Zod and provider SDKs are peer dependencies, and VernLLM only relies on their shapes structurally, so it stays dependency-light and typed from the start.

12.1 kB minified, 4.4 kB minified and gzipped. Small enough to drop into a project without thinking twice about it.

Yes, VernLLM is MIT licensed and open source. Use it in personal or commercial projects, fork it, or contribute back on GitHub.
