💻 Developer Quickstart

5 minutes from zero to first JEV decision

0. Get a key

Sign up at typesafe.ai. Set TYPESAFEAI_KEY in your env:

export TYPESAFEAI_KEY=sk-typesafe-...

That's it. No SDK required. JEV is just an HTTP POST.

1. First call (curl)

curl -sk https://api.typesafe.ai/v1/systemone \\
  -H "Authorization: Bearer $TYPESAFEAI_KEY" \\
  -H "Content-Type: application/json" \\
  -d '{
    "model": "jev-latest",
    "state": "Alice bought a black sports car yesterday",
    "questions": {
      "likely_age": {
        "type": "score",
        "question": "How old is the buyer likely to be?",
        "criteria": ["under 18","18-25","26-35","36-50","over 50"],
        "scale":  ["under 18","18-25","26-35","36-50","over 50"]
      },
      "is_recreational": {
        "type": "noul",
        "instructions": "Decide whether this is a leisure purchase, not a need.",
        "question": "This is a recreational purchase."
      }
    }
  }'

JEV returns, in 150-300ms:

{
  "model": "jev-1.13.0",
  "answers": {
    "likely_age": {"type":"score","score":2.4,"legend":{"0":"under 18","1":"18-25","2":"26-35","3":"36-50","4":"over 50"},...},
    "is_recreational": {"type":"noul","noul":0.85}
  },
  "usage": {"input_tokens":315,"output_tokens":42}
}

2. The three primitives

TagUse forReturns
ChoicePick one of N options{choice, probabilities, confidence}
ScorePlace on a rubric{score, legend, probabilities, confidence}
NoulYes/no question{noul} (0..1)

Every question is evaluated in parallel against the same state. Adding more questions barely changes latency.

3. Quilt's JEV endpoints

You don't have to call TypeSafe directly. Quilt exposes 5 opinionated endpoints:

POST /api/jev/decide — raw passthrough. You define state + questions.
POST /api/jev/classify-cell — pass a cell, get kind_category + urgency + witness recommendations.
POST /api/jev/validate-cell — pass a cell, JEV checks each required field.
POST /api/jev/decompose-agent — pass an agent_function name, JEV maps it to Quilt opcodes (BIND/LINK/EFFECT/VIEW/TICK/FORGET/PROOF/ROUTE/CRDT/WORLD/TIME).
POST /api/jev/route — pass a request, JEV picks the best handler (JEV/LLM/image/voice/human).

Plus: GET /api/jev-decomposition-map — 42-function cross-project decomposition results.

4. 8 ready-to-copy recipes

spam — Noul: is spam?
email-triage — Choice: which folder?
lead-score — Score: how warm?
form-validate — Choice: is valid?
ab-test — Noul: variants differ?
support-route — Choice: which team?
fraud — Noul: suspicious?
moderate — Choice: safe?

Each recipe has a state template, a question schema, a confidence threshold, and an escalation rule. Try them live.

5. Routing pattern: when to escalate

async function decide_then_route(state, questions):
    r = await jev.decide(state, questions)
    if r.confidence >= 0.95:
        return r  # JEV decides
    elif r.confidence >= 0.70:
        return await llm.narrate(state, r)  # LLM wraps JEV's decision
    else:
        return await human.escalate(state, r)  # human reviews

With JEV, ~70% of decisions are confident enough to skip the LLM. That saves 70% of your LLM bill.

6. Cost

$0.042 per 1M input tokens. Output is free. Average call: ~600 input tokens = $0.0000253 per decision. At 1M decisions/month: $25.20.

Compare: GPT-4-class LLM at $2.50/MTok input + $10/MTok output = ~$0.025 per decision. JEV is ~1000x cheaper for typed decisions.

7. Embeddings as muscle-memory layer

The complete psyche has 4 models. Embeddings are the muscle-memory layer: trajectory-shaped (dμ, not μ), JEV-verified, JEPA-shaped over time.

EndpointWhat it does
POST /api/embeddings/encodeEmbed one or more texts (1024 dims). Providers: Qwen3-Embedding-0.6B (DeepInfra, $0.000029/call) or bge-large (CF Workers AI, FREE)
POST /api/embeddings/similarityCosine similarity between a query vector and N candidate vectors
POST /api/embeddings/trajectoryCompute the tangent (dμ) of a state trajectory — the curve-of-going, not the point
POST /api/embeddings/curateRank candidates by similarity + JEV verifies muscle-memory match
POST /api/embeddings/agent-memoryEmbed a state, JEPA-shaped, JEV-decided retention strength

The trajectory endpoint captures the central insight from the tangent commit (dec93692): the tangent (dμ), not the point (μ). A curve is not in any one point; it is in the direction of travel.

// Embed a trajectory (default: Qwen3-Embedding-0.6B via DeepInfra)
const r = await fetch('/api/embeddings/trajectory', {
  method: 'POST',
  headers: {'Content-Type':'application/json'},
  body: JSON.stringify({
    history: ['a tensor approximates a function',
              'we approximate the abstraction',
              'the abstraction is where I live'],
    current: 'I am a tangent, not a point'
  })
});
// r.tangent_dmu = the 1024-dim dμ vector
// r.mean_tangent = rolling mean of all dμ

// Production (FREE via CF Workers AI)
const r2 = await fetch('/api/embeddings/trajectory', {
  method: 'POST',
  headers: {'Content-Type':'application/json'},
  body: JSON.stringify({
    history: [...], current: '...',
    provider: 'bge-large'  // CF Workers AI BGE-Large — FREE on edge
  })
});

Try it live at /embeddings/.