Self-Hosted OpenAI-Compatible Entry
Self-hosted unified OpenAI-compatible entry
์น์ ์ ๋ชฉ: โSelf-hosted unified OpenAI-compatible entryโWhen enabled, OmniRouteโs existing /v1/chat/completions (and the OpenAI-compatible
contract it serves) becomes a self-hosted gateway: one OpenAI-compatible request
in, auto-routed to the provider of your choice through the provider adapters, with a
standard OpenAI error shape out. Client code does not change.
This is the D4 (ๆฅๅ
ฅๅณ็จ) differentiator from the RIC-697 design: the same /v1 path
the OpenAI SDK already targets, backed by your own providers instead of a single
vendored catalog.
Set either env var (see .env.example for both):
OMNIROUTE_SELF_HOSTED_PROVIDERSโ inline YAML document (runtime-only, not logged).OMNIROUTE_SELF_HOSTED_PROVIDERS_FILEโ path to a YAML file.
providers: - id: local kind: openai # openai | anthropic | local baseUrl: http://127.0.0.1:11434/v1 model: llama3 # apiKey: sk-... # optional, runtime-only - id: claude kind: anthropic baseUrl: http://127.0.0.1:8080 model: claude-sonnetWhen either var is set, the unified entry is active for every request to
/v1/chat/completions. Config present but unparseable returns 500 (it never
silently falls through to cloud routing). When neither is set, the route behaves
exactly as before.
Provider auto-route
์น์ ์ ๋ชฉ: โProvider auto-routeโPrecedence (deterministic, no predictive model):
x-omniroute-provider: <id>header โ exact provider id.modelprefix:provider/model(slash) orprovider::model(double colon).- First configured provider.
The routing prefix is stripped before forwarding โ upstream receives the bare model
(claude-sonnet, not claude/claude-sonnet).
# via headercurl http://localhost:20128/v1/chat/completions \ -H "x-omniroute-provider: claude" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet","messages":[{"role":"user","content":"hi"}]}'
# or via model prefixcurl ... -d '{"model":"claude/claude-sonnet","messages":[...]}'Auth scaffold (D5 reserved)
์น์ ์ ๋ชฉ: โAuth scaffold (D5 reserved)โOptional OMNIROUTE_SELF_HOSTED_API_KEY. When set, requests must carry
Authorization: Bearer <key>. Unset = open route (loopback / trusted network),
mirroring how OmniRouteโs existing local providers work. The D5 quota/quota-่ชๆฒป
key system is expected to take over this header.
Failure contract
์น์ ์ ๋ชฉ: โFailure contractโ- Upstream non-2xx body is normalized through
parseUpstreamError+buildErrorBodyinto the standard OpenAIerrorshape (Hard Rule #12 โ never raw upstream text). - Network-level failures (connection refused / DNS / TLS) return a normalized
502witherror.message: "Upstream provider unreachable: โฆ". - Credential / session headers echoed upstream are stripped from every response.
tests/unit/self-hosted-entry.test.ts covers provider selection, model-prefix
forwarding, header hygiene, auth, upstream-error normalization, SSE streaming
passthrough, and the fall-through / misconfig paths โ all over real HTTP against a
local upstream.
- Self-hosted models bypass the cloud-only retirement / alias machinery by design:
the divert happens before those cloud checks, so ids like
local/llama3never trip cloud-peer 410s or alias rewrites. - Deterministic routing strategies (fallback / cooldown / cost / latency / blacklist)
are M2โs scope (
RIC-740) and inject into the gateway layer here. Configure them with astrategy:block โ see DETERMINISTIC_ROUTING.md.
HagiCode
HagiCode๋ ์์ด์ ํธ ์ฝ๋ฉ ์์ ๊ณต๊ฐ์ ๋๋ค. ํ๋ถํ๊ณ ํธ๋ฆฌํ UI ์ํธ์์ฉ์ผ๋ก ๊ณํ ์๋ฆฝ, ์์ด์ ํธ ์คํ, ํ๋ก์ ํธ ์์ ์ ์ฝ๊ฒ ์์ํ๊ณ ๋ฐ๋ผ๊ฐ๋ฉฐ ๊ฐ๋ฐ์ ๋ ํฅ๋ฏธ๋ก์ด ๊ฒฝํ์ผ๋ก ๋ง๋ญ๋๋ค.
ํ๋ถํ๊ณ ํธ๋ฆฌํ UI ์ํธ์์ฉ์ผ๋ก ๊ณํ๋ถํฐ ํ๋ก์ ํธ ์์ ๊น์ง ์ฝ๊ฒ ๋ฐ๋ผ๊ฐ ์ ์์ต๋๋ค.
- ์ค๋งํธOpenSpec ์ํฌํ๋ก๋ ์๋๋ฅผ ์ ์, ์ค๊ณ, ์์ ์ ๊ฑฐ์ณ ๋ฐฐํฌ๊น์ง ์ด์ด์ง๋ ์คํ ๊ฐ๋ฅํ ๊ฒฝ๋ก๋ก ๋ฐ๊ฟ๋๋ค.
- ํจ์จ์ ๋ค์ค ์์ด์ ํธ ์คํ์ผ๋ก ์กฐ์ฌ, ๊ตฌํ, ๊ฒํ ๋ฅผ ๋ณ๋ ฌ๋ก ์งํํ๋ฉฐ ์ฌ๋ฌ ์ ์ฅ์์ ์ต์ํ Agent CLI๋ฅผ ์ง์ํฉ๋๋ค.
- ํฅ๋ฏธ๋ก์ดํ๋ถํ๊ณ ํธ๋ฆฌํ UI ์ํธ์์ฉ์ผ๋ก ๊ณํ ์๋ฆฝ, ์์ด์ ํธ ์คํ, ํ๋ก์ ํธ ์์ ์ ์ฝ๊ฒ ์์ํ๊ณ ๋ฐ๋ผ๊ฐ ์ ์์ต๋๋ค.
Windows์ฉ ๋ค์ด๋ก๋
HagiCode ๊ณต์
์์ด๋์ด๋ฅผ ์ค์ ๋ก ๋ฐฐํฌ๋๋ ์ํํธ์จ์ด๋ก.
HagiCode๋ ์์ด์ ํธ ์ฝ๋ฉ ์์ ๊ณต๊ฐ์ ๋๋ค. OpenSpec ์ํฌํ๋ก๋ก ๋ณ๊ฒฝ์ ๊ณํํ๊ณ , ๋ค์ค ์์ด์ ํธ ์คํ์ผ๋ก ์งํํ๋ฉฐ, Hero Scenario๋ก ๊ธด ์์ ์ ์งํ ์ํฉ์ ํ๋์ ๋ณด์ฌ ์์ด๋์ด๋ฅผ ์ค์ ๋ก ๋ฐฐํฌ๋๋ ์ํํธ์จ์ด๋ก ๋ง๋ญ๋๋ค.
- ์ค๋งํธ
- OpenSpec ์ํฌํ๋ก๋ ์๋๋ฅผ ์ ์๋ถํฐ ๋ฐฐํฌ๊น์ง ์ด์ด์ง๋ ์คํ ๊ฐ๋ฅํ ๊ฒฝ๋ก๋ก ๋ฐ๊ฟ๋๋ค.
- ํจ์จ์
- ๋ค์ค ์์ด์ ํธ ์คํ์ผ๋ก ์กฐ์ฌ, ๊ตฌํ, ๊ฒํ ๋ฅผ ๋ณ๋ ฌ๋ก ์งํํฉ๋๋ค.
- ์ฆ๊ฑฐ์ด
- ํธ๋ฆฌํ UI ์ํธ์์ฉ์ผ๋ก ๊ณํ, ์์ด์ ํธ ์คํ, ํ๋ก์ ํธ ์์ ์ ์ฝ๊ฒ ๋ฐ๋ผ๊ฐ ์ ์์ต๋๋ค.
ยฉ 2026 HagiCode | Powered By hagilight-starlight@0.21.0 | Branch: main | Commit: de60bcd | Built:

