{"id":15689,"library":"llmwhisperer-client","title":"LLMWhisperer JavaScript Client","description":"The `llmwhisperer-client` is a JavaScript client library designed to facilitate interaction with the LLMWhisper API. Its primary function is to preprocess complex documents, such as PDFs and images, to extract raw text in a format optimized for consumption by Large Language Models. The library, currently at stable version 2.5.0, appears to follow an active release cadence with frequent minor updates. Key differentiators include a \"Layout Preserving Mode\" for maintaining document structure, automatic switching between native text and OCR modes, and intelligent handling of interactive elements like checkboxes in PDF forms. This enables robust and accurate structured data extraction from various document types, including invoices, purchase orders, and bank statements, by presenting data to LLMs in their most understandable form.","status":"active","version":"2.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/Zipstack/llmwhisperer-js-client","tags":["javascript"],"install":[{"cmd":"npm install llmwhisperer-client","lang":"bash","label":"npm"},{"cmd":"yarn add llmwhisperer-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add llmwhisperer-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"While CommonJS `require` is shown in the README, modern JavaScript projects often prefer ES Modules. Both are supported in v2.x.","wrong":"const { LLMWhispererClientV2 } = require('llmwhisperer-client');","symbol":"LLMWhispererClientV2","correct":"import { LLMWhispererClientV2 } from 'llmwhisperer-client';"},{"note":"Used for handling errors specific to the LLMWhisperer client, providing structured error information.","symbol":"LLMWhispererClientException","correct":"import { LLMWhispererClientException } from 'llmwhisperer-client';"},{"note":"TypeScript type definition for the client configuration options, useful for strict type checking.","symbol":"LLMWhispererClientOptions","correct":"import type { LLMWhispererClientOptions } from 'llmwhisperer-client';"}],"quickstart":{"code":"import { LLMWhispererClientV2 } from 'llmwhisperer-client';\n\n// Configure the client. API key can be set via LLMWHISPERER_API_KEY env variable.\nconst options = {\n  apiKey: process.env.LLMWHISPERER_API_KEY ?? 'YOUR_SECRET_API_KEY',\n  baseUrl: process.env.LLMWHISPERER_BASE_URL ?? 'https://api.llmwhisperer.com/v2',\n  apiTimeout: 5000, // Timeout in milliseconds\n  loggingLevel: 'info' // 'error', 'warn', 'info', 'debug'\n};\n\n// Create a new client instance\nconst client = new LLMWhispererClientV2(options);\n\nasync function runWhisperExample() {\n  try {\n    // Replace with actual whisper options like document content, type, etc.\n    // This is a placeholder as the README does not provide a full `whisper` example.\n    // Example: const whisperResult = await client.whisper({ content: '...', type: 'pdf' });\n    console.log('Client initialized and ready to make API calls.');\n    console.log('You can now use methods like client.whisper(), client.whisperStatus(), etc.');\n  } catch (error) {\n    console.error('An error occurred:', error.message);\n  }\n}\n\nrunWhisperExample();","lang":"javascript","description":"Initializes the LLMWhisperer client with optional configuration, demonstrating how to provide an API key and base URL, falling back to environment variables."},"warnings":[{"fix":"Migrate all client instantiations and API calls to use `LLMWhispererClientV2`. Review the `LLMWhispererClientV2` documentation for updated API signatures.","message":"As of version `2.5.0`, the previously deprecated V1 client (e.g., `LLMWhispererClient` without the `V2` suffix) has been completely removed. Applications still relying on V1 client imports or methods will encounter runtime errors.","severity":"breaking","affected_versions":">=2.5.0"},{"fix":"Ensure `LLMWHISPERER_API_KEY` is set in your environment or pass `{ apiKey: 'YOUR_API_KEY' }` to the client constructor.","message":"The LLMWhisperer client requires an API key for authentication. If the `LLMWHISPERER_API_KEY` environment variable is not set, the `apiKey` property must be explicitly provided in the options object during `LLMWhispererClientV2` instantiation.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Review the official client documentation for `LLMWhispererClientV2` and update your application logic to conform to the new API. Explicitly use `LLMWhispererClientV2` for new integrations or when upgrading from older major versions.","message":"Version `2.0.0` introduced `LLMWhispererClientV2`, signaling a major API revision. While specific breaking changes from a V1 client aren't detailed in the immediate changelog, the introduction of a new client class implies an incompatible API surface compared to any pre-2.0.0 client.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Wrap API calls in `try-catch` blocks and specifically handle `LLMWhispererClientException` to manage API failures, network issues, or invalid responses gracefully.","message":"Errors returned from the API or encountered internally by the client are typically wrapped in an `LLMWhispererClientException`. Neglecting to catch this specific exception type can lead to unhandled errors.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Update your code to use `LLMWhispererClientV2`. Change `new LLMWhispererClient(...)` to `new LLMWhispererClientV2(...)`.","cause":"Attempting to instantiate the removed V1 client after upgrading to version `2.5.0` or higher.","error":"TypeError: LLMWhispererClient is not a constructor"},{"fix":"Provide the API key: `new LLMWhispererClientV2({ apiKey: 'YOUR_API_KEY' })` or set `LLMWHISPERER_API_KEY=YOUR_API_KEY` in your environment.","cause":"The `apiKey` was not provided in the client options object, and the `LLMWHISPERER_API_KEY` environment variable is not set.","error":"Error: API key is missing or invalid."},{"fix":"Change the import statement to use ES module syntax: `import { LLMWhispererClientV2 } from 'llmwhisperer-client';`.","cause":"Using CommonJS `require()` syntax (`const { ... } = require(...)`) in an ES Module project (`\"type\": \"module\"` in `package.json`).","error":"ReferenceError: require is not defined in ES module scope"}],"ecosystem":"npm"}