Skip to main content

Install

Node 18 or higher. Works in Bun, Deno, and modern edge runtimes.
Never ship an API key to the browser. Call the SDK from a server route (Next.js Route Handlers, tRPC procedures, Express endpoints) and proxy the response to your client.

Quick start

Full method surface

Every method returns a typed promise. See src/types.ts for the full type surface.

Constructor options

Idempotency

Pass idempotencyKey in options to make retries safe.

Error handling

Non-2xx responses throw ApiError with the status, machine code, parsed body, and retryAfter (populated on 429).
The client retries once by default on 429 and 5xx. Set maxRetries: 0 on the constructor to disable.

Types

The full request and response shapes are typed. Some highlights:

Edge runtime notes

The SDK uses the global fetch. On Vercel Edge and Cloudflare Workers, no additional configuration is needed. On Node 16 (which does not have global fetch), inject undici:
Node 18+ has native fetch; no injection required.

Repository and issues