Skip to main content
Official SDKs for JavaScript/TypeScript and Python wrap the Quickstart HTTP API in a single typed client with matching shortcuts for all five decision kinds.

Install

npm install levanto
pip install levanto

View on npm

View on PyPI

JS/TS requires Node 18+ and has zero runtime dependencies (native fetch). Python requires 3.9+ and depends on httpx.

Initialize the client

import { LevantoClient, YesNo } from 'levanto';

const client = new LevantoClient({ apiKey: process.env.LEVANTO_API_KEY! });
Need a key? See Authentication.

Make a decision

const doc = 'Marketing email: "Risk-free, guaranteed 40% returns for accredited investors."';

// One decision -> full envelope
const env = await client.decide(doc, new YesNo('Needs compliance review?'));
console.log(env.result.answer);        // 'yes' | 'no'

Shortcuts

Each shortcut builds the matching question, makes one single decision, and returns just the result payload.
const r = await client.yesno(doc, 'Needs compliance review?');
console.log(r.probability, r.confidence, r.answer);

Batch requests

One document, many questions -> an aligned array/list. See Batch requests for grouped multi-document batching.
import { Scale } from 'levanto';

const severity = ['none', 'low', 'moderate', 'high', 'severe'];
const items = await client.decide(doc, [
  new YesNo('Urgent?'),
  new Scale('How severe?', severity),
]);
if (items[0].ok) console.log(items[0].result);   // { probability, confidence, answer }
Both SDKs expose the same client surface: one client object, five decision kinds, matching shortcuts, errors, and retry behavior. Python additionally ships an AsyncLevantoClient with an identical API, used with await:
from levanto import AsyncLevantoClient, YesNo

async with AsyncLevantoClient(api_key="lv_live_...") as client:
    env = await client.decide("...", YesNo("Needs review?"))

Full reference

Each README is a complete reference: every exported function and type, every default, and every behavior not obvious from the signatures.

levanto-js README

Full reference for the TypeScript/JavaScript client: every export, type, and behavior.

levanto-py README

Full reference for the Python client: every export, type, and behavior.