Montek Developers

TypeScript SDK

@montek/sdk for Node 18+, Workers, Deno and Bun.

npm install @montek/sdk
import { readFile } from 'node:fs/promises';
import { Montek } from '@montek/sdk';

const montek = new Montek({ apiKey: process.env.MONTEK_API_KEY }); // apiKey defaults to MONTEK_API_KEY

const r = await montek.extract({ file: await readFile('order.pdf'), model: 'langbiang-extract-1.0', lang: 'ja', fields: ['order_number'] });
r.fields; r.lineItems; r.usage.count;

const job = await montek.cad.create({ file: await readFile('sketch.jpg'), model: 'fansipan-cad-1.0' });
const done = await job.wait(); // polls with backoff; or use a webhook
const dxf = await montek.cad.getPart(done.id, 1); // the first part, as DXF text

await montek.usage.get({ from: '2026-10-01', to: '2026-10-31' });
await montek.models.list();
await montek.me(); // the key, its project and organization, webhook secret and plans

file takes a path, a Buffer, a Blob or a URL. Multi-page PDFs are split by the server; usage tells you how many units a call used.

Errors and retries

Errors are typed: AuthError (401, 403), NoPlanError (402), RateLimitError (429), ValidationError (other 4xx) and ServerError (5xx). The client retries 429 and 5xx with backoff, honours Retry-After, and sends an Idempotency-Key on every POST so a retry is never counted twice.

Webhooks

import { verifyWebhook } from '@montek/sdk';

const event = await verifyWebhook(rawBody, request.headers.get('montek-signature'), process.env.MONTEK_WEBHOOK_SECRET);

Keys are secret, so never use one in a browser: call the API from your server. The source and changelog are public, in the montek-sdk-typescript repository.