Skip to content

Docs

JavaScript SDK Guide

Quickstart for @typesafe-ai/sdk on Node 20+: answer types inferred from your questions, a choice() helper, and one systemOne call to classify a support ticket.
Format
Docs
Reading time
2 min
Published by
TypeSafe AI
Last verified
Sep 2026

Highlights

  • Install with npm install @typesafe-ai/sdk; Node.js 20 or newer is required.
  • The client reads TYPESAFE_API_KEY from the environment.
  • Answer types are inferred from your questions; the package ships ESM, CommonJS, and declarations.

Quickstart

ts
import { choice, TypeSafeClient } from "@typesafe-ai/sdk";

const client = new TypeSafeClient();
const response = await client.systemOne({
  state: { document: "I was charged twice. Please fix this ASAP." },
  questions: {
    category: choice("What is this ticket about?", {
      billing: null,
      technical: null,
      other: null,
    }),
  },
});

console.log(response.answers.category.choice);

Watch out

The docs track a specific SDK release, so check the changelog when behavior and examples drift apart.

Questions about this entry

Short answers drawn from the linked project or page.

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai