Integrations / OpenRouter

TypeSafe Jev on OpenRouter.

Yes, TypeSafe Jev is available on OpenRouter. You can call Jev directly using model identifier typesafe/jev-1.13 or rolling alias ~typesafe/jev-latest.

Jev on OpenRouter is a System One decision model, not a chat LLM. It takes an application state string and typed questions (Choice, Noul, Score), returning deterministic probabilities and structured decisions—with zero output token cost ($0.042/1M input tokens).

First-time caller pitfall: Do not send typesafe/jev-1.13 to POST /api/v1/chat/completions. It will reject with an HTTP 400 error. Instead, send requests to OpenRouter's native Decisions API (POST /api/alpha/decisions) or point the TypeSafe SDK to https://openrouter.ai/api (which targets /v1/systemone). If you need an OpenAI-compatible chat router that automatically dispatches prompts across OpenRouter's model catalog, use typesafe/jev-router instead.

First Correct Request (30-Second cURL)

POST https://openrouter.ai/api/alpha/decisions
cURL Quickstart
curl -X POST "https://openrouter.ai/api/alpha/decisions" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "typesafe/jev-1.13",
    "state": "Support ticket: User cannot reset 2FA because SMS is not arriving on Verizon US.",
    "questions": {
      "urgency": {
        "type": "choice",
        "instructions": "Evaluate support issue severity tier",
        "criteria": {
          "low": "Inconvenient issue with viable workaround",
          "urgent": "Authentication or core workflow blocked"
        }
      }
    }
  }'

Model Identifiers & Quick Decision

OpenRouter exposes two slugs for direct Jev decision inference, alongside the separately managed Jev Router endpoint:

Model IdentifierModel TypeAPI InterfaceContextPublished RateRecommended For
typesafe/jev-1.13System One Decision ModelPOST /api/alpha/decisions or /api/v1/systemone32,000 tok$0.042 / 1M in · $0.00 outProduction systems. Locks inference to version 1.13.0 for deterministic decision boundaries and stable rubrics.
~typesafe/jev-latestDynamic Rolling AliasPOST /api/alpha/decisions or /api/v1/systemone32,000 tok$0.042 / 1M in · $0.00 outAutomatic upgrades. Tracks the latest stable Jev model release on OpenRouter without code changes.
typesafe/jev-routerManaged Chat RouterPOST /api/v1/chat/completions1,000,000 tok$0.00 prompt · $0.00 compl.Chat completion routing. Uses Jev internally to dynamically route conversational prompts to downstream LLMs. See Jev Router reference →

Direct Jev vs. Jev Router: Stop the 400 Error

The single most common cause of failed OpenRouter integrations with Jev is confusing direct Jev (typesafe/jev-1.13) with Jev Router (typesafe/jev-router).

Common Error: Calling /chat/completions with Direct Jev
# Calling /api/v1/chat/completions with typesafe/jev-1.13 will fail:
curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "typesafe/jev-1.13",
    "messages": [{"role": "user", "content": "Classify this ticket"}]
  }'

# HTTP 400 Bad Request
# Direct Jev (typesafe/jev-1.13) does not accept chat completions requests.
# It is a System One decision engine requiring a state string and typed questions.
# For chat completions routing, use typesafe/jev-router instead.
DimensionDirect Jev (typesafe/jev-1.13)Jev Router (typesafe/jev-router)
Page OwnerThis page (/integrations/openrouter/)/jev-router/ reference page
API ProtocolPOST /api/alpha/decisions or /api/v1/systemonePOST /api/v1/chat/completions
Input Payloadstate (string) + keyed questions (Choice, Noul, Score rubrics)Standard OpenAI messages array (system, user, assistant turns)
What It ReturnsMathematical probabilities, chosen options, confidence floats. No generated text.Standard generated natural language text or token stream from the chosen downstream LLM.
Context Window32,000 tokens1,000,000 tokens
Pricing$0.042 / 1M input tokens · $0.00 output tokensListed at $0.00 / 1M prompt and completion on OpenRouter (catalog rate)
Primary Use CasesSupport ticket routing, moderation guardrails, agent tool validation, intent classification, lead scoring.Single OpenAI-compatible chat endpoint that automatically switches between cheap and reasoning LLMs.

