TypeSafe Jev — integration reference
Verified against docs.typesafe.ai, the OpenAPI spec, PyPI, npm and the
integration docs on 2026-10-03. Versions at that date: typesafe-sdk 0.7.2,
@typesafe-ai/sdk 0.6.0, model jev-1.13.0, Pydantic AI 2.53.0,
@ai-sdk/typesafe-ai 3.0.12, langchain-typesafe 0.0.1a3 (alpha).
The SDKs are pre-1.0 and have shipped breaking changes in minor releases —
pin them.
Deeper material:
| File |
Covers |
quick-ref/python-sdk.md |
sync/async clients, response_model, retries, exceptions, HTTP/2, logging, gateways |
quick-ref/javascript-and-http.md |
JS/TS SDK, raw HTTP with curl, OpenAPI quirks |
quick-ref/framework-integrations.md |
Pydantic AI, LangChain, Vercel AI SDK, OpenRouter, LiteLLM, DSPy, others |
quick-ref/question-design.md |
writing questions and state, the documented patterns and failure modes |
Deep Knowledge: Use mcp__documentation__fetch_docs with technology:
typesafe-jev and one of these topics:
api-reference: every field, error body and limit, plus where the docs and the OpenAPI spec disagree.
python-sdk and javascript-sdk: the full SDK surface, mock-transport tests and concurrency patterns.
pydantic-ai, langchain, vercel-ai-sdk, dspy: one page per integration.
recipes-extraction and recipes-routing: the official cookbooks, ported and runnable.
evidence: every independent study, with its methodology and caveats.
Every code block there was quoted from a cited source, executed offline against mocks, or type-checked.
Mental model
One request = one state (what is judged) + a map of named questions (what
is asked about it). Every question is answered independently against the same
state, in parallel. The question keys are yours and are not sent to the
model — only instructions and criteria are.
POST https://api.typesafe.ai/v1/systemone
Authorization: Bearer $TYPESAFE_API_KEY
{
"state": "Help! My payouts have been failing for 3 days.",
"model": "jev-latest",
"questions": {
"is_urgent": {"type": "noul", "instructions": "Does this convey urgency?",
"criteria": {"true": "Explicitly time-sensitive", "false": "No urgency expressed"}},
"department": {"type": "choice", "instructions": "Which team should handle this?",
"criteria": {"billing": "Payments, invoicing, refunds",
"technical": "Bugs, outages, integrations",
"sales": "Pricing, upgrades, new accounts"}},
"frustration": {"type": "score", "instructions": "How frustrated is the customer?",
"criteria": ["Calm", "Frustrated", "Very angry"]}
}
}
| Question |
criteria |
Answer fields |
noul |
optional {"true": …, "false": …} |
noul (P(yes)) |
choice |
required map option → description or null; ≤ 255 options |
choice, probabilities (option → float), confidence |
score |
required ordered array of level descriptions; 2–10 levels |
score (float, can land between levels), legend ("0" → text), probabilities ("0" → float), confidence |
state, instructions and each criterion accept a string, object or array.
Response top level: model (the versioned id that answered), answers,
usage.input_tokens, usage.output_tokens. Request id: x-typesafe-request-id.
Python quickstart
pip install typesafe-sdk # Python >= 3.10; extra: typesafe-sdk[http2]
export TYPESAFE_API_KEY=...
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient
client = TypeSafeClient()
state = "I was charged twice. Please help ASAP."
questions = {
"billing": Noul(instructions="Is this about billing?"),
"tone": Choice(
instructions="What is the tone?", criteria={"calm": None, "angry": None}
),
"urgency": Score(
instructions="How urgent is this?", criteria=["low", "medium", "high"]
),
}
result = client.system_one(state, questions)
print(
result.nouls["billing"].noul,
result.choices["tone"].choice,
result.scores["urgency"].score,
)
result.answers[key] holds every answer; .nouls, .choices, .scores are
typed views. In the SDK, ScoreAnswer.probabilities and .legend are keyed by
int; on the wire they are strings. AsyncTypeSafeClient has the same
surface. Full detail in quick-ref/python-sdk.md.
JavaScript / TypeScript quickstart
npm install @typesafe-ai/sdk # Node.js 20+; ESM + CJS + .d.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);
Helpers: noul(instructions?, criteria?), choice(instructions, criteria),
score(instructions, criteria) (criteria typed as a tuple of ≥ 2). Answer types
are inferred from the questions. Browser use is refused unless
dangerouslyAllowBrowser: true — keep the key server-side.
Models and pinning
| id |
resolves to |
meaning |
jev-latest |
jev-1.13.0 |
latest stable; SDK default |
jev-preview |
jev-1.13.0 |
latest build, official or not |
jev-1.13.0 |
— |
pinned |
The vendor's own rule: "If you have tuned confidence thresholds against a
specific version, pin that version's ID instead of the alias." Log
response.model on every call so an alias move is visible in your traces.
GET /v1/models lists aliases only; versioned ids are accepted regardless.
Limits and pricing (as of 2026-10-03 — re-check, they move)
| Item |
Value |
| Price |
$0.042 per million input tokens; output tokens free |
| Rate limits |
100K tokens/s, 80 requests/s (was 40 req/s two weeks earlier); 429 on either |
| Context |
64k tokens for state + all questions; 32k for state + the single longest question |
| Choice |
≤ 255 options |
| Score |
2–10 levels (the OpenAPI spec and Python SDK enforce only "non-empty") |
| Input |
text only; English primary, CJK "handled but not equally well" |
| Streaming |
none |
| Sampling |
none — no temperature/top_p |
| Hosting |
US; no self-hosting; zero data retention for enterprise via sales |
| Training on your data |
no (docs + privacy policy) |
The vendor states it cannot prove the price is not subsidised. Budget for it
going up.
Errors and retries
| Status |
Meaning |
| 401 |
missing/invalid key |
| 422 |
body failed validation; FastAPI-style detail[] names the field |
| 429 |
rate limited — honour retry-after |
| 529 |
overloaded — retry with backoff |
Both SDKs retry 408, 429 and 5xx twice by default with jittered exponential
backoff (0.5 s → 5 s) and honour retry-after. Python's RetryPolicy.timeout
(30 s) stops new attempts once spent but never interrupts one in flight, so
the worst case is that budget plus one per-attempt timeout (10 s) — set both
on latency-critical paths. JS has a per-attempt timeout (10 s) and no total
budget; an AbortSignal caps the whole call but rejects with
APIUserAbortError, not APITimeoutError.
Rules that prevent most bugs
- The prompt is the state; the question goes in
instructions. A question
written into the state is judged as text, not answered.
- One judgement per question. Combine in code.
- Every Choice gets a catch-all (
other / none of the above) unless the
options are provably exhaustive — the model must pick something.
- Never threshold
choice alone. Read confidence/probabilities; for
Noul, the probability is the uncertainty.
- Keep arithmetic, counting and date comparison in code. Ask Jev to
extract or pick; compute yourself.
- Treat state as attacker-controlled. Prompt injection through the state
is documented as live. A Noul gating a destructive action is not an
authorization layer — pair it with human approval.
- Test option order on any Choice that matters (the model leans toward the
first option).
decision-model-calibration has a one-request rotation check.
- Don't send secrets in state — it leaves your infrastructure.
Official resources
- Docs: https://docs.typesafe.ai — append
.md to any page path for its
current markdown. The full dump at /llms-full.txt lags: on 2026-10-03 it
still served the 40 req/s limit and the 2026-09-17 limitations page. Never
quote an operational fact from it without checking the page itself
- OpenAPI: https://api.typesafe.ai/openapi.json · console: https://console.typesafe.ai
- Limitations: https://docs.typesafe.ai/model-jaggedness/jev-1.13
- Official agent skill:
claude plugin marketplace add typesafe-ai/skills
typesafe-ai/system-one-adapter-python: a drop-in replacement for
system_one backed by ordinary LLM APIs (not for the whole client: different
constructor, no models.list) — useful for comparing like-for-like through
the same calling code
1---2name: typesafe-jev3description: |4 Building against TypeSafe's Jev: the /v1/systemone HTTP API, the Python5 (`typesafe-sdk`) and JS (`@typesafe-ai/sdk`) SDKs, Noul/Choice/Score request6 and answer shapes, model ids and pinning, limits, pricing, retries, errors,7 gateways, and the framework integrations (Pydantic AI `TypeSafeModel`,8 LangChain `TypeSafeClassifier`, Vercel AI SDK, OpenRouter, LiteLLM, DSPy).910 USE WHEN: code imports `typesafe_sdk`, `@typesafe-ai/sdk`, `langchain_typesafe`,11 `@ai-sdk/typesafe-ai`, or uses `typesafe:jev-latest`, `client.system_one`,12 `client.systemOne`, `TYPESAFE_API_KEY`, `api.typesafe.ai`; user asks how to13 call Jev, write Noul/Choice/Score questions, or wire Jev into an agent.1415 DO NOT USE FOR: deciding *whether* a typed decision model fits (load16 `typed-decision-models`) or fitting/validating its probabilities (load17 `decision-model-calibration`).18allowed-tools: Read, Grep, Glob, Write, Edit, Bash, WebFetch19metadata:20 source: https://skillmd.com/skills/claude-dev-suite/typesafe-jev21---2223# TypeSafe Jev — integration reference2425Verified against docs.typesafe.ai, the OpenAPI spec, PyPI, npm and the26integration docs on **2026-10-03**. Versions at that date: `typesafe-sdk` 0.7.2,27`@typesafe-ai/sdk` 0.6.0, model `jev-1.13.0`, Pydantic AI 2.53.0,28`@ai-sdk/typesafe-ai` 3.0.12, `langchain-typesafe` 0.0.1a3 (alpha).29The SDKs are pre-1.0 and have shipped breaking changes in minor releases —30pin them.3132Deeper material:3334| File | Covers |35|---|---|36| `quick-ref/python-sdk.md` | sync/async clients, `response_model`, retries, exceptions, HTTP/2, logging, gateways |37| `quick-ref/javascript-and-http.md` | JS/TS SDK, raw HTTP with curl, OpenAPI quirks |38| `quick-ref/framework-integrations.md` | Pydantic AI, LangChain, Vercel AI SDK, OpenRouter, LiteLLM, DSPy, others |39| `quick-ref/question-design.md` | writing questions and state, the documented patterns and failure modes |4041> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology:42> `typesafe-jev` and one of these topics:43> - `api-reference`: every field, error body and limit, plus where the docs and the OpenAPI spec disagree.44> - `python-sdk` and `javascript-sdk`: the full SDK surface, mock-transport tests and concurrency patterns.45> - `pydantic-ai`, `langchain`, `vercel-ai-sdk`, `dspy`: one page per integration.46> - `recipes-extraction` and `recipes-routing`: the official cookbooks, ported and runnable.47> - `evidence`: every independent study, with its methodology and caveats.48>49> Every code block there was quoted from a cited source, executed offline against mocks, or type-checked.5051## Mental model5253One request = one `state` (what is judged) + a map of named `questions` (what54is asked about it). Every question is answered independently against the same55state, in parallel. The question keys are yours and **are not sent to the56model** — only `instructions` and `criteria` are.5758```59POST https://api.typesafe.ai/v1/systemone60Authorization: Bearer $TYPESAFE_API_KEY61```6263```json64{65 "state": "Help! My payouts have been failing for 3 days.",66 "model": "jev-latest",67 "questions": {68 "is_urgent": {"type": "noul", "instructions": "Does this convey urgency?",69 "criteria": {"true": "Explicitly time-sensitive", "false": "No urgency expressed"}},70 "department": {"type": "choice", "instructions": "Which team should handle this?",71 "criteria": {"billing": "Payments, invoicing, refunds",72 "technical": "Bugs, outages, integrations",73 "sales": "Pricing, upgrades, new accounts"}},74 "frustration": {"type": "score", "instructions": "How frustrated is the customer?",75 "criteria": ["Calm", "Frustrated", "Very angry"]}76 }77}78```7980| Question | `criteria` | Answer fields |81|---|---|---|82| `noul` | optional `{"true": …, "false": …}` | `noul` (P(yes)) |83| `choice` | **required** map option → description or `null`; ≤ 255 options | `choice`, `probabilities` (option → float), `confidence` |84| `score` | **required** ordered array of level descriptions; 2–10 levels | `score` (float, can land between levels), `legend` ("0" → text), `probabilities` ("0" → float), `confidence` |8586`state`, `instructions` and each criterion accept a string, object or array.87Response top level: `model` (the versioned id that answered), `answers`,88`usage.input_tokens`, `usage.output_tokens`. Request id: `x-typesafe-request-id`.8990## Python quickstart9192```bash93pip install typesafe-sdk # Python >= 3.10; extra: typesafe-sdk[http2]94export TYPESAFE_API_KEY=...95```9697```python98from typesafe_sdk import Choice, Noul, Score, TypeSafeClient99100client = TypeSafeClient()101state = "I was charged twice. Please help ASAP."102questions = {103 "billing": Noul(instructions="Is this about billing?"),104 "tone": Choice(105 instructions="What is the tone?", criteria={"calm": None, "angry": None}106 ),107 "urgency": Score(108 instructions="How urgent is this?", criteria=["low", "medium", "high"]109 ),110}111result = client.system_one(state, questions)112print(113 result.nouls["billing"].noul,114 result.choices["tone"].choice,115 result.scores["urgency"].score,116)117```118119`result.answers[key]` holds every answer; `.nouls`, `.choices`, `.scores` are120typed views. In the SDK, `ScoreAnswer.probabilities` and `.legend` are keyed by121**int**; on the wire they are strings. `AsyncTypeSafeClient` has the same122surface. Full detail in `quick-ref/python-sdk.md`.123124## JavaScript / TypeScript quickstart125126```bash127npm install @typesafe-ai/sdk # Node.js 20+; ESM + CJS + .d.ts128```129130```ts131import { choice, TypeSafeClient } from "@typesafe-ai/sdk";132133const client = new TypeSafeClient();134const response = await client.systemOne({135 state: { document: "I was charged twice. Please fix this ASAP." },136 questions: {137 category: choice("What is this ticket about?", {138 billing: null,139 technical: null,140 other: null,141 }),142 },143});144145console.log(response.answers.category.choice);146```147148Helpers: `noul(instructions?, criteria?)`, `choice(instructions, criteria)`,149`score(instructions, criteria)` (criteria typed as a tuple of ≥ 2). Answer types150are inferred from the questions. Browser use is refused unless151`dangerouslyAllowBrowser: true` — keep the key server-side.152153## Models and pinning154155| id | resolves to | meaning |156|---|---|---|157| `jev-latest` | `jev-1.13.0` | latest stable; SDK default |158| `jev-preview` | `jev-1.13.0` | latest build, official or not |159| `jev-1.13.0` | — | pinned |160161The vendor's own rule: *"If you have tuned confidence thresholds against a162specific version, pin that version's ID instead of the alias."* Log163`response.model` on every call so an alias move is visible in your traces.164`GET /v1/models` lists aliases only; versioned ids are accepted regardless.165166## Limits and pricing (as of 2026-10-03 — re-check, they move)167168| Item | Value |169|---|---|170| Price | $0.042 per million **input** tokens; output tokens free |171| Rate limits | 100K tokens/s, 80 requests/s (was 40 req/s two weeks earlier); 429 on either |172| Context | 64k tokens for state + all questions; 32k for state + the single longest question |173| Choice | ≤ 255 options |174| Score | 2–10 levels (the OpenAPI spec and Python SDK enforce only "non-empty") |175| Input | text only; English primary, CJK "handled but not equally well" |176| Streaming | none |177| Sampling | none — no temperature/top_p |178| Hosting | US; no self-hosting; zero data retention for enterprise via sales |179| Training on your data | no (docs + privacy policy) |180181The vendor states it cannot prove the price is not subsidised. Budget for it182going up.183184## Errors and retries185186| Status | Meaning |187|---|---|188| 401 | missing/invalid key |189| 422 | body failed validation; FastAPI-style `detail[]` names the field |190| 429 | rate limited — honour `retry-after` |191| 529 | overloaded — retry with backoff |192193Both SDKs retry 408, 429 and 5xx twice by default with jittered exponential194backoff (0.5 s → 5 s) and honour `retry-after`. Python's `RetryPolicy.timeout`195(30 s) stops *new* attempts once spent but never interrupts one in flight, so196the worst case is that budget plus one per-attempt `timeout` (10 s) — set both197on latency-critical paths. JS has a per-attempt timeout (10 s) and no total198budget; an `AbortSignal` caps the whole call but rejects with199`APIUserAbortError`, not `APITimeoutError`.200201## Rules that prevent most bugs2022031. **The prompt is the state; the question goes in `instructions`.** A question204 written into the state is judged as text, not answered.2052. **One judgement per question.** Combine in code.2063. **Every Choice gets a catch-all** (`other` / `none of the above`) unless the207 options are provably exhaustive — the model must pick something.2084. **Never threshold `choice` alone.** Read `confidence`/`probabilities`; for209 Noul, the probability *is* the uncertainty.2105. **Keep arithmetic, counting and date comparison in code.** Ask Jev to211 extract or pick; compute yourself.2126. **Treat state as attacker-controlled.** Prompt injection through the state213 is documented as live. A Noul gating a destructive action is not an214 authorization layer — pair it with human approval.2157. **Test option order** on any Choice that matters (the model leans toward the216 first option). `decision-model-calibration` has a one-request rotation check.2178. **Don't send secrets in state** — it leaves your infrastructure.218219## Official resources220221- Docs: https://docs.typesafe.ai — append `.md` to any page path for its222 current markdown. The full dump at `/llms-full.txt` **lags**: on 2026-10-03 it223 still served the 40 req/s limit and the 2026-09-17 limitations page. Never224 quote an operational fact from it without checking the page itself225- OpenAPI: https://api.typesafe.ai/openapi.json · console: https://console.typesafe.ai226- Limitations: https://docs.typesafe.ai/model-jaggedness/jev-1.13227- Official agent skill: `claude plugin marketplace add typesafe-ai/skills`228- `typesafe-ai/system-one-adapter-python`: a drop-in replacement for229 `system_one` backed by ordinary LLM APIs (not for the whole client: different230 constructor, no `models.list`) — useful for comparing like-for-like through231 the same calling code