{"slug": "vernllm-lightweight-resilience-layer-for-openai-sdk", "title": "VernLLM - lightweight resilience layer for OpenAI SDK", "summary": "A developer released vernLLM, a lightweight resilience layer for OpenAI-compatible chat completion APIs that provides built-in retries, timeouts, circuit breaking, caching, structured output, and usage tracking. The library aims to help developers handle production reliability issues like provider failures and rate limits without rebuilding infrastructure for each project.", "body_md": "Building production-ready LLM applications is not just about sending prompts and receiving responses. Real-world AI systems need to handle timeouts, provider failures, rate limits, inconsistent outputs, and reliability issues.\n\nThat is where **vernLLM** comes in.\n\n**vernLLM is a lightweight resilience layer for OpenAI-compatible chat completion APIs**, providing a single interface with built-in retries, timeouts, circuit breaking, caching, structured output, and usage tracking.\n\nInstead of rebuilding the same reliability features for every LLM project, vernLLM gives you the tools needed to make your AI integrations more robust from the start.\n\nTransient failures happen. vernLLM automatically retries recoverable errors while failing fast on validation errors and non-retryable responses.\n\nPrevent hanging requests with configurable timeouts and cancellation support.\n\nAutomatically stop sending requests to failing providers and recover when the service becomes healthy again.\n\nPass a Zod schema and receive validated, typed results back.\n\n``` js\nconst result = await llm.call({\n  systemPrompt: 'Return JSON: { \"skills\": string[] }',\n  userContent: 'Extract skills from: ...',\n  schema: SkillsSchema // zod schema\n});\n```\n\nConstrain model generation itself instead of only validating responses afterward.\n\nCache LLM responses using your own cache adapter with `cachedCall`\n\nand `cachedLLMCall`\n\n.\n\nUse the same API across multiple providers:\n\n`fromFetch`\n\nMany LLM applications end up creating their own wrappers around provider SDKs to handle:\n\nvernLLM packages these patterns into a reusable, lightweight library so developers can focus on building AI features instead of maintaining infrastructure.\n\nInstall:\n\n```\npnpm add vern-llm openai\n```\n\nCreate your client:\n\n``` python\nimport OpenAI from 'openai';\nimport { VernLLM } from 'vern-llm';\n\nexport const llm = new VernLLM({\n  client: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),\n  model: 'gpt-4o',\n\n  maxRetries: 3,\n  timeoutMs: 10_000,\n  circuitBreaker: true,\n\n  onUsage: ({ totalTokens }) => {\n    console.log(`Used ${totalTokens} tokens`);\n  },\n});\n\n// now do something with it!\nexport const summary = await llm.cachedLLMCall({\n  cacheKey: `resume:${resumeId}`,\n  ttl: 3600,\n  call: {\n    systemPrompt: 'Analyze this resume and return structured hiring insights.',\n    userContent: resumeText,\n    schema: HiringSummarySchema, // Zod schema\n  }\n});\n```\n\nvernLLM is designed with production usage in mind:\n\nWhether you are building AI agents, document processing pipelines, chat applications, or LLM-powered tools, vernLLM provides the reliability layer needed to ship with confidence.\n\nDocumentation: [https://vernllm.vercel.app/](https://vernllm.vercel.app/)\n\nGitHub: [https://github.com/LakBud/vernLLM](https://github.com/LakBud/vernLLM)\n\nContributions, feedback, and ideas are welcome!", "url": "https://wpnews.pro/news/vernllm-lightweight-resilience-layer-for-openai-sdk", "canonical_source": "https://dev.to/lakbud/vernllm-lightweight-resilience-layer-for-openai-sdk-6c0", "published_at": "2026-07-20 21:20:29+00:00", "updated_at": "2026-07-20 21:31:41.943224+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models", "ai-tools", "ai-infrastructure"], "entities": ["vernLLM", "OpenAI", "LakBud"], "alternates": {"html": "https://wpnews.pro/news/vernllm-lightweight-resilience-layer-for-openai-sdk", "markdown": "https://wpnews.pro/news/vernllm-lightweight-resilience-layer-for-openai-sdk.md", "text": "https://wpnews.pro/news/vernllm-lightweight-resilience-layer-for-openai-sdk.txt", "jsonld": "https://wpnews.pro/news/vernllm-lightweight-resilience-layer-for-openai-sdk.jsonld"}}