跳转到内容

选择语言

当前语言: 简体中文

Inference Auth Posture

GET /v1/models and the inference endpoints are gated by different settings. The most natural probe an operator runs to answer “is my API protected?” can therefore return the wrong answer.

Endpoint Gated by
GET /v1/models The dashboard login posture — isAuthRequired(), overridable per-instance with requireAuthForModels (src/app/api/v1/models/catalogRequest.ts)
POST /v1/chat/completions, POST /v1/responses, and the other client API routes REQUIRE_API_KEY (src/server/authz/policies/clientApi.ts)

On an instance that has an admin password set and REQUIRE_API_KEY=false, /v1/models answers 401 while inference is open to anyone who can reach the port.

Probing caveat: a 401 from /v1/models does not verify that inference is protected. It only tells you the dashboard requires login.

This is not hypothetical. In discussion #13310 a self-hosted instance behind Traefik had its Codex quota spent by anonymous POST /v1/responses traffic while /v1/models returned 401 — which, in the reporter’s words, “initially created the impression that the entire API was protected” and sent them investigating the wrong component.

Probe an inference route, not the catalog:

终端窗口
curl -s -o /dev/null -w '%{http_code}\n' \
-X POST http://<host>:<api-port>/v1/chat/completions \
-H 'content-type: application/json' \
-d '{"model":"<any-model>","messages":[{"role":"user","content":"ping"}]}'

A 401 means REQUIRE_API_KEY is enforcing. Anything that reaches routing (including a model-not-found error) means anonymous traffic is accepted.

Note that with REQUIRE_API_KEY=false an invalid bearer degrades to anonymous rather than rejecting (#2257), so sending a junk key is not a valid probe either.

When REQUIRE_API_KEY is disabled and a server binds a non-loopback interface, OmniRoute logs a warning at boot (src/lib/startup/nonLoopbackApiKeyGuard.ts). This covers three surfaces:

  • the Dashboard/API server that serves /v1 inference — HOST, default 0.0.0.0
  • the API bridge — API_HOST, default 127.0.0.1
  • the live dashboard WebSocket — its own host

The warning never blocks boot: a reverse proxy in front of OmniRoute may already be enforcing its own authentication.

  • REQUIRE_API_KEY in ENVIRONMENT.md
  • APP_BIND_HOST and the compose loopback defaults (#12568)
  • #2257 — invalid bearer degrades to anonymous when REQUIRE_API_KEY is off
  • #13695 — this document

undefined (a58000c7685f)

HagiCode

HagiCode 是面向项目开发的 AI 编码工作台:丰富、便捷的界面交互让规划、Agent 执行与项目工作更容易上手和跟进,带来更投入的开发体验。

丰富、便捷的界面交互,让规划、Agent 执行与项目工作更容易上手和跟进。

访问 HagiCode阅读文档
  • 智能OpenSpec 工作流把意图转化为从提案、设计、任务到交付的可执行路径。
  • 高效多 Agent 并行推进调研、实现与审阅,并支持多仓库变更和你熟悉的 Agent CLI。
  • 有趣丰富、便捷的界面交互让规划、Agent 执行与项目工作更容易上手和跟进,带来更投入的开发体验。

下载 Windows 版

从 Microsoft Store 获取全部下载

让想法变成真正交付的软件。

HagiCode 是面向项目开发的 AI 编码工作台:用 OpenSpec 工作流规划变更,多 Agent 并行执行,再由 Hero Scenario 让进度一目了然,把想法变成真正交付的软件。

智能
OpenSpec 工作流把意图变成从提案到交付的可执行路径。
高效
多 Agent 并行推进调研、实现与审阅。
有趣
丰富、便捷的界面交互,让规划、Agent 执行和项目工作更容易跟进。