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:
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.
https://api.typesafe.ai/v1/systemoneAuthorization: Bearer ts_live_***jev-latest (or jev-1)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.
https://ai-gateway.vercel.sh/v1/evaluateAuthorization: Bearer vck_***typesafe-ai/jevOpenRouter 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.
https://openrouter.ai/api/alpha/decisionsAuthorization: Bearer sk-or-v1-***typesafe/jev-1.13Endpoint Capabilities & Architecture Matrix
Compare authentication, model IDs, latency profiles, and operational advantages:
| Feature | TypeSafe AI (Direct) | Vercel AI Gateway | OpenRouter Gateway |
|---|---|---|---|
| Endpoint URL | https://api.typesafe.ai/v1/systemone | https://ai-gateway.vercel.sh/v1/evaluate | https://openrouter.ai/api/alpha/decisions |
| Authentication Header | Authorization: Bearer ts_live_*** | Authorization: Bearer vck_*** | Authorization: Bearer sk-or-v1-*** (with HTTP-Referer) |
| Production Model ID | jev-latest / jev-1 | typesafe-ai/jev | typesafe/jev-1.13 |
| Typical Latency | Fastest (~80-140ms), direct cluster connection | Very Fast (~100-160ms), edge proxy distribution | Good (~120-190ms), multi-provider router hop |
| Distinctive Feature | Outputs raw candidate log-probabilities, zero feature lag | Built-in edge caching, OTel spans, team seat billing | Unified billing pool, cross-vendor hot standby routing |
| Recommended For | Latency-critical synchronous automations, raw fine-tuning | Next.js full-stack sites, serverless edge workers | Multi-model stacks, active-standby disaster recovery |
4-Step Standard Integration Flow
A production pattern for embedding deterministic decisions into your application:
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.
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.
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.
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:
// 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
modelModel identifier. `jev-latest` for TypeSafe; `typesafe-ai/jev` for Vercel; `typesafe/jev-1.13` for OpenRouter.
stateContextual evidence (ticket text, transaction JSON, audit comment) evaluated by the model.
questionsNamed question map. Each question requires explicit `type` (choice / score / noul), `instructions`, and `criteria`.
questions[key].typeOutput schema type. Choice for named options; Score for ordered scale; Noul for bounded binary checks.
questions[key].criteriaSpecific 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
}HTTP Status Codes & Troubleshooting
Forward pass complete. Result strictly matches declared schema.
Missing state, empty criteria, or unsupported question type.
Check that Authorization header contains valid Bearer token.
Short-term concurrency or account quota exhausted; retry with backoff.
Exceeded server timeout threshold; triggers secondary failover.
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.
Continue Exploring Jev 101
Interactive Web Playground
Test all 3 endpoints in real-time with presets and inspect token probability distributions.
TypeScript Integration Guide
Build strictly-typed decision routes with Zod validation in Node.js and full-stack frameworks.
Python Automation Guide
Connect asynchronous worker queues and data pipelines with requests and pydantic.
Jev Pricing & Token Costing
Calculate token unit prices, retry overheads, and the true cost of automated decisions.