OpenRouter
このPlaygroundはOpenRouter経由でバージョンを固定したJevを呼び出します。最新の料金と提供状況はモデルページで確認してください。
- エンドポイント
- POST https://openrouter.ai/api/alpha/decisions
- model
- typesafe/jev-1.13
- APIキー
- APIキーはサーバーからBearerトークンとして送信します。
同じ状況について1問、または異なる3問を試せます。まず例を選び、入力を編集して、それぞれの構造化された回答を確認してください。
回答形式を1つずつ試せます。 実行するたびに、その日の利用枠を1回分使います。
例を実行すると、質問ごとに形式の決まった回答が返ります。Choiceは選択肢、Scoreは尺度上の値、Probabilityは0~1の値を返します。
このフォームは文章をstate.inputとして、名前を付けた1問または3問とともに送ります。結果はそれぞれanswers.<question_id>に入ります。
リクエストで質問と回答形式を指定し、レスポンスでは質問ごとに結果が返ります。コード例に出てくる JSON の項目を見ていきましょう。
modelstatequestions<question_id>typeinstructionscriteriaanswerschoiceprobabilitiesconfidencescorelegendnoul同じ状況について、Choice・Score・Probabilityの3問を個別に評価します。 実行するたびに、その日の利用枠を1回分使います。 形式が正しくても判断が正しいとは限りません。代表的な事例で検証し、用途に応じた閾値を設定してください。
このPlaygroundはOpenRouter経由でバージョンを固定したJevを呼び出します。最新の料金と提供状況はモデルページで確認してください。
TypeSafeには独自のエンドポイントとAPIキーがあります。公式クイックスタートではjev-latestを使い、1回のリクエストで複数の質問を送る方法を示しています。
Output tokens are free.
Eligible accounts may receive promotional credits. TypeSafe does not publish a fixed amount on its public pages; check the console for your balance and terms.
ハーネスがモデル呼び出しとツール実行の流れを管理します。判断が必要な場面で Jev にメッセージ、実行予定のツール呼び出し、またはエージェントの状態を渡し、型付きの結果を受け取ります。次の処理はコードで決め、自由記述の作業はチャットモデルに任せます。
ModelRouterMiddlewarebefore_agent → wrap_model_call実行前に最新のユーザー入力を分類してモデルを選び、その実行中は同じ選択を使います。選択結果、確率、信頼度はエージェントの状態にも残ります。
AutoModeMiddlewarewrap_tool_call指定したツールの実行前に呼び出しを判定します。リスクが高い、または権限が不十分と判断されると、呼び出しを止めてエラーの ToolMessage を返します。人間への承認依頼は行いません。
TypeSafeClassifierChoice · Score · Noul独自の判断点も追加できます。カスタムミドルウェアから TypeSafeClassifier にメッセージや状態を渡し、Choice、Score、Noul の結果をもとに分岐や人手での確認を行います。
# pip install "langchain-typesafe[experimental]" langchain-openai
# Set TYPESAFE_API_KEY and OPENAI_API_KEY on your server.
from langchain.agents import create_agent
from langchain_typesafe.experimental.middleware import (
ModelChoice, ModelRouterMiddleware,
)
router = ModelRouterMiddleware(
choices={
"fast": ModelChoice(
model="openai:gpt-5.6-terra",
criteria="Simple lookups and extraction.",
),
"powerful": ModelChoice(
model="openai:gpt-6-astra",
criteria="Complex reasoning and high-stakes decisions.",
),
},
instructions="Choose the least costly model that can do the task safely.",
)
agent = create_agent("openai:gpt-5.6-terra", middleware=[router])
result = agent.invoke({"messages": [{"role": "user", "content": "Summarize this log."}]})
print(result["model_route"].choice)// Run on your server. Keep the API key out of browser code.
const apiKey = process.env.OPENROUTER_API_KEY;
if (!apiKey) throw new Error("Set OPENROUTER_API_KEY");
const response = await fetch("https://openrouter.ai/api/alpha/decisions", {
method: "POST",
headers: {
Authorization: "Bearer " + apiKey,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "typesafe/jev-1.13",
state: {input: "A customer reports a duplicate charge."},
questions: {
team: {
type: "choice",
instructions: "Which team should handle this?",
criteria: {
billing: "Payments and refunds",
technical: "Bugs and integrations"
}
},
urgency: {
type: "score",
instructions: "How urgent is the issue?",
criteria: ["Can wait", "Needs attention today", "Immediate action"]
},
escalate: {
type: "noul",
instructions: "Should a human review this first?",
criteria: {false: "No review needed", true: "Review before acting"}
}
}
})
});
if (!response.ok) throw new Error("Decision request failed");
const {answers} = await response.json();
console.log(answers.team.choice, answers.urgency.score, answers.escalate.noul);選ばれた選択肢のキー。最も確率の高い選択肢です。
各段階の確率で重み付けした位置です。2つの段階の間になることもあります。
はい・いいえの質問に対する 0(いいえ)から 1(はい)の値です。
実際の問い合わせに近いデータで検証し、モデルのバージョンを記録してください。結果が不確かな場合や影響が大きい場合は、人が確認できるようにします。0.8 は説明用の値です。
頻繁に更新される公開リポジトリ、または不定期の厳選メールで、新しいJevプロジェクト、System Oneのコミュニティモデル、実践事例を確認できます。