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 asLLMError('api', status). - An already aborted
signalrejects immediately withLLMError('aborted')before any request is dispatched. - Per attempt timeouts throw
LLMError('timeout')and can be retried like other transient failures. jsonMode: falseskips JSON parsing entirely and returns the raw string.jsonModedefaults tofalse, nottrue, on any call that setstools.toolsandschemaare never mutually exclusive, on any provider;schemaonly validates parsed JSON text and never touches request fields tool calling uses.toolsandjsonSchemaare mutually exclusive by default on Anthropic and Bedrock only, and throwLLMError('invalid_params', { code: 'unsupported_capability' })if combined there, except on models opted intonativeStructuredOutputModels. Gemini and OpenAI-compatible clients never restricttools+jsonSchemaat all. See Structured Output.fromFetchsupports tool calling:mapResponsecan return atoolCallsarray (id/name/JSON-encoded-arguments-string) alongsidecontent, translated into the sameWireToolCallshape every other adapter produces.stream: truerequires the underlying client/adapter to implementcreateStream. A client that doesn't throws a clearLLMError('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.
fallbackonly 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.fallbacknever 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.chunkson aStreamCallResultis single-use. Iterating it more than once, or from more than one place concurrently, splits the sequence between consumers rather than replaying it.reserveUsagefailures stop the call before a provider request is sent and surface asLLMError('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).