omni-auth
它能做什么
这项技能展示如何通过 OmniRoute 的 API 和仪表板进行身份验证。适合需要登录、获取会话或设置登录方式的开发者和管理员。
适用场景
- ✓当用户需要用 bearer 令牌为请求做身份验证的时候。
- ✓当用户需要登录 OmniRoute 仪表板或获取会话 cookie 的时候。
- ✓当用户想设置单点登录或更改登录要求的时候。
技能链接
https://github.com/cheaper-inference/OmniRoute/blob/release/v3.8.53/skills/omni-auth/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我怎样在脚本里登录 OmniRoute,以获取访问令牌?”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能列出登录接口和登出接口。登录接口接受管理密码并返回会话 cookie,登出接口需要安全令牌。它还介绍了仪表板的单点登录选项。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Overview
Manage API key authentication and session tokens. Start here to authenticate requests via Bearer token, obtain session cookies, and configure login requirements for the OmniRoute API.
Authentication
Remote API requests use a Bearer credential. Dashboard login is different: POST /api/auth/login accepts a management password and returns an auth_token session cookie.
Endpoints
POST /api/auth/login
Authenticate user
curl -X POST http://localhost:20128/api/auth/login \
-H "Content-Type: application/json" \
-c cookie.jar \
-d '{"password":"<management-password>"}'
POST /api/auth/logout
Log out
CSRF_TOKEN=$(curl -s http://localhost:20128/api/auth/csrf -b cookie.jar | jq -r .token)
curl -X POST http://localhost:20128/api/auth/logout \
-b cookie.jar \
-H "x-omniroute-csrf: $CSRF_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
GET /api/auth/oidc/login
Start OIDC login for the dashboard admin gate
Builds an authorization URL from the configured OIDC issuer/client (discovered
via {issuer}/.well-known/openid-configuration, falling back to {issuer}/authorize),
sets a short-lived oidc_state cookie, and redirects the browser. Password login
remains available as a fallback while OIDC is enabled.
curl http://localhost:20128/api/auth/oidc/login \
-b cookie.jar
GET /api/auth/oidc/callback
Complete OIDC login for the dashboard admin gate
Validates the state cookie, exchanges the authorization code for tokens,
verifies the ID token against the issuer's JWKS (audience = client id), and
requires at least one dashboard admission policy: oidcAllowedSubjects
(matching sub or verified email) or oidcAdmissionClaim (matching a
configured array claim in the verified ID token). When both are present,
both must match. Without either policy the callback returns not_configured.
On success it mints the same 30-day auth_token dashboard-session JWT
used by password login and redirects to /dashboard.
curl http://localhost:20128/api/auth/oidc/callback \
-b cookie.jar
GET /api/auth/csrf
GET auth › csrf
curl http://localhost:20128/api/auth/csrf \
-b cookie.jar
GET /api/auth/status
GET auth › status
curl http://localhost:20128/api/auth/status \
-b cookie.jar
Payloads
See the full OpenAPI specification at GET /api/openapi/spec or docs/openapi.yaml for detailed request/response schemas.
OmniRoute
Local/remote AI gateway exposing OpenAI-compatible REST. One key, 380 providers, auto-fallback, RTK token saver, MCP server, A2A agents.
Setup
export OMNIROUTE_URL="http://localhost:20128" # or VPS / tunnel URL
export OMNIROUTE_KEY="sk-..." # from Dashboard → API Keys
All requests: ${OMNIROUTE_URL}/v1/... with Authorization: Bearer ${OMNIROUTE_KEY}.
Verify: curl $OMNIROUTE_URL/api/health → {"ok":true}
Discover models
curl $OMNIROUTE_URL/v1/models # chat/LLM (default)
curl $OMNIROUTE_URL/v1/models/image # image-gen
curl $OMNIROUTE_URL/v1/models/tts # text-to-speech
curl $OMNIROUTE_URL/v1/models/embedding # embeddings
curl $OMNIROUTE_URL/v1/models/web # web search + fetch
curl $OMNIROUTE_URL/v1/models/stt # speech-to-text
Use data[].id as model field in requests. Combos appear with owned_by:"combo".
Capability skills
常见问题
bearer 令牌和仪表板登录有什么区别?
远程 API 请求使用 bearer 凭证,而仪表板登录使用管理密码,并返回会话 cookie。
它支持单点登录吗?
支持。这项技能介绍了仪表板的 OIDC 登录方式,密码登录仍作为备用方式保留。
本地开发时能跳过登录吗?
这项技能说明,本地开发时可以关闭密钥要求。
详情
作者的原始描述
Manage API key authentication and session tokens. Start here to authenticate requests via Bearer token, obtain session cookies, and configure login requirements for the OmniRoute API.
热度
- GitHub 星标
- 84k
- 排名
- #1420
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …