learn / api & protocol integration

Jev API Integration Guide: 3 Production Endpoints & Protocol

Jev (System One) is a typed AI model engineered for deterministic business decisions. Our platform actively supports three production endpoints (TypeSafe AI direct, Vercel AI Gateway, and OpenRouter), enabling teams to embed zero-syntax-error decisions into mission-critical systems.

Quick Guide: How to choose and integrate Jev API?

Choose your endpoint based on infrastructure needs: 1) TypeSafe AI direct (https://api.typesafe.ai/v1/systemone) for lowest latency (<120ms) and raw log-probabilities; 2) Vercel AI Gateway (https://ai-gateway.vercel.sh/v1/evaluate) for Next.js edge caching and unified OpenTelemetry telemetry; 3) OpenRouter gateway (https://openrouter.ai/api/alpha/decisions) for multi-model consolidated billing and hot-standby failover. Best practice: never call endpoints from client browsers; encapsulate them in a server route with 1500ms timeout and automatic failover.

Verified Endpoint Directory

3 Verified Production Endpoints for Jev

Select the optimal ingestion channel tailored to your deployment topology and billing model:

Official Primary / Ultra-Low Latencytypesafe

TypeSafe AI (Direct Inference)

The primary creator and inference host of Jev and System One architectures. Direct API requests bypass intermediate reverse-proxies, evaluating full candidate token log-probabilities directly during the forward pass. Ideal for latency-sensitive synchronous workflows.

Endpoint URL
https://api.typesafe.ai/v1/systemone
Auth Header
Authorization: Bearer ts_live_***
Model IDjev-latest (or jev-1)
80ms – 140ms (Direct cluster link, zero proxy hops)
~$0.042 / 1M input tokens
Serverless Edge & Cachingvercel

Vercel AI Gateway Endpoint

Engineered for Next.js App Router and Edge Functions. Natively provides global edge caching, automated burst rate-limiting, OpenTelemetry trace spans, and centralized team billing.

Endpoint URL
https://ai-gateway.vercel.sh/v1/evaluate
Auth Header
Authorization: Bearer vck_***
Model IDtypesafe-ai/jev
100ms – 160ms (Distributed edge routing)
~$0.040 / 1M input tokens (Billed on Vercel invoice)
Multi-Model / Cross-Vendor Failoveropenrouter

OpenRouter Unified Gateway

The leading multi-model API aggregator. Consolidate model keys and credit pools with transparent cost logs. Naturally suited as an active secondary disaster recovery channel behind TypeSafe AI.

Endpoint URL
https://openrouter.ai/api/alpha/decisions
Auth Header
Authorization: Bearer sk-or-v1-***
Model IDtypesafe/jev-1.13
120ms – 190ms (Includes ~20-40ms proxy routing)
~$0.042 / 1M input tokens (Consolidated balance)

Endpoint Capabilities & Architecture Matrix

Compare authentication, model IDs, latency profiles, and operational advantages:

FeatureTypeSafe AI (Direct)Vercel AI GatewayOpenRouter Gateway
Endpoint URLhttps://api.typesafe.ai/v1/systemonehttps://ai-gateway.vercel.sh/v1/evaluatehttps://openrouter.ai/api/alpha/decisions
Authentication HeaderAuthorization: Bearer ts_live_***Authorization: Bearer vck_***Authorization: Bearer sk-or-v1-*** (with HTTP-Referer)
Production Model IDjev-latest / jev-1typesafe-ai/jevtypesafe/jev-1.13
Typical LatencyFastest (~80-140ms), direct cluster connectionVery Fast (~100-160ms), edge proxy distributionGood (~120-190ms), multi-provider router hop
Distinctive FeatureOutputs raw candidate log-probabilities, zero feature lagBuilt-in edge caching, OTel spans, team seat billingUnified billing pool, cross-vendor hot standby routing
Recommended ForLatency-critical synchronous automations, raw fine-tuningNext.js full-stack sites, serverless edge workersMulti-model stacks, active-standby disaster recovery

4-Step Standard Integration Flow

A production pattern for embedding deterministic decisions into your application:

01
STEP 01

Configure Server Environment Secrets

Generate an API key in your provider dashboard and inject it into server environment variables (.env.local or secret managers). Never leak keys to client bundles.

02
STEP 02

Define State & Typed Questions Contract

Format operational facts into a compact state string and declare typed questions (Choice, Score, or Noul) with mutually exclusive criteria.

03
STEP 03

Execute HTTP Request via Server Boundary

Dispatch an HTTP POST payload from your backend service or route handler, managing timeouts and request serializations in one place.

04
STEP 04

Validate Confidence & Trigger Fallbacks

Inspect the returned confidence metric. If confidence satisfies your business threshold (e.g. >= 0.85), proceed with automation; otherwise, route to graceful human review.

Interactive Integration Code (3 Endpoints + Failover Adapter)

Production-ready code snippets across TypeScript, Python, and multi-provider failover:

TypeSafe AI Native Endpointtypescript
Call the official TypeSafe inference cluster directly via Node.js / TypeScript fetch for lowest latency.
// server/jev-typesafe.ts
// Native Endpoint: https://api.typesafe.ai/v1/systemone
export async function evaluateWithTypesafe(ticketText: string) {
  const apiKey = process.env.TYPESAFE_API_KEY;
  if (!apiKey) throw new Error('Missing TYPESAFE_API_KEY');

  const response = await fetch('https://api.typesafe.ai/v1/systemone', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${apiKey}`,
    },
    body: JSON.stringify({
      model: 'jev-latest',
      state: `Customer Ticket: "${ticketText}"`,
      questions: {
        intent: {
          type: 'choice',
          instructions: 'Classify incoming customer support intent',
          criteria: {
            billing: 'Subscription, invoice, or refund inquiries',
            technical: 'System bug, error code, or API issue',
            general: 'General inquiry or feature request',
          },
        },
      },
    }),
  });

  if (!response.ok) {
    const errorText = await response.text();
    throw new Error(`TypeSafe API failed [${response.status}]: ${errorText}`);
  }

  const result = await response.json();
  const decision = result.answers?.intent;

  return {
    selected: decision?.selected as 'billing' | 'technical' | 'general',
    confidence: decision?.confidence as number, // 0.0 ~ 1.0
    probabilities: decision?.probabilities as Record<string, number>,
    usage: result.usage,
  };
}

HTTP Protocol Contract: Requests & Responses

Deterministic JSON payload structure, eliminating prompt drift and syntax parse errors:

HTTP POST Request Body Fields

model
stringYes

Model identifier. `jev-latest` for TypeSafe; `typesafe-ai/jev` for Vercel; `typesafe/jev-1.13` for OpenRouter.

state
stringYes

Contextual evidence (ticket text, transaction JSON, audit comment) evaluated by the model.

questions
Record<string, QuestionSchema>Yes

Named question map. Each question requires explicit `type` (choice / score / noul), `instructions`, and `criteria`.

questions[key].type
"choice" | "score" | "noul"Yes

Output schema type. Choice for named options; Score for ordered scale; Noul for bounded binary checks.

questions[key].criteria
Record<string, string>Yes

Specific definitions for each candidate answer. Mutually exclusive criteria explain why an option won.

HTTP Response Payload Structure

{
  "model": "jev-latest",
  "answers": {
    "intent": {
      "type": "choice",
      "selected": "billing",
      "confidence": 0.942,
      "probabilities": {
        "billing": 0.942,
        "technical": 0.041,
        "general": 0.017
      }
    }
  },
  "usage": {
    "input_tokens": 128,
    "output_tokens": 1
  },
  "latency_ms": 112
}
Note: Whether Choice, Score, or Noul, the answers object directly returns typed values and normalized confidence without JSON regex parsing.

HTTP Status Codes & Troubleshooting

200 OKSuccessful Evaluation

Forward pass complete. Result strictly matches declared schema.

400 Bad RequestSchema Validation Error

Missing state, empty criteria, or unsupported question type.

401 UnauthorizedMissing or Invalid Key

Check that Authorization header contains valid Bearer token.

429 Too Many RequestsRate or Credit Limit

Short-term concurrency or account quota exhausted; retry with backoff.

502 / 504 Gateway ErrorUpstream Timeout

Exceeded server timeout threshold; triggers secondary failover.

Hitting 429 / 401 / 529? Read the full Jev API troubleshooting guideCare about data privacy and residency? Read the Jev data privacy guide

Production Reliability & Architecture Rules

Keep Provider Keys on Server Edge

Never expose API keys in client bundles. Keep credentials in server routes or edge workers, returning only normalized domain decisions.

Implement Active-Standby Failover

Pair primary inference (TypeSafe) with gateway redundancy (OpenRouter). Set a 1500ms timeout circuit breaker to prevent cascade failures.

Separate Network Errors from Low Confidence

Connection failures trigger provider failover; low confidence (<0.85) triggers application review routing. Keep their alerts distinct.

Persist Decisions as Gold Fixtures

Store state, selected choice, latency, and confidence to version control. They become the regression test suite for model upgrades.

Frequently Asked Questions (FAQ)

How do I choose between TypeSafe AI, Vercel AI Gateway, and OpenRouter?

Use TypeSafe AI direct for maximum speed (<140ms) and access to full candidate log-probabilities. Use Vercel AI Gateway for Next.js App Router edge caching and unified team billing. Use OpenRouter when you want a consolidated multi-model billing pool or require a disaster-recovery fallback provider.

Do all three endpoints return identical choices and confidence values?

Yes. All three channels execute against the exact same underlying Jev model weights (such as Jev 1.13 / System One). Given the same state and criteria, the forward pass computes deterministic log-probabilities and identical confidence scores. Differences are strictly limited to network hops, headers, and usage payload formatting.

Why does Jev guarantee 0% syntax parse errors?

Traditional generative chat models generate unbounded text tokens character-by-character, which frequently break JSON parser rules. Jev’s System One architecture evaluates softmax probability distributions directly over the user-declared candidate options during the forward pass. It physically cannot emit undeclared strings or broken syntax.

Does this site offer an internal relay API endpoint?

Yes. This project ships with `/api/jev/evaluate`, which internally coordinates TypeSafe, Vercel, and OpenRouter providers while enforcing Cloudflare Turnstile bot verification, 5 req/10s burst rate-limiting, and 32KB payload limits.

What should my application do when Jev returns low confidence (<0.85)?

Confidence is a numeric control signal. We recommend a three-tier policy: high confidence (>=0.90) executes automatically; medium confidence (0.75-0.90) suggests an answer to a human operator for 1-click confirmation; low confidence (<0.75) routes directly to manual queue or conservative fallback.