Lesson 3 · path 2
Make your first API call
Send state plus one Noul question to POST /v1/systemone. Examples in curl, JavaScript, and Python.
The endpoint
POST https://api.typesafe.ai/v1/systemone
Authorization: Bearer <API_KEY>
Content-Type: application/json
The body needs three fields: state, model (for example "jev-latest"), and questions (a named map). Errors you might hit: 401, 422, 429, or 529. See API.
Think of this call like a doctor's visit. state is why you showed up. questions is the checklist the doctor runs. Here the state is a frustrated customer message, and the checklist has one item: a Noul asking "Does this message express urgency?" A Noul answers yes or no, plus a probability.
curl (from Quick start)
curl -X POST https://api.typesafe.ai/v1/systemone \
-H "Authorization: Bearer $TYPESAFE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"state": "Hi, I have been trying to connect my Stripe account for 3 days and it keeps failing. I am losing sales. Please help ASAP.",
"model": "jev-latest",
"questions": {
"urgency": {
"type": "noul",
"instructions": "Does this message express urgency?"
}
}
}'
JavaScript SDK
import { noul, TypeSafeClient } from "@typesafe-ai/sdk";
const client = new TypeSafeClient(); // reads TYPESAFE_API_KEY
const response = await client.systemOne({
state: "Hi, I have been trying to connect my Stripe account for 3 days and it keeps failing. I am losing sales. Please help ASAP.",
questions: {
urgency: noul("Does this message express urgency?"),
},
});
console.log(response.answers.urgency.noul);
Install: npm install @typesafe-ai/sdk (Node 20+).
Python SDK
from typesafe_sdk import Noul, TypeSafeClient
with TypeSafeClient() as client:
response = client.system_one(
state="Hi, I have been trying to connect my Stripe account for 3 days and it keeps failing. I am losing sales. Please help ASAP.",
questions={
"urgency": Noul(instructions="Does this message express urgency?"),
},
)
print(response.nouls["urgency"].noul)
# Also: response.answers["urgency"]
Install: pip install typesafe-sdk (Python 3.10 or newer).
Next
Learn State craft, then run the Choice, Noul, and Score labs.