unhardcoded
오픈소스 · AI 모델을 위한 정책 라우팅

하드코딩된 모델 선택 없이 AI 시스템을 구축하세요.

각 요청마다 정책을 함께 전송하세요. unhardcoded는 실시간 모델 카탈로그를 필터링하고, 규칙을 충족하는 가장 저렴한 모델을 선택하여 제공자 키를 통해 실행한 후 결정 트레이스를 반환합니다.

request
Prompt + policy
tools · intel ge 0.5 · cheapest
candidateprice_outintelverdict
deepseek-v4-flash$0.400.465기준 미달
minimax-m2.7$0.500.496기준 미달
deepseek-v4-pro$1.500.515선택됨
glm-5.1$2.000.514기준 통과
gpt-5.5$10.000.602기준 통과
trace
deepseek-v4-pro
cheapest passing · 412 ms
fp 301140696-1054914287
멘탈 모델

모델 라우팅 루프

하나의 정책이 하나의 호출을 결정합니다. 동일한 입력값, 동일한 카탈로그, 동일한 결정. 항상, 그리고 기록됩니다.

Request
호출이 OpenAI 호환 엔드포인트에 도달하며, 정책을 함께 전달합니다.
Policy sigma-pol/v2
소형 항(term): filter, rank, select, mutate, fallback.
Catalog
가격, 벤치마크, 기능이 담긴 (제공자, 모델) 후보 모델의 실시간 집합.
Filter
규칙을 통과하지 못한 후보를 제거합니다. 조용한 다운그레이드는 없습니다.
Rank
통과한 후보에 점수를 매깁니다: 가장 저렴한 것, 가장 강력한 것, 가장 빠른 것 — 선택은 여러분의 몫.
Select
상위 하나를 선택하거나, top_k 폴백 캐스케이드를 사용합니다.
Run
제공자 키를 통해 추론을 실행하며, 오류 시 폴백합니다.
Trace
모든 후보 모델, 최종 선택된 모델, 지문(fingerprint)의 영수증.

정책 작동 방식 심층 분석 →

라우팅된 호출 구성

워크플로우 패턴

워크플로우는 라우팅된 단계들로 이루어진 유계 비순환 그래프입니다. 각 노드는 자체 정책을 갖고 독립적으로 라우팅되며, 전체 그래프는 하나의 통합 트레이스를 작성합니다. 이것이 unhardcoded가 "규칙 기반 라우팅"을 넘어 하나의 시스템이 되는 지점입니다.

전체 워크플로우 가이드: 노드 종류, 그래프 제한, 템플릿 →

첫 번째 요청 전송

퀵스타트

unhardcoded는 OpenAI 호환입니다. 일반 호출에서 세 가지만 변경하면 됩니다.

  1. SDK를 호스트에 연결하세요.
    baseURL을 변경하세요. SDK의 나머지 부분은 그대로입니다.
    client.ts
    const client = new OpenAI({
      baseURL: "https://<your-host>/v1",
      apiKey: process.env.UNHARDCODED_KEY,
    });
  2. 호출에 정책을 첨부하세요.
    백엔드에서 policy_ir을 구성하여 messages와 함께 전송하세요. 라우팅은 정책에서 나오므로 model은 단지 트레이스 레이블입니다.
    route.ts
    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,
    });
  3. 트레이스를 읽으세요.
    응답에는 결정 내용이 담겨 있습니다: 선택된 모델, 순위 매겨지고 거부된 후보 모델들, 그리고 정책 지문(fingerprint).
    response · trace (illustrative)
    {
      "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
      }
    }

전체 퀵스타트: 인증, 드라이런, 실행 가능한 예제 →

시작점 복사

정책 프리셋

카드 형태의 일반적인 라우팅 패턴. 규칙을 읽고, 정책을 복사하고, 하한선과 상한선을 조정하세요.

최저 비용 적정 품질
품질 기준 이하로 내려가지 않으면서 비용을 절감합니다.
filtertools-met · bench_intelligence ge 0.5
rankcheapest price_out
fallback통과한 다음 모델
JSON 보기
cheapest-decent.json
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
         ["cmp", "bench_intelligence", "ge", 0.5]],
  ["neg", ["normalize", ["field", "price_out"]]],
  ["argmax"], ["id"], ["always", {"action": "next_candidate"}]]
