Try it
Copy the code ↓- Data source
- Decision schema
- Model inference
- Structured result
2 Decision schema 4 typed questions
crash_typechoicerear_endanglehead_onsideswipesingle_vehicleped_cyclistinjury_severityscoreno_injurypossibleminorseriousfatalprimary_factorchoicedistractionspeedimpairmentroad_weatherunknowncontradicts_codingnoulprobability 0–1
3 Model inference typesafe/jev-1.13
Waiting for a run.
4 Structured result
Raw JSON
Run the demo to see the JSON answers, the highlighted pick and the final action.
FLATKEY_API_KEY and run.curl -sS https://router.flatkey.ai/api/alpha/decisions \
-H "Authorization: Bearer $FLATKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "typesafe/jev-1.13",
"state": "Coded severity: property damage only. Narrative: V1 was northbound on SR-9 when the driver looked down at a phone and struck the rear of V2, which was stopped for a red light. The V2 driver complained of neck pain at the scene and was transported by EMS. Both vehicles were towed.",
"questions": {
"crash_type": {
"type": "choice",
"instructions": "What kind of collision does the narrative describe?",
"criteria": {
"rear_end": "One vehicle strikes the back of another travelling in the same direction",
"angle": "Vehicles collide at an angle, typically at an intersection or driveway",
"head_on": "Front-to-front collision between vehicles travelling in opposite directions",
"sideswipe": "Side-to-side contact between vehicles travelling in parallel",
"single_vehicle": "One vehicle leaves the road or hits a fixed object or animal",
"ped_cyclist": "A pedestrian or cyclist is struck"
}
},
"injury_severity": {
"type": "score",
"instructions": "Most severe injury the narrative describes (KABCO-style scale).",
"criteria": [
"no_injury",
"possible",
"minor",
"serious",
"fatal"
]
},
"primary_factor": {
"type": "choice",
"instructions": "Which contributing factor does the narrative point to most?",
"criteria": {
"distraction": "Phone use, looking away or other inattention",
"speed": "Speeding or driving too fast for conditions",
"impairment": "Alcohol, drugs or fatigue",
"road_weather": "Road surface, visibility or weather",
"unknown": "The narrative does not indicate a factor"
}
},
"contradicts_coding": {
"type": "noul",
"instructions": "The narrative describes an injury, fatality or factor that the coded fields in the state do not reflect."
}
}
}'// Node.js 18+ (built-in fetch). Run: FLATKEY_API_KEY=... node jev.mjs
const body = {
"model": "typesafe/jev-1.13",
"state": "Coded severity: property damage only. Narrative: V1 was northbound on SR-9 when the driver looked down at a phone and struck the rear of V2, which was stopped for a red light. The V2 driver complained of neck pain at the scene and was transported by EMS. Both vehicles were towed.",
"questions": {
"crash_type": {
"type": "choice",
"instructions": "What kind of collision does the narrative describe?",
"criteria": {
"rear_end": "One vehicle strikes the back of another travelling in the same direction",
"angle": "Vehicles collide at an angle, typically at an intersection or driveway",
"head_on": "Front-to-front collision between vehicles travelling in opposite directions",
"sideswipe": "Side-to-side contact between vehicles travelling in parallel",
"single_vehicle": "One vehicle leaves the road or hits a fixed object or animal",
"ped_cyclist": "A pedestrian or cyclist is struck"
}
},
"injury_severity": {
"type": "score",
"instructions": "Most severe injury the narrative describes (KABCO-style scale).",
"criteria": [
"no_injury",
"possible",
"minor",
"serious",
"fatal"
]
},
"primary_factor": {
"type": "choice",
"instructions": "Which contributing factor does the narrative point to most?",
"criteria": {
"distraction": "Phone use, looking away or other inattention",
"speed": "Speeding or driving too fast for conditions",
"impairment": "Alcohol, drugs or fatigue",
"road_weather": "Road surface, visibility or weather",
"unknown": "The narrative does not indicate a factor"
}
},
"contradicts_coding": {
"type": "noul",
"instructions": "The narrative describes an injury, fatality or factor that the coded fields in the state do not reflect."
}
}
};
const res = await fetch("https://router.flatkey.ai/api/alpha/decisions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.FLATKEY_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`Jev request failed: ${res.status} ${await res.text()}`);
const { answers, usage } = await res.json();
console.log(JSON.stringify(answers, null, 2), usage);# Python 3.8+ (pip install requests). Run: FLATKEY_API_KEY=... python jev.py
import json, os, requests
body = json.loads(r"""{
"model": "typesafe/jev-1.13",
"state": "Coded severity: property damage only. Narrative: V1 was northbound on SR-9 when the driver looked down at a phone and struck the rear of V2, which was stopped for a red light. The V2 driver complained of neck pain at the scene and was transported by EMS. Both vehicles were towed.",
"questions": {
"crash_type": {
"type": "choice",
"instructions": "What kind of collision does the narrative describe?",
"criteria": {
"rear_end": "One vehicle strikes the back of another travelling in the same direction",
"angle": "Vehicles collide at an angle, typically at an intersection or driveway",
"head_on": "Front-to-front collision between vehicles travelling in opposite directions",
"sideswipe": "Side-to-side contact between vehicles travelling in parallel",
"single_vehicle": "One vehicle leaves the road or hits a fixed object or animal",
"ped_cyclist": "A pedestrian or cyclist is struck"
}
},
"injury_severity": {
"type": "score",
"instructions": "Most severe injury the narrative describes (KABCO-style scale).",
"criteria": [
"no_injury",
"possible",
"minor",
"serious",
"fatal"
]
},
"primary_factor": {
"type": "choice",
"instructions": "Which contributing factor does the narrative point to most?",
"criteria": {
"distraction": "Phone use, looking away or other inattention",
"speed": "Speeding or driving too fast for conditions",
"impairment": "Alcohol, drugs or fatigue",
"road_weather": "Road surface, visibility or weather",
"unknown": "The narrative does not indicate a factor"
}
},
"contradicts_coding": {
"type": "noul",
"instructions": "The narrative describes an injury, fatality or factor that the coded fields in the state do not reflect."
}
}
}""")
res = requests.post(
"https://router.flatkey.ai/api/alpha/decisions",
headers={"Authorization": f"Bearer {os.environ['FLATKEY_API_KEY']}"},
json=body,
timeout=60,
)
res.raise_for_status()
data = res.json()
print(json.dumps(data["answers"], indent=2), data.get("usage"))
No Flatkey key yet? Get one for Jev 1.13 →
About this use case

Who / when
Audience
- traffic-safety analysts and researchers working with state crash databases
- insurance and fleet teams reviewing incident reports at volume
- data engineers turning report narratives into queryable columns
Triggers
- a backlog of report narratives has never been read, only the coded fields
- you suspect injury or distraction is under-coded compared with the narrative
- a research question needs a new variable that was never coded
- manual coding of every narrative is too slow or too expensive
The workflow
- 01Report stateCoded fields plus the narrativeInput
- 02ChoiceCrash type and primary factorJev
- 03Score + NoulInjury severity, contradicts-coding flagJev
- 04Code gateWrite columns or queue for a coderYour code
Question shape
{
"crash_type": {
"type": "choice",
"instructions": "What kind of collision does the narrative describe?",
"criteria": {
"rear_end": "One vehicle strikes the back of another travelling in the same direction",
"angle": "Vehicles collide at an angle, typically at an intersection or driveway",
"head_on": "Front-to-front collision between vehicles travelling in opposite directions",
"sideswipe": "Side-to-side contact between vehicles travelling in parallel",
"single_vehicle": "One vehicle leaves the road or hits a fixed object or animal",
"ped_cyclist": "A pedestrian or cyclist is struck"
}
},
"injury_severity": {
"type": "score",
"instructions": "Most severe injury the narrative describes (KABCO-style scale).",
"criteria": [
"no_injury",
"possible",
"minor",
"serious",
"fatal"
]
},
"primary_factor": {
"type": "choice",
"instructions": "Which contributing factor does the narrative point to most?",
"criteria": {
"distraction": "Phone use, looking away or other inattention",
"speed": "Speeding or driving too fast for conditions",
"impairment": "Alcohol, drugs or fatigue",
"road_weather": "Road surface, visibility or weather",
"unknown": "The narrative does not indicate a factor"
}
},
"contradicts_coding": {
"type": "noul",
"instructions": "The narrative describes an injury, fatality or factor that the coded fields in the state do not reflect."
}
}Gate policy
≥ 0.90
Write the answers straight to the analysis table; spot-check a random sample each week.
0.65–0.90
Queue for a human coder with Jev's answers prefilled.
< 0.65
Leave the row uncoded and route the narrative to full manual review.
Failure modes
Pre-launch checks before you trust auto-routing:
- Officer shorthand and abbreviations (V1, V2, PDO, EMS, NB/SB);
- Narratives that mention an injury only as a complaint or a refusal of transport;
- Multi-vehicle chains where the crash type depends on which impact you code;
- Stability when the schema grows and new questions are added;
- Drift between the question wording and the coding manual it is meant to mirror;
FAQ
Has this been done at scale?
Dark Factor's summary of four production papers (post below) reports 499,500 crash narratives screened against a 27-question schema, an F1 of 0.908 against blinded human judgments, and 10,747 additional injury and fatal crashes found. The demo here asks four of those kinds of questions; a real schema asks many more in the same call.
Why include the coded fields in the state?
So one Noul question can check the narrative against them. Rows where the narrative describes an injury the coded severity does not reflect are exactly the ones worth a coder's time.
Does asking 27 questions cost 27 times more?
No. All questions in one request share the same state, so the narrative is sent once and every question is answered in parallel. See Text into typed columns for the measured multi-question pattern.
Can I bring my own API key?
Yes. Try the free demo above without signing in. To run it live on your own text, sign in with Google and connect a Flatkey or OpenRouter key (a quick test call runs when you save it). Manage or delete it anytime under Dashboard → BYOK. Keys are stored encrypted on the server, used only for runs you trigger, and never sent back to the browser. Need a Flatkey key? Get one for Jev 1.13 on Flatkey.
Is this the official TypeSafe Jev product page?
No. jev-llm.com is an independent research and practice site. Verify pricing, models and terms at the original TypeSafe sources.
Sources
4 papers just showed how to use Jev in 4 completely different production systems … this is a 7-step blueprint on how to move judgment off the LLM and make any AI system faster, cheaper and easier to audit … step 4 → turn messy text into typed data: 499,500 crash narratives screened against a 27-question schema, F1 0.908 against blinded human judgments, and 10,747 additional injury and fatal crashes found
— @DarkFactorr View the post on X →
Wire this gate with your own key
Bring your own key through Flatkey / OpenRouter. Keep exact checks in code.