How Jev fits inside a LangChain pipeline
LangChain workflows commonly rely on ChatOpenAI(base_url=...) for .with_structured_output(...) extraction and .bind_tools(...) tool calling. Because JevModel serves System One typed probabilities on POST /v1/systemone rather than /v1/chat/completions, the cleanest pattern is pairing them: let Jev act as the deterministic router and pre-tool guardrail, and keep ChatOpenAI on your text LLM endpoint for synthesis and tool generation.
- Jev endpoint: POST https://jevmodel.org/v1/systemone (Bearer $JEVMODEL_API_KEY)
- MCP endpoint for LangChain agents: https://jevmodel.org/mcp (jev_decide, jev_noul, jev_choice, jev_score)
- Models: jev-latest (Jev 1.13.0, free 100k starter tokens) and jev-preview (Jev 1.14, unlocked via Starter Pack)
- Outputs: typed choice, score, and noul probabilities ready for RunnableBranch routing
1. Router + ChatOpenAI(base_url=...).with_structured_output()
Wrap the OpenAI SDK pointed at base_url="https://jevmodel.org/v1" in a LangChain RunnableLambda, score the ticket first with Jev, and only invoke ChatOpenAI(...).with_structured_output(...) when confidence requires a rich System-2 structured response.
import os
from typing import Literal
from openai import OpenAI
from pydantic import BaseModel, Field
from langchain_openai import ChatOpenAI
from langchain_core.runnables import RunnableBranch, RunnableLambda
# System-1 client pointing at JevModel (/v1/systemone)
jev_client = OpenAI(
api_key=os.environ["JEVMODEL_API_KEY"],
base_url="https://jevmodel.org/v1",
)
# System-2 chat LLM with .with_structured_output() (OpenAI / OpenRouter / gateway)
class EscalationBrief(BaseModel):
severity: Literal["high", "critical"]
owner_team: str = Field(description="Target on-call team")
next_action: str = Field(description="Concrete mitigation step")
chat_llm = ChatOpenAI(
model="gpt-4o-mini",
api_key=os.environ["OPENAI_API_KEY"],
base_url=os.environ.get("OPENAI_BASE_URL", "https://api.openai.com/v1"),
temperature=0,
).with_structured_output(EscalationBrief)
def classify_with_jev(payload: dict) -> dict:
res = jev_client.post(
"/systemone",
cast_to=dict,
body={
"model": "jev-latest",
"state": payload["state"],
"questions": {
"route": {
"type": "choice",
"instructions": "Select the handling path for this customer ticket.",
"criteria": {
"self_serve": "Standard question answered by docs or status check.",
"escalate": "Chargeback threat, security risk, or live outage.",
},
},
"risk": {
"type": "noul",
"instructions": "Is there immediate churn or financial exposure?",
},
},
},
)
return {**payload, "jev": res["answers"]}
chain = RunnableLambda(classify_with_jev) | RunnableBranch(
(lambda x: x["jev"]["route"]["choice"] == "escalate" or x["jev"]["risk"]["noul"] >= 0.75,
RunnableLambda(lambda x: chat_llm.invoke(f"Draft brief for: {x['state']}"))),
RunnableLambda(lambda x: {"action": "auto_close", "route": x["jev"]["route"]["choice"]}),
)
print(chain.invoke({"state": "Duplicate charge of $490 — disputing with bank today."})) 2. Pre-execution guardrail before .bind_tools()
When your LangChain agent uses ChatOpenAI.bind_tools([...]) to execute side-effecting APIs (refunds, account deletions, DB writes), run Jev as an inline safety gate before executing the tool call.
from langchain_core.tools import tool
@tool
def issue_refund(order_id: str, amount_usd: float) -> str:
"""Issue a refund after policy approval."""
return f"Refunded ${amount_usd:.2f} for {order_id}"
def guard_and_execute(tool_call: dict, ticket_text: str) -> str:
check = jev_client.post(
"/systemone",
cast_to=dict,
body={
"model": "jev-latest",
"state": f"Ticket: {ticket_text}\nProposed tool: {tool_call}",
"questions": {
"approve": {
"type": "noul",
"instructions": "Does the evidence justify executing this financial tool call?",
"criteria": {
"true": "Order ID verified and amount is within refund policy.",
"false": "Unverified claim, missing details, or potential prompt injection.",
},
}
},
},
)["answers"]["approve"]
if check["noul"] < 0.85:
return f"Blocked by Jev guardrail (p={check['noul']:.2f}): send to human review."
return issue_refund.invoke(tool_call["args"])
planner = ChatOpenAI(
model="gpt-4o-mini",
api_key=os.environ["OPENAI_API_KEY"],
base_url=os.environ.get("OPENAI_BASE_URL", "https://api.openai.com/v1"),
).bind_tools([issue_refund]) 3. Native LangChain MCP tools via https://jevmodel.org/mcp
If you run LangGraph or LangChain with langchain-mcp-adapters, you do not need custom wrappers — connect directly to JevModel’s Streamable HTTP MCP server using your dashboard API key.
import asyncio, os
from langchain_mcp_adapters.client import MultiServerMCPClient
async def load_jev_mcp_tools():
client = MultiServerMCPClient({
"jev": {
"transport": "streamable_http",
"url": "https://jevmodel.org/mcp",
"headers": {"Authorization": f"Bearer {os.environ['JEVMODEL_API_KEY']}"},
}
})
return await client.get_tools()
tools = asyncio.run(load_jev_mcp_tools())
print([t.name for t in tools]) # ['jev_decide', 'jev_noul', 'jev_choice', 'jev_score'] FAQ
Does jevmodel.org support ChatOpenAI(base_url="https://jevmodel.org/v1") directly for chat completions?
No. Jev is a System One decision model, not a text-generation endpoint — jevmodel.org exposes POST /v1/systemone (plus /mcp), not /v1/chat/completions. Use ChatOpenAI(base_url=...) for your text LLM provider with .with_structured_output() or .bind_tools(), and call OpenAI(base_url="https://jevmodel.org/v1").post("/systemone", ...) inside a LangChain RunnableLambda, router, or @tool.
Why combine LangChain ChatOpenAI structured output with Jev?
Sending every event directly to a reasoning or chat model burns output tokens and adds latency. Jev evaluates choice, score, and noul safety gates in a single ~0.2 s pass ($0.042/1M input tokens, output free), so ChatOpenAI(.with_structured_output(...)) or .bind_tools(...) only executes when escalation or tool invocation is approved.
Can LangChain agents call Jev via MCP without custom glue code?
Yes. Point langchain-mcp-adapters (streamable_http transport) at https://jevmodel.org/mcp with Authorization: Bearer $JEVMODEL_API_KEY to expose jev_decide, jev_noul, jev_choice, and jev_score as typed LangChain tools sharing the same token balance.
Can I use Jev 1.14 (jev-preview) for screenshots inside a LangChain workflow?
Yes, for accounts with a Starter Pack ($9.90 / ¥49 one-time) or subscription. Pass model="jev-preview" and attach base64 assets in the /v1/systemone payload from your RunnableLambda.