하드코딩된 모델 선택 없이 AI 시스템을 구축하세요.
각 요청마다 정책을 함께 전송하세요. unhardcoded는 실시간 모델 카탈로그를 필터링하고, 규칙을 충족하는 가장 저렴한 모델을 선택하여 제공자 키를 통해 실행한 후 결정 트레이스를 반환합니다.
fp 301140696-1054914287
모델 라우팅 루프
하나의 정책이 하나의 호출을 결정합니다. 동일한 입력값, 동일한 카탈로그, 동일한 결정. 항상, 그리고 기록됩니다.
top_k 폴백 캐스케이드를 사용합니다.워크플로우 패턴
워크플로우는 라우팅된 단계들로 이루어진 유계 비순환 그래프입니다. 각 노드는 자체 정책을 갖고 독립적으로 라우팅되며, 전체 그래프는 하나의 통합 트레이스를 작성합니다. 이것이 unhardcoded가 "규칙 기반 라우팅"을 넘어 하나의 시스템이 되는 지점입니다.
저비용으로 분류하고, 품질 기준에 맞춰 초안을 작성한 후, 전송 전에 거부 가능한 강력한 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, n3: the same policy, two more seeded draws
"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"]}
}]패밀리로 고정된 세 모델이 병렬로 초안을 작성하고, 네 번째 모델이 최선의 단일 답변을 합성합니다.
핵심: family_eq가 정확한 모델 라인을 고정하므로 패널이 재현 가능합니다 — "오늘 가장 저렴한 것"이 아닙니다.
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: family_eq "claude-opus-4-8" · c: family_eq "deepseek-v4-flash"
"f": {"kind": "llm", "system": "Synthesize the single best answer from the drafts.",
"policy": ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["a", "b", "c"]},
"out": {"kind": "output", "inputs": ["f"]}
}]추론기와 코더가 서로 다른 필터 아래 병렬로 실행되고, 병합 단계에서 결합됩니다.
핵심: 각 분기는 하나의 모델이 모든 것을 처리하는 대신, 그 역할에 가장 적합한 모델을 선택합니다(추론 vs 코딩).
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]],
["field", "bench_coding"], ["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"]]],
["field", "bench_intelligence"], ["argmax"], ["id"], ["always", {"action": "next_candidate"}]],
"inputs": ["rz", "cd"], "template": "Reasoning:\n$1\n\nCode:\n$2"},
"out": {"kind": "output", "inputs": ["m"]}
}]퀵스타트
unhardcoded는 OpenAI 호환입니다. 일반 호출에서 세 가지만 변경하면 됩니다.
-
SDK를 호스트에 연결하세요.
baseURL을 변경하세요. SDK의 나머지 부분은 그대로입니다.const client = new OpenAI({ baseURL: "https://<your-host>/v1", apiKey: process.env.UNHARDCODED_KEY, }); -
호출에 정책을 첨부하세요.백엔드에서
policy_ir을 구성하여messages와 함께 전송하세요. 라우팅은 정책에서 나오므로model은 단지 트레이스 레이블입니다.const res = await client.chat.completions.create({ model: "policy:support", policy_ir: ["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["cmp", "bench_intelligence", "ge", 0.5]], // filter ["neg", ["normalize", ["field", "price_out"]]], // rank: cheapest ["argmax"], ["id"], ["always", {"action": "next_candidate"}]], messages, }); -
트레이스를 읽으세요.응답에는 결정 내용이 담겨 있습니다: 선택된 모델, 순위 매겨지고 거부된 후보 모델들, 그리고 정책 지문(fingerprint).
{ "chosen": { "model_family": "deepseek-v4-pro", "price_out": 1.5 }, "trace": { "policy_fingerprint": "301140696-1054914287", "rejected": [{ "model_family": "deepseek-v4-flash", "reason": "cmp bench_intelligence ge 0.5" }], "total_latency_ms": 425 } }
정책 프리셋
카드 형태의 일반적인 라우팅 패턴. 규칙을 읽고, 정책을 복사하고, 하한선과 상한선을 조정하세요.
bench_intelligence ge 0.5price_outJSON 보기
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["cmp", "bench_intelligence", "ge", 0.5]],
["neg", ["normalize", ["field", "price_out"]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]JSON 보기
["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"}]]bench_intelligenceJSON 보기
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
["field", "bench_intelligence"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]is cap_reasoningJSON 보기
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "cap_reasoning"]],
["field", "bench_intelligence"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]is in_imageprice_outJSON 보기
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "in_image"]],
["neg", ["normalize", ["field", "price_out"]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]context ge 200000price_outJSON 보기
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["cmp", "context", "ge", 200000]],
["neg", ["normalize", ["field", "price_out"]]],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]bench_agentic_rank le 5bench_agenticJSON 보기
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["has_cap", "supports_tools"], ["cmp", "bench_agentic_rank", "le", 5]],
["field", "bench_agentic"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]is has_tee · is no_logJSON 보기
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
["is", "has_tee"], ["is", "no_log"]],
["field", "bench_intelligence"],
["argmax"], ["id"], ["always", {"action": "next_candidate"}]]모든 결정은 영수증을 남깁니다
트레이스(실행 추적)는 모델이 어떻게 선택되었는지에 대한 구조화되고 재현 가능한 기록입니다: 어떤 모델이 검토되었고, 각각이 왜 통과하거나 실패했는지, 무엇이 실행되었는지, 그리고 어떻게 재현하는지.
sha256입니다. 워크플로우에는 flow_fingerprint도 포함됩니다.레퍼런스
완전한 명세. 읽기 경로에서 분리되어 있습니다.
GitHub 소스: unhardcoded (호스트) · unhardcoded-engine (정책 엔진)