스마트 균형
강한 선호 없음: 능력과 가격을 균형 있게 고려합니다.
filtertools-met · not disabled
rank0.6 intelligence + 0.4 cheap
fallback통과한 다음 모델
JSON 보기
smart-balance.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"}]]
최고 지능
중요한 작업, 비용 상한 없음: 가장 유능한 모델을 선택합니다.
filtertools-met · not disabled
rankhighest bench_intelligence
fallback통과한 다음 모델
JSON 보기
best-intelligence.json
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]]],
  ["field", "bench_intelligence"],
  ["argmax"], ["id"], ["always", {"action": "next_candidate"}]]
추론 전용
작업에 추론 가능한 모델이 필요합니다.
filter+ is cap_reasoning
rankhighest intelligence
fallback통과한 다음 모델
JSON 보기
reasoning-only.json
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "cap_reasoning"]],
  ["field", "bench_intelligence"],
  ["argmax"], ["id"], ["always", {"action": "next_candidate"}]]
비전 · 최저 비용
이미지 입력: 볼 수 있는 가장 저렴한 모델.
filter+ is in_image
rankcheapest price_out
fallback통과한 다음 모델
JSON 보기
vision-cheapest.json
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["is", "in_image"]],
  ["neg", ["normalize", ["field", "price_out"]]],
  ["argmax"], ["id"], ["always", {"action": "next_candidate"}]]
장문 컨텍스트 RAG
대형 컨텍스트 윈도우가 필요할 때, 그 다음 가장 저렴한 것을 선택합니다.
filter+ context ge 200000
rankcheapest price_out
fallback통과한 다음 모델
JSON 보기
long-context-rag.json
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]], ["cmp", "context", "ge", 200000]],
  ["neg", ["normalize", ["field", "price_out"]]],
  ["argmax"], ["id"], ["always", {"action": "next_candidate"}]]
에이전틱 플릿
에이전트 루프를 위한 최고의 도구 사용자.
filter+ tools · bench_agentic_rank le 5
rankhighest bench_agentic
fallback통과한 다음 모델
JSON 보기
agentic-fleet.json
["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"}]]
프라이빗 / 규정 준수
TEE 전용 및 로그 없음: 기능 우선.
filter+ is has_tee · is no_log
rankhighest intelligence
fallback통과한 다음 모델
JSON 보기
private-compliant.json
["policy", ["and", ["meets_req"], ["not", ["is", "disabled"]],
         ["is", "has_tee"], ["is", "no_log"]],
  ["field", "bench_intelligence"],
  ["argmax"], ["id"], ["always", {"action": "next_candidate"}]]

모든 프리셋과 실용적인 레시피 →

신뢰 객체

모든 결정은 영수증을 남깁니다

트레이스(실행 추적)는 모델이 어떻게 선택되었는지에 대한 구조화되고 재현 가능한 기록입니다: 어떤 모델이 검토되었고, 각각이 왜 통과하거나 실패했는지, 무엇이 실행되었는지, 그리고 어떻게 재현하는지.

decision_trace
deepseek-v4-flashrejected · cmp bench_intelligence ge 0.5
minimax-m2.7rejected · cmp bench_intelligence ge 0.5
deepseek-v4-proranked #1 · chosen
glm-5.1ranked #2 · cascade
gpt-5.5ranked #3 · cascade
deepseek-v4-prodecision_path · attempted · 412 ms
policy_fingerprint 301140696-1054914287 · sigma-pol/v2
rejected[]
정확한 탈락 규칙과 함께 필터링된 모든 후보 모델.
ranked[]
선택 순서대로 정렬된 통과 모델들. 첫 번째가 선택된 모델이며, 나머지는 폴백 캐스케이드입니다.
decision_path[]
시도 로그. 모든 폴백 전환이 여기에 기록됩니다.
policy_fingerprint
정규화된 정책의 안정적인 ID. 식별자는 호스트 측 sha256입니다. 워크플로우에는 flow_fingerprint도 포함됩니다.

재현 및 디버깅 작동 방식 →

세부 내용이 필요할 때

레퍼런스

완전한 명세. 읽기 경로에서 분리되어 있습니다.

GitHub 소스: unhardcoded (호스트) · unhardcoded-engine (정책 엔진)