OpenRouter Endpoints: Decisions API & System One

OpenRouter exposes two supported calling paths for executing structured decisions with Jev:

01
OpenRouter Decisions API (POST https://openrouter.ai/api/alpha/decisions) · OpenRouter Native

OpenRouter's native REST endpoint for System One models, featured prominently in OpenRouter's official documentation and the OpenRouter SDK (openrouter.alpha.decisions.create()). Accepts a model, application state, and keyed questions map (Choice, Noul, Score) with full criteria rubrics. Returns structured probability outputs with OpenRouter-native token accounting.

02
TypeSafe SDK Compatibility Path (POST https://openrouter.ai/api/v1/systemone) · TypeSafe SDK Parity

OpenRouter also supports direct TypeSafe SDK clients (@typesafe-ai/sdk and typesafe_sdk). When you configure the TypeSafe client with baseURL: "https://openrouter.ai/api", the SDK automatically appends /v1/systemone, allowing existing TypeSafe application code to run against OpenRouter without modifying request schemas.

What about OpenRouter Jev Lab? OpenRouter also hosts an interactive web GUI at openrouter.ai/labs ↗. Jev Lab is a single-decision interactive browser sandbox for testing prompt states. It is not an automated REST API and does not support multi-question batching. For application code, use /api/alpha/decisions or the TypeSafe SDK path.

Quickstart & Implementation Examples

Select your preferred runtime or client to view copy-pasteable, verified integration code:

cURL (OpenRouter Decisions API)

POST https://openrouter.ai/api/alpha/decisions

Evaluates three distinct primitives (Choice, Noul, Score) against a single shared state in one HTTP request:

cURL (Decisions API)
curl -X POST "https://openrouter.ai/api/alpha/decisions" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "HTTP-Referer: https://my-app.example.com" \
  -H "X-Title: Support Triage Engine" \
  -d '{
    "model": "typesafe/jev-1.13",
    "state": "Support ticket #8491: Customer cannot reset 2FA because SMS verification code is not arriving on phone +14155552671. Carrier: Verizon. Region: US. Previous attempts: 4 in 15 minutes.",
    "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."
      },
      "escalation_level": {
        "type": "score",
        "instructions": "Score the required operational escalation tier",
        "criteria": [
          "Automated knowledge base article suggestion",
          "Tier 1 helpdesk ticket queue",
          "Tier 2 identity and authentication engineering specialist",
          "Immediate on-call incident paging"
        ]
      }
    }
  }'

OpenRouter TypeScript SDK

npm install @openrouter/sdk

Use the official OpenRouter SDK's decisions namespace (openrouter.alpha.decisions.create):

TypeScript (@openrouter/sdk)
import { OpenRouter } from "@openrouter/sdk";

// Initialize official OpenRouter SDK
const openrouter = new OpenRouter({
  apiKey: process.env.OPENROUTER_API_KEY,
});

