別再把呼叫哪個模型寫死在程式碼裡。
兩個核心概念:策略決定每次呼叫由哪個模型處理;工作流程將這些決策串聯成完整的處理管線。開源、MIT 授權,使用您自己的供應商 API 金鑰運行,無需信任任何中間層。
選擇模型的是策略,不是您。
把 model="gpt-5.5" 寫死在程式碼裡,它很快就會過時。新模型每週發布,價格持續變動,部分請求需要工具呼叫能力、圖像理解,或只是需要成本更低的選項。策略宣告資格條件與排名方式,針對每次請求選出合適的模型,並在失敗時執行備援。您傳入的是規則,而非一個名稱。
每次決策都會留下可重放的追蹤紀錄:相同的策略、輸入與模型目錄,可在主機或您自己的機器上精確還原決策過程。沒有任何路由發生在暗處。
工作流程對整個任務進行路由。
真實的功能不是單次呼叫。一個客服回覆包含分類 → 起草 → 審核:每個步驟需要不同的模型,審核環節可以在內容送出前拒絕它,各步驟可以並行展開再匯合。一條策略路由一次呼叫;工作流程路由整個處理管線,並產生一份完整的統一追蹤紀錄。
低成本分類,達到品質基線後起草,再經強力 no-log 審核——可在送出前拒絕內容。
查看 flow_ir
["flow", {
"u": {"kind": "input"},
"t": {"kind": "llm", "system": "Classify the ticket and extract the account id as JSON.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["has_cap", "supports_json_mode"]],
["neg", ["normalize", ["field", "price_out"]]], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["u"]},
"d": {"kind": "llm", "system": "Write a reply using the ticket and the triage.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["cmp", "bench_intelligence", "ge", 0.55]],
["neg", ["normalize", ["field", "price_out"]]], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["u", "t"], "template": "Ticket:\n$1\n\nTriage:\n$2"},
"g": {"kind": "llm", "system": "Check brand voice, PII, refund limits. Refuse if any fail.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "no_log"]],
["field", "bench_intelligence"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["d"]},
"out": {"kind": "output", "inputs": ["g"]}
}]低成本起草,強力批評,再改寫。在預算內實現品質躍升。
查看 flow_ir
["flow", {
"u": {"kind": "input"},
"d": {"kind": "llm", "system": "Draft an answer.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["neg", ["normalize", ["field", "price_out"]]], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["u"]},
"c": {"kind": "llm", "system": "Critique the draft: list concrete flaws and gaps.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["d"]},
"r": {"kind": "llm", "system": "Rewrite the answer, fixing every point in the critique.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["u", "d", "c"], "template": "Question:\n$1\n\nDraft:\n$2\n\nCritique:\n$3"},
"out": {"kind": "output", "inputs": ["r"]}
}]從同一強力策略中進行 N 次隨機抽樣(sample 將它們分散至排名靠前的候選模型),再由裁判擇優選出結果。
查看 flow_ir
["flow", {
"u": {"kind": "input"},
"n1": {"kind": "llm", "system": "Answer the question.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"], ["sample", 0.5], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["u"]},
"n2": {"kind": "llm", "system": "Answer the question.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"], ["sample", 0.5], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["u"]},
"n3": {"kind": "llm", "system": "Answer the question.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"], ["sample", 0.5], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["u"]},
"j": {"kind": "llm", "system": "Pick the single best candidate; return it verbatim.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["n1", "n2", "n3"], "template": "A:\n$1\n\nB:\n$2\n\nC:\n$3"},
"out": {"kind": "output", "inputs": ["j"]}
}]三個依族系固定的模型並行起草,第四個模型綜合出更優的單一答案。
查看 flow_ir
["flow", {
"u": {"kind": "input"},
"a": {"kind": "llm", "system": "Draft an answer.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["family_eq", "gemini-3.1-pro-preview"]],
["zero"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]], "inputs": ["u"]},
"b": {"kind": "llm", "system": "Draft an answer.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["family_eq", "claude-opus-4-8"]],
["zero"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]], "inputs": ["u"]},
"c": {"kind": "llm", "system": "Draft an answer.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["family_eq", "deepseek-v4-flash"]],
["zero"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]], "inputs": ["u"]},
"f": {"kind": "llm", "system": "Synthesize the single best answer from the drafts.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["add", ["scale", 0.7, ["normalize", ["field", "bench_intelligence"]]],
["scale", 0.3, ["neg", ["normalize", ["field", "price_in"]]]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["a", "b", "c"]},
"out": {"kind": "output", "inputs": ["f"]}
}]推理模型與程式碼模型在不同篩選條件下並行運行,再經合併步驟融合輸出,適用於推理與程式碼混合的任務。
查看 flow_ir
["flow", {
"u": {"kind": "input"},
"rz": {"kind": "llm", "system": "Reason through the problem step by step.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "cap_reasoning"]],
["field", "bench_intelligence"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]], "inputs": ["u"]},
"cd": {"kind": "llm", "system": "Produce any code the problem needs.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["cmp", "bench_coding_rank", "le", 5]],
["add", ["scale", 0.7, ["normalize", ["field", "bench_coding"]]],
["scale", 0.3, ["neg", ["normalize", ["field", "price_out"]]]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]], "inputs": ["u"]},
"m": {"kind": "llm", "system": "Merge the reasoning and the code into one answer.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["add", ["scale", 0.6, ["normalize", ["field", "bench_intelligence"]]],
["scale", 0.4, ["neg", ["normalize", ["field", "price_out"]]]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["rz", "cd"], "template": "Reasoning:\n$1\n\nCode:\n$2"},
"out": {"kind": "output", "inputs": ["m"]}
}]橫向滑動查看圖示 →
兩個儲存庫,MIT 授權,現在即可使用。
複製 Host 與 Engine 儲存庫,設定您的供應商帳戶,今天就能以自己的 API 金鑰開始路由。無加價,無隱藏路由邏輯。
不想自己運行主機?託管版本(含託管目錄、追蹤紀錄儲存與團隊管控功能)即將上線。
或寄送電子郵件至 hello@unhardcoded.com 加入。
不發垃圾郵件。託管版就緒時僅發一封通知郵件。