Integrations / OpenRouter

Using Jev via OpenRouter.

OpenRouter provides managed access to TypeSafe Jev under model identifier typesafe/jev-1.13 and alias ~typesafe/jev-latest.

Developers can access Jev using OpenRouter's stable System One endpoint (supporting full multi-question batches with native TypeSafe schemas) or explore experimental single-decision workflows in OpenRouter's live Jev Lab.

Model Identifiers & Version Pinning

OpenRouter exposes two distinct slugs for routing requests to Jev:

Pinned Version (typesafe/jev-1.13): Locks inference execution to Jev version 1.13.0. Recommended for production systems requiring reproducible decision distributions and stable scoring rubrics.
Dynamic Alias (~typesafe/jev-latest): Resolves to the most recent stable release published by TypeSafe AI. Automatically adopts new minor and patch releases without client configuration changes.

Stable vs. Alpha Endpoints

Endpoint RoutePayload FormatStatusMulti-Question Batching?
POST /api/v1/systemoneNative TypeSafe schema (state + keyed questions)Production StableYes (Choice, Score, Noul in one call)
Jev Lab (Decisions Surface)Interactive single-decision interface (see OpenRouter Jev Lab ↗)Experimental Lab (No stable public REST spec)Single decision per interaction

Recommendation: Use POST /api/v1/systemone or the TypeSafe SDK with baseURL: "https://openrouter.ai/api" for all production architectures. It provides complete parity with TypeSafe System One schemas, accepts keyed question objects with explicit criteria rubrics, and returns structured answers.

Context Window Discrepancy

Important platform discrepancy: OpenRouter lists Jev with a flat 32,000-token context window in its model directory. In contrast, TypeSafe's direct API specifies a two-part budget:
01OpenRouter catalog limit: 32,000 tokens per request across your input payload.
02Direct TypeSafe budget: A total combined request limit of 64,000 tokens (shared state + all questions), with a strict cap of 32,000 tokens for the shared state plus the single longest question.

If your application relies on large multi-question payloads that exceed 32,000 total tokens while keeping state under 32,000 tokens, use direct TypeSafe endpoints or verify that your OpenRouter requests remain within OpenRouter's 32,000-token envelope.

Authentication & Headers

OpenRouter requests require an API key passed in the standard authorization header:

Authorization: Bearer $OPENROUTER_API_KEY (Required)
HTTP-Referer (Optional): Used by OpenRouter for ranking and leaderboard attribution.
X-Title (Optional): Sets the human-readable display name of your application on OpenRouter analytics.

Implementation Examples

cURL (Stable Route)

POST /api/v1/systemone
cURL (OpenRouter System One Route)
curl -X POST "https://openrouter.ai/api/v1/systemone" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "HTTP-Referer: https://my-app.example.com" \
  -H "X-Title: My App" \
  -d '{
    "model": "typesafe/jev-1.13",
    "state": "Support ticket: User cannot reset 2FA because SMS is not arriving on phone +14155552671. Carrier: Verizon. Region: US.",
    "questions": {
      "urgency": {
        "type": "choice",
        "instructions": "Evaluate support issue severity tier",
        "criteria": {
          "low": "Inconvenient issue with viable workaround",
          "normal": "Standard account or configuration issue",
          "urgent": "Authentication or core workflow blocked",
          "critical": "Severe production outage affecting multiple users"
        }
      },
      "is_carrier_outage": {
        "type": "noul",
        "instructions": "The issue is primarily caused by external telephony carrier delivery failures."
      }
    }
  }'

TypeScript / Node.js

Standard native fetch request
TypeScript (OpenRouter System One)
// Native fetch (Node 18+, Next.js, and edge runtimes)
async function queryOpenRouterJev() {
  const response = await fetch("https://openrouter.ai/api/v1/systemone", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.OPENROUTER_API_KEY}`,
      "Content-Type": "application/json",
      "HTTP-Referer": "https://my-app.example.com", // Optional leaderboard attribution
      "X-Title": "Production Pipeline",            // Optional leaderboard title
    },
    body: JSON.stringify({
      model: "typesafe/jev-1.13", // Or alias "~typesafe/jev-latest"
      state: "Customer email: 'Please cancel my account and refund this month charge.' Tenure: 14 months. LTV: $2,400.",
      questions: {
        churn_risk: {
          type: "noul",
          instructions: "The customer is actively requesting immediate cancellation."
        },
        retention_offer: {
          type: "choice",
          instructions: "Select customer retention offer tier",
          criteria: {
            standard_cancellation: "Low tenure or explicit no-contact preference",
            discount_30_percent: "Standard churn risk with high product usage",
            executive_outreach: "High-value customer or enterprise contract account"
          }
        }
      }
    })
  });

  const data = await response.json();
  console.log("Model:", data.model);
  console.log("Answers:", data.answers);
  console.log("Usage:", data.usage);
}

queryOpenRouterJev();

TypeSafe SDK via OpenRouter

baseURL: https://openrouter.ai/api
TypeScript (@typesafe-ai/sdk with OpenRouter)
import { TypeSafeClient } from "@typesafe-ai/sdk";

// Direct TypeSafe SDK to OpenRouter API base URL
const client = new TypeSafeClient({
  apiKey: process.env.OPENROUTER_API_KEY!,
  baseURL: "https://openrouter.ai/api",
});

async function runOpenRouterEvaluation() {
  const result = await client.systemOne({
    model: "typesafe/jev-1.13", // Or alias "~typesafe/jev-latest"
    state: "Customer email: 'Please cancel my account and refund this month charge.' Tenure: 14 months. LTV: $2,400.",
    questions: {
      churn_risk: {
        type: "noul",
        instructions: "The customer is actively requesting immediate cancellation."
      },
      retention_offer: {
        type: "choice",
        instructions: "Select customer retention offer tier",
        criteria: {
          standard_cancellation: "Low tenure or explicit no-contact preference",
          discount_30_percent: "Standard churn risk with high product usage",
          executive_outreach: "High-value customer or enterprise contract account"
        }
      }
    }
  });

  console.log("Model:", result.model);
  console.log("Churn probability:", result.answers.churn_risk.noul);
  console.log("Retention offer:", result.answers.retention_offer.choice);
}

runOpenRouterEvaluation();

Pricing & Token Metering

OpenRouter matches TypeSafe's official token rates for Jev:

Input Tokens: $0.042 per 1,000,000 input tokens ($42 per billion tokens).
Output Tokens: $0.00 / Free. Jev returns non-generative structured evaluation schemas, so no output token charges apply.

Refer to our Jev Pricing Calculator to estimate costs across batch volumes.

Not affiliated with, endorsed by, or operated by TypeSafe AI. Vendor claims are cited and attributed.