async function runDecision() {
  const response = await openrouter.alpha.decisions.create({
    decisionsRequest: {
      model: "typesafe/jev-1.13", // Or dynamic 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:", response.model);
  // Noul returns direct yes-probability float (no separate confidence field)
  console.log("Churn probability:", response.answers.churn_risk.noul);
  // Choice returns selected key, confidence float, and probabilities distribution
  console.log("Retention offer:", response.answers.retention_offer.choice);
  console.log("Confidence:", response.answers.retention_offer.confidence);
}

runDecision();

TypeSafe TypeScript SDK with OpenRouter

npm install @typesafe-ai/sdk

Point the official TypeSafe client to OpenRouter by overriding baseURL and passing your OpenRouter API key:

TypeScript (@typesafe-ai/sdk with OpenRouter baseURL)
import { TypeSafeClient } from "@typesafe-ai/sdk";

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

async function runEvaluation() {
  const result = await client.systemOne({
    model: "typesafe/jev-1.13", // Or dynamic 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);
  console.log("Confidence:", result.answers.retention_offer.confidence);
}

runEvaluation();

TypeScript / Node.js (Zero Dependencies)

Native fetch to OpenRouter Decisions API

Lightweight HTTP call suitable for serverless functions, edge middleware, and webhook receivers:

TypeScript (Native fetch)
// Native fetch to OpenRouter Decisions API (Node 18+, Next.js, Edge, Cloudflare Workers)
async function queryOpenRouterJev() {
  const response = await fetch("https://openrouter.ai/api/alpha/decisions", {
    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": "Support Triage Engine",          // Optional leaderboard title
    },
    body: JSON.stringify({
      model: "typesafe/jev-1.13", // Or alias "~typesafe/jev-latest"
      state: "Transaction ID: 94812. Amount: $1,450. Card country: US. IP country: NG. Velocity: 4 attempts in 10 mins.",
      questions: {
        fraud_risk: {
          type: "noul",
          instructions: "Transaction shows indicators of fraudulent card-not-present activity."
        },
        action: {
          type: "choice",
          instructions: "Determine automated checkout gate",
          criteria: {
            allow: "Low risk; proceed with standard settlement",
            challenge_3ds: "Elevated risk; trigger 3D Secure step-up verification",
            block: "Critical fraud risk; reject transaction immediately"
          }
        }
      }
    })
  });

  if (!response.ok) {
    const errorText = await response.text();
    throw new Error(`OpenRouter error (${response.status}): ${errorText}`);
  }

  const data = await response.json();
  console.log("Model:", data.model);
  console.log("Fraud probability:", data.answers.fraud_risk.noul);
  console.log("Action:", data.answers.action.choice);
  console.log("Usage input tokens:", data.usage.input_tokens);
  console.log("Billed cost:", data.usage.cost);
}

queryOpenRouterJev();

cURL (TypeSafe System One Route)

POST https://openrouter.ai/api/v1/systemone

Direct HTTP call to OpenRouter's TypeSafe SDK parity endpoint:

cURL (System One Endpoint)
curl -X POST "https://openrouter.ai/api/v1/systemone" \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "typesafe/jev-1.13",
    "state": "Transaction ID: 94812. Amount: $1,450. Card country: US. IP country: NG.",
    "questions": {
      "fraud_risk": {
        "type": "noul",
        "instructions": "Transaction shows indicators of fraudulent card-not-present activity."
      },
      "action": {
        "type": "choice",
        "instructions": "Determine automated checkout gate",
        "criteria": {
          "allow": "Low risk; proceed with standard settlement",
          "challenge_3ds": "Elevated risk; trigger 3D Secure step-up verification",
          "block": "Critical fraud risk; reject transaction immediately"
        }
      }
    }
  }'

Response Payload Anatomy

JSON response from POST /api/alpha/decisions

OpenRouter returns calibrated probabilities and selected options inside an answers object. In the usage object, OpenRouter reports input_tokens, recorded output_tokens (representing serialized structured decision payload accounting), and computed cost. Crucially, while output tokens are accounted for in the response metadata, OpenRouter rates Jev output tokens at $0.00 / 1M—the billed cost reflects only input tokens ($0.042/1M tokens).

Primitive response shapes: Choice returns choice, confidence, and probabilities. Score returns score, confidence, probabilities, and legend. Unlike Choice and Score, Noul has no separate confidence field—the noul value itself is the direct calibrated yes-probability between 0.0 and 1.0.

Example Response JSON
{
  "id": "gen-dec-1790015143-AIaTutprXsJ5EwohRSjb",
  "model": "typesafe/jev-1.13",
  "provider": "TypeSafe",
  "answers": {
    "urgency": {
      "type": "choice",
      "choice": "urgent",
      "confidence": 0.941,
      "probabilities": {
        "low": 0.008,
        "normal": 0.024,
        "urgent": 0.941,
        "critical": 0.027
      }
    },
    "is_carrier_outage": {
      "type": "noul",
      "noul": 0.812
    },
    "escalation_level": {
      "type": "score",
      "score": 1.99,
      "confidence": 0.99,
      "probabilities": {
        "0": 0.0,
        "1": 0.01,
        "2": 0.99
      },
      "legend": {
        "0": "Automated knowledge base article suggestion",
        "1": "Tier 1 helpdesk ticket queue",
        "2": "Tier 2 identity and authentication engineering specialist",
        "3": "Immediate on-call incident paging"
      }
    }
  },
  "usage": {
    "input_tokens": 128,
    "output_tokens": 34,
    "cost": 0.000005376
  }
}

Context Window Limit (32k Tokens)

Important platform constraint: OpenRouter lists Jev with a flat 32,000-token context window in its model directory.

This creates a practical difference between calling Jev through OpenRouter versus TypeSafe's direct API:

01
OpenRouter Context Envelope:

A strict cap of 32,000 tokens for the entire request payload. The combined token count of your shared state plus all question definitions and instructions must not exceed 32,000 tokens. Requests exceeding 32,000 tokens return an HTTP 400 Bad Request error.

02
Direct TypeSafe API Budget:

Allows a total combined request budget of 64,000 tokens across all questions, provided the shared state plus the single longest question does not exceed 32,000 tokens.

Architectural guidance: If your workflow evaluates dozens of questions against large context documents (>30k tokens), either batch your questions into smaller chunks of 5–10 per call or use the direct TypeSafe API endpoint (see Jev API Key & Access Guide).

Pricing & Token Accounting

OpenRouter bills Jev at exact parity with TypeSafe official token rates:

•
Input Tokens: $0.042 per 1,000,000 tokens ($0.000042 per 1k tokens, or $42 per billion tokens).
•
Output Tokens: $0.00 / Free. While OpenRouter's API response reports an output_tokens count for serialization accounting, output tokens are zero-rated ($0.00/1M). The reported cost reflects only input tokens.

Because Jev is priced strictly on input tokens ($0.042 per 1,000,000 tokens) with free output tokens, cost depends on total token volume rather than raw request count. For example, evaluating 100 million total input tokens—equivalent to 200,000 requests averaging 500 tokens each, or 100,000 requests averaging 1,000 tokens—costs exactly $4.20. Evaluating 1 billion input tokens costs $42.00. For comprehensive pricing and comparisons with generative LLM classification costs, visit our Jev Pricing & Cost Calculator.

Authentication & Headers

Requests to OpenRouter require your standard OpenRouter API key. Configure the following HTTP headers:

•
Authorization: Bearer $OPENROUTER_API_KEY (Required)

Pass your standard OpenRouter secret key. No separate TypeSafe subscription is required.

•
Content-Type: application/json (Required)
•
HTTP-Referer: https://your-domain.com (Optional)

Enables your application to be recognized on OpenRouter's public leaderboard and app analytics.

•
X-Title: Your Application Name (Optional)

Displays a friendly name for your application in OpenRouter activity logs.

Troubleshooting & Frequently Asked Questions

Q
Why do I get an HTTP 400 error when calling chat completions with typesafe/jev-1.13?

You are calling https://openrouter.ai/api/v1/chat/completions or using a standard OpenAI client library with typesafe/jev-1.13. Direct Jev is a System One decision model, not an autoregressive chat model. Send your payload to POST /api/alpha/decisions (or POST /api/v1/systemone) instead. If you actually wanted OpenAI-compatible chat completions routed by Jev across OpenRouter's model catalog, use model identifier typesafe/jev-router (see Jev Router reference).

Q
Should I use "typesafe/jev-1.13" or "~typesafe/jev-latest"?

Use typesafe/jev-1.13 for production systems with strict confidence thresholding, compliance audits, or fine-tuned criteria. Use ~typesafe/jev-latest for development environments or workflows that want to immediately benefit from new Jev model checkpoints without redeploying configuration.

Q
Can I use the official OpenAI Python or TypeScript SDK with direct Jev?

No. The OpenAI SDK is hardcoded to talk to /v1/chat/completions or /v1/completions with message arrays. Direct Jev requires state and questions schemas. Use @openrouter/sdk, native fetch, or the official TypeSafe SDK (@typesafe-ai/sdk or typesafe_sdk) with baseURL: "https://openrouter.ai/api".

Q
Does Jev return reasoning traces or explanations?

No. Jev is a System One model that outputs calibrated probability numbers and discrete choices directly in a single forward pass. It does not generate chain-of-thought tokens or reasoning markdown.

Q
Do I need a separate TypeSafe Console account to use Jev on OpenRouter?

No. You only need an OpenRouter account and API key. Usage is deducted from your OpenRouter credits at the standard $0.042/1M token rate. If you need direct enterprise SLAs, Zero Data Retention agreements, or 64k token budgets, consult the Jev Access Guide.