← Inicio

Cómo usar la API de Jev

Jev expone un único endpoint. Envías un estado y un conjunto de preguntas; devuelve respuestas tipadas con probabilidades. Aquí tienes todo lo que necesitas para hacer tu primera llamada.

1. El endpoint

Cada petición es un POST a https://api.typesafe.ai/v1/systemone, autenticado con un token Bearer. Los SDK oficiales leen tu clave de la variable de entorno TYPESAFE_API_KEY.

curl
curl -X POST https://api.typesafe.ai/v1/systemone \
  -H "Authorization: Bearer $TYPESAFE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jev-latest",
    "state": "Customer: I was charged twice and I am furious.",
    "questions": {
      "topic": {
        "type": "choice",
        "instructions": "What is the issue about?",
        "criteria": { "billing": "money problems", "bug": "broken product" }
      },
      "urgent": {
        "type": "noul",
        "instructions": "Escalate to a human now?"
      }
    }
  }'

Using a JevTypeSafeAI hosted key?

Skip the TypeSafe waitlist. The same choice / score / noul API through our hosted endpoint, billed per input token from a prepaid balance — one jv_live_ key, no setup. Paste your key below and run this exact request against the live endpoint to confirm it works.

curl https://jevtypesafeai.com/api/v1/decide \
  -H "Authorization: Bearer $JEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "Customer: I was charged twice and nobody has replied for 3 days.",
    "questions": {
      "route":    { "type": "choice", "instructions": "Where should this go?",
                    "criteria": { "billing": "money", "bug": "broken", "account": "login" } },
      "urgency":  { "type": "score",  "instructions": "How urgent is this?",
                    "criteria": ["routine", "today", "urgent", "critical"] },
      "escalate": { "type": "noul",   "instructions": "Escalate to a human now?" }
    }
  }'
Test your key — run this exact request against the live endpoint, once:
Sends the request above to https://jevtypesafeai.com/api/v1/decide with your key and bills one tiny decision (≈ $0.00003). Your key stays in your browser. In production, keep it server-side.

Full API reference & ready-made endpoints →

2. El cuerpo de la petición

Tres campos:

3. Los tres tipos de pregunta

choice — elige una opción

Da un mapa de criterios de hasta 255 opciones etiquetadas. Jev devuelve la clave ganadora, una probabilidad por opción y una confianza.

"topic": {
  "type": "choice",
  "instructions": "What is the primary issue?",
  "criteria": {
    "billing": "billing or payment problem",
    "bug": "the product is broken",
    "account": "login or access"
  }
}

score — posición en una escala

Da un array ordenado de criterios con 2–10 descripciones de nivel. Jev devuelve un score (posiblemente fraccionario) más la distribución completa.

"severity": {
  "type": "score",
  "instructions": "How urgent is this?",
  "criteria": [
    "routine",
    "handle today",
    "urgent",
    "critical, about to churn"
  ]
}

noul — sí/no calibrado

Sin criterios — solo instrucciones. Jev devuelve noul, una probabilidad de 0 a 1.

"escalate": {
  "type": "noul",
  "instructions": "Escalate to a human immediately?"
}

4. La respuesta

Recibes de vuelta el modelo resuelto, un mapa de answers y el uso de tokens:

{
  "model": "jev-1.13.0",
  "answers": {
    "topic":    { "type": "choice", "choice": "billing",
                  "confidence": 1.0,
                  "probabilities": { "billing": 1.0, "bug": 0.0, "account": 0.0 } },
    "severity": { "type": "score", "score": 3.0, "confidence": 1.0,
                  "legend": { "0": "routine", "3": "critical, about to churn" },
                  "probabilities": { "0": 0.0, "3": 1.0 } },
    "escalate": { "type": "noul", "noul": 0.8 }
  },
  "usage": { "input_tokens": 434, "output_tokens": 75 }
}

Como los tipos están fijos, puedes ramificar sobre los resultados con código plano — if (answers.escalate.noul > 0.7) — sin parseo, sin regex y sin riesgo de una respuesta malformada.

5. Límites y buenas prácticas

Acceso a la API al instante

Inicia sesión, prepaga un saldo pequeño y obtén una clave jv_live_ en minutos — una clave para la Core Decision API y cada endpoint de flujo listo. Instantáneo, self-service, sin configuración.

Obtener una clave de API →Ver precios

¿Quieres verlo antes de escribir código? Cada ejemplo de esta página se ejecuta en vivo en el playground. Para claves oficiales y documentación completa, consulta docs.typesafe.ai.

▶ Ejecútalo en el playgroundVer precios
Cómo usar la API de Jev — endpoint, formato de petición y ejemplos · Jev by TypeSafe AI