VernLLMVernLLM
API Reference

Notes & Caveats

Requirements, edge cases, and dependency behavior

  • Requires Node 20+ for AbortSignal.any.
  • Non retryable status codes (default 400, 401, 403, 404, 422) fail fast instead of consuming a retry and are reported as LLMError('api', status).
  • An already aborted signal rejects immediately with LLMError('aborted') before any request is dispatched.
  • Per attempt timeouts throw LLMError('timeout') and can be retried like other transient failures.
  • jsonMode: false skips JSON parsing entirely and returns the raw string.
  • jsonMode defaults to false, not true, on any call that sets tools.
  • tools and schema are never mutually exclusive, on any provider; schema only validates parsed JSON text and never touches request fields tool calling uses. tools and jsonSchema are mutually exclusive by default on Anthropic and Bedrock only, and throw LLMError('invalid_params', { code: 'unsupported_capability' }) if combined there, except on models opted into nativeStructuredOutputModels. Gemini and OpenAI-compatible clients never restrict tools + jsonSchema at all. See Structured Output.
  • fromFetch supports tool calling: mapResponse can return a toolCalls array (id/name/JSON-encoded-arguments-string) alongside content, translated into the same WireToolCall shape every other adapter produces.
  • stream: true requires the underlying client/adapter to implement createStream. A client that doesn't throws a clear LLMError('invalid_params', { code: 'unsupported_capability' }) rather than a confusing runtime failure.
  • A streaming call that fails after at least one chunk has already arrived is not retried, only a failure before the first chunk is. See What gets retried.
  • fallback only falls over on a stream failing to open. A mid-stream failure after at least one chunk has arrived is terminal for that call and never tries another target, for the same reason it isn't retried. See Streaming: open failures only.
  • fallback never reorders, scores, or health-checks the declared targets. It tries them strictly in the order given, and the same is true across retries within a single target.
  • chunks on a StreamCallResult is single-use. Iterating it more than once, or from more than one place concurrently, splits the sequence between consumers rather than replaying it.
  • reserveUsage failures stop the call before a provider request is sent and surface as LLMError('quota_exceeded'). VernLLM does not decide quota rules; the application controls the reservation logic.
  • Provider SDKs and validation libraries are not runtime dependencies. VernLLM relies on compatible interfaces rather than specific implementations, so users bring their own provider clients and schema validators (such as Zod-compatible validators).