Guides/TypeScript SDK
🟦SDK

TypeScript SDK

Install, authenticate, and call every Latentface endpoint from Node, Deno, or the browser with full TypeScript types.

Requirements

  • Node 18+, Deno 1.30+, or a modern browser
  • npm or pnpm
1

Install

`npm install @latentface/sdk` or `pnpm add @latentface/sdk`. ESM + CJS builds; TypeScript types included.

2

Initialize

`import { Latentface } from '@latentface/sdk'; const client = new Latentface();`. Reads `LATENTFACE_API_KEY` or pass `{ apiKey }`.

3

Call an endpoint

`const result = await client.swap({ source, target });` — every method returns a typed promise with full autocomplete.

4

Browser usage

Safe to use in the browser with a short-lived scoped key (issue with `POST /v1/keys/scoped`). Never ship your root key to the browser.

Tip: For Next.js, use scoped keys on the server via a route handler and proxy calls — don't NEXT_PUBLIC_ your root key.

Ready to go live?

Start your first Latentface session for free — no credit card required.