Skip to main content
@eigenpal/sdk is the official TypeScript SDK. It is a typed wrapper over the EigenPal API, generated from the OpenAPI spec. Source is open at github.com/eigenpal/sdk-typescript.

Install

npm i @eigenpal/sdk
Requires a TypeScript-aware runtime: Bun, Deno, Node 22+ (native TS), tsx, Next.js, Vite, or any modern bundler. Plain node script.js will not work. Get an API key from the dashboard under Settings, API Keys.

Quick start

import { EigenpalClient, EigenpalValidationError } from '@eigenpal/sdk';

const client = new EigenpalClient({ apiKey: process.env.EIGENPAL_API_KEY });

// Pass a File / Blob / { content, filename, mimeType }. The SDK uploads the
// request as multipart/form-data, no base64 needed.
const result = await client.workflows.executions.runAndWait('extract-invoice', {
  contract_document: file,
});

console.log(result.status, result.output);

Authentication

Pass the key explicitly, or set EIGENPAL_API_KEY and let the SDK pick it up:
const client = new EigenpalClient({ apiKey: process.env.EIGENPAL_API_KEY });
The apiKey option always wins over the environment fallback.

Starting runs

client.run(target, input?, options?) starts a workflow or agent. Targets are strings like workflows.extract-invoice or agents.invoice-agent, or structured objects like { type: 'workflow', slug: 'extract-invoice' }. Use runAndWait to block until the run finishes and return its output.

Self-hosted

Point the SDK at your own deployment:
const client = new EigenpalClient({
  apiKey: process.env.EIGENPAL_API_KEY,
  baseUrl: process.env.EIGENPAL_BASE_URL ?? 'https://eigenpal.acme.internal',
});
baseUrl wins over the EIGENPAL_BASE_URL fallback and defaults to the hosted cloud.

Errors

Catch EigenpalValidationError when inputs do not match the workflow schema; it carries the field-level detail so you can surface it to the caller. See the API reference for the endpoints the SDK calls.