Skip to main content
The @cloro-dev/cloro npm package is the official TypeScript/Node SDK for the cloro API — one typed client for Google Search and every AI answer engine, where each call is a single authenticated request that returns structured JSON with sources. It ships ESM and CommonJS builds with bundled type declarations; the source lives in the cloro-node repository.

Prerequisites

Install the package

Configure your API key

The client reads CLORO_API_KEY from the environment automatically:
Or pass it to the constructor:

Quickstart

Every call resolves with the { success, result } envelope. Pass include: {...} to request extra formats (markdown, html, searchQueries, shopping, and more, depending on the engine).

Every engine, one client

AI engines take a prompt; Google Search and Google News take a query. Each method is a thin wrapper over one endpoint. client.monitor.google also accepts location, uule, device, and pages (1–10). The client exposes client.countries() and client.states() for the supported countries and states.

Async task queue

For large batches, don’t loop synchronous calls — enqueue tasks and poll them. createBatch submits up to 500 tasks in one request; wait polls a task to completion with interval backoff. See Async requests.
For a single task, client.asyncTasks.run({ taskType, payload }) creates it and resolves once it completes. Valid taskType values: CHATGPT, GEMINI, PERPLEXITY, COPILOT, GROK, AIMODE, GOOGLE, GOOGLE_NEWS.

Reliability and configuration

The client retries timeouts, connection errors, and 429/5xx responses with exponential backoff — tune it with new Cloro({ maxRetries: 2, timeout: 60000 }) (timeout in milliseconds). Cap your own concurrency to your plan’s limit (see Concurrency), read the key from CLORO_API_KEY rather than hardcoding it, and access response fields with optional chaining (?.) since shapes vary by query (a Google result with no AI Overview omits aioverview).

Error handling

Every error subclasses CloroError, so one instanceof CloroError check catches everything. HTTP failures map to status-specific types:

Next steps