Quickstart

Verify your first claim and get a typed response with sources. Five minutes from signup to working code. Pick Python or TypeScript below.

1

Get an API key

Sign up, then visit /api-integration and generate a key. You'll see it once — copy it somewhere safe.

2

Install the SDK

Python
pip install lenz-io
TypeScript
npm install lenz-io
3

Run the extract → verify pipeline

Paste any model output. Extract the claims, verify the ones that matter.

Python
from lenz_io import Lenz

client = Lenz(api_key="lenz_...")

brief = """
Air pollution causes 7 million premature deaths annually.
Bilingual children develop stronger executive function.
"""

# 1. Extract atomic claims (free, quick)
claims = client.extract(text=brief).claims
for c in claims:
    print(" -", c)

# 2. Verify the first one (~90s, 7-model panel)
v = client.verify_and_wait(claim=claims[0]).verdict
print(v.label, v.score, v.confidence)
# → "true" 8.0 0.91

for s in v.sources[:3]:
    print(" -", s.title, s.url)
TypeScript
import { Lenz } from "lenz-io";

const client = new Lenz({ apiKey: "lenz_..." });

const brief = `
Air pollution causes 7 million premature deaths annually.
Bilingual children develop stronger executive function.
`;

// 1. Extract atomic claims (free, quick)
const { claims } = await client.extract({ text: brief });
claims.forEach(c => console.log(" -", c));

// 2. Verify the first one (~90s, 7-model panel)
const v = (await client.verifyAndWait({ claim: claims[0] })).verdict;
console.log(v?.label, v?.score, v?.confidence);
// → "true" 8.0 0.91
4

Next steps

Verify your own claims and the full pipeline runs. For production:

  • Switch to webhook delivery instead of polling. Pass webhook_url on verify(); Lenz POSTs the typed payload to your endpoint when the pipeline lands. The SDK ships a LenzWebhooks handler that verifies signatures.
  • Use verify_batch for fan-out of multi-claim LLM output.
  • Check the full API reference for every endpoint.

Common errors

Every error from the SDK carries cause, fix, doc_url and a request_id you can quote on a support ticket.

LenzAuthError — your API key is missing or invalid. Regenerate at /api-integration.
LenzRateLimitError — too many requests. retry_after carries seconds until the next allowed call.
LenzQuotaExceededError — your credit budget is spent for this period. credits_remaining tells you what's left (0 here). Upgrade or wait for reset.
LenzValidationError — request body is malformed. errors is a list of per-field complaints.
LenzNeedsInputError — the pipeline paused for clarification. Inspect the payload, then call client.select(task_id, ...) to resume.
LenzTimeoutErrorverify_and_wait exceeded the timeout. The pipeline keeps running server-side; the exception's task_id lets you resume via client.get_status().
Found this useful? The Python SDK lives at github.com/lenzhq/lenz-io-python and the Node SDK at github.com/lenzhq/lenz-io-node. File issues there — we read them.

Using the API in production? Read the API Terms of Service →