Ory and open-source identity for AI apps: Ory, Keycloak, authentik, ZITADEL, SuperTokens and Logto compared in 2026
Why AI apps need identity work
Every AI app needs user login, and most need more than that:
| Need | Example |
|---|---|
| User login | Email, passkeys, Google and GitHub sign-in |
| Multi-factor authentication | Protect accounts with stored conversations and paid credits |
| Enterprise SSO | Business customers want SAML or OIDC through Okta or Microsoft Entra ID |
| Organizations and roles | Teams sharing workspaces, admins managing members |
| API keys and service tokens | Customers calling your AI API from their code |
| OAuth for third parties | MCP clients and AI agents acting on a user's behalf |
| Fine-grained permissions | Which documents an AI assistant may retrieve for a given user |
Building these yourself is slow and risky. Open-source identity tools give you a tested base you can self-host.
Which directory projects fit here
| Project | What it is | License | Written in |
|---|---|---|---|
| Ory | Modular, API-first identity components | Apache 2.0 | Go |
| Keycloak | Full identity and access management server, a CNCF project | Apache 2.0 | Java |
| authentik | Identity provider with flows, SSO and proxy authentication | MIT core with enterprise features | Python and Go |
| ZITADEL | Identity platform built for multi-tenant SaaS | AGPLv3 | Go |
| SuperTokens | Auth for app developers with prebuilt UI and SDKs | Apache 2.0 core | Java core, many SDKs |
| Logto | Auth and OIDC provider with organizations and SSO | MPL 2.0 | TypeScript |
Ory components
| Component | Purpose |
|---|---|
| Kratos | Identity and user management: registration, login, MFA, passkeys, recovery, verification |
| Hydra | OAuth2 and OpenID Connect provider, certified by the OpenID Foundation |
| Keto | Permissions based on Google's Zanzibar model |
| Oathkeeper | Identity and access proxy that checks requests before they reach your services |
| Polis | Enterprise SSO bridge for SAML, originally BoxyHQ's Jackson |
Ory does not ship a fixed login screen. Your app renders the forms using Ory's flow APIs, or uses Ory Elements, a set of prebuilt UI components. That gives full control over branding at the cost of some front-end work.
Versioning and 2026 releases
From October 2025, Ory moved all components to calendar versioning in the form YY.Q.N. Kratos and Hydra v26.2.0 were released on March 20, 2026. Ory Network runs newer builds continuously; its June 2026 changelog added per-organization session-lifetime overrides, so a business customer can require shorter sessions for its members than your default.
Ory Network pricing
| Plan | Price | Usage beyond credit |
|---|---|---|
| Developer | Free | Development use |
| Production | $770/year, or $21 included monthly usage credit | $0.14 per average daily active user per month; $0.007 per M2M token; $0.00009 per permission check |
| Growth | $9,350/year, or $255 included monthly usage credit | $0.12 per aDAU per month; $0.006 per M2M token; $0.000085 per permission check |
| Enterprise | Custom | Custom |
Self-hosted open-source components are free. The Ory Enterprise License adds enterprise features and support for teams running Ory in their own infrastructure.
Identity for MCP servers and AI agents
Remote MCP servers expose tools such as "read my calendar" or "create an invoice" to AI assistants. The MCP specification uses OAuth 2.1 for this:
- The AI client discovers the MCP server's authorization server from metadata.
- The client registers itself, often through dynamic client registration.
- The user signs in and consents to the requested scopes.
- The authorization server issues an access token for that MCP server only.
- The MCP server validates the token and checks scopes before running tools.
Ory Hydra, Keycloak, ZITADEL and Logto can act as the authorization server. Keep tokens short-lived, use narrow scopes such as calendar.read, and require fresh consent for sensitive tools. See the MCP stack page.
Agents acting for users raise another question: which permissions an agent inherits. A good practice is to issue tokens tied to both the user and the agent client, so logs show which agent acted and users can revoke one agent without signing out everywhere.
Permissions for retrieval
When an AI assistant searches a company's documents, it must return only what the asking user may see. Permission systems based on the Zanzibar model, such as Ory Keto, store relationships like "user A is a member of team B, which can view folder C". At query time, the retrieval service filters candidate documents by checking permissions, or pre-filters by the list of folders the user can access. Without this step, an assistant can leak confidential documents across teams.
Comparing the options
| Need | Good fit |
|---|---|
| Full control over login UI, API-first | Ory |
| Mature, feature-rich IAM for many internal apps | Keycloak |
| SSO for self-hosted tools plus proxy auth for apps without login | authentik |
| Multi-tenant B2B SaaS with organizations | ZITADEL or Logto |
| Quick auth in a new app with prebuilt screens | SuperTokens or Logto |
| Fine-grained permissions | Ory Keto, or OpenFGA and SpiceDB outside the directory |
Self-hosting tips
- Run identity services with a managed PostgreSQL database and regular backups; losing identity data locks everyone out.
- Put services behind TLS and keep admin APIs on a private network.
- Rotate signing keys on a schedule and support key rollover.
- Turn on rate limiting for login and recovery endpoints to slow credential stuffing.
- Subscribe to security advisories for whichever tool you choose and patch promptly.
- Test account recovery flows, since they are a common attack target.
Hosted alternatives
Hosted services such as Clerk, Auth0, WorkOS, Stytch, Supabase Auth and Firebase Authentication remove operations work. Ory Network, ZITADEL Cloud, Logto Cloud and SuperTokens' managed service give a hosted option with an open-source exit path, so you can move to self-hosting later without rebuilding login. That exit path is the main reason many teams start with an open-source-backed provider even when they use its cloud.
A typical setup for an AI SaaS
- Kratos, or Logto, for sign-up with email, passkeys and Google sign-in.
- Organizations with roles stored in your database or the identity tool.
- SAML or OIDC SSO for enterprise customers through Ory Polis or the provider's SSO feature.
- Hashed API keys for customers who call your AI API, with per-key usage limits.
- Hydra as the OAuth server for your remote MCP server.
- Audit logs of sign-ins, key creation and agent token grants.
Related: MCP stack, Go stack, PostgreSQL stack, Django stack, Kubernetes stack, Stack index.
Frequently asked questions
What is the difference between Ory Kratos and Ory Hydra?
Kratos manages users: registration, login, passwords, passkeys, social sign-in, multi-factor authentication, account recovery and profile settings. Hydra is an OAuth2 and OpenID Connect server that issues tokens to applications. Use Kratos for your own app's login; add Hydra when other apps, APIs or AI agents need OAuth tokens to act for your users.
How much does Ory Network cost?
The Developer plan is free. Production costs $770 a year, or a $21 monthly included usage credit, then $0.14 per average daily active user per month, $0.007 per machine-to-machine token and $0.00009 per permission check. Growth costs $9,350 a year with a $255 monthly credit and lower unit prices. Enterprise is custom.
Can I self-host Ory for free?
Yes. Kratos, Hydra, Keto and Oathkeeper are Apache 2.0 and free to run. You pay for infrastructure and run them yourself. The Ory Enterprise License, priced on request, adds enterprise features and support for self-hosted production.
Which open-source identity tool is easiest to start with?
Logto and SuperTokens are quick to add to a new app, with SDKs and prebuilt login screens. authentik and Keycloak are full identity providers with admin interfaces, suited to SSO across many internal apps. ZITADEL suits multi-tenant SaaS. Ory is the most modular and API-first, which suits teams that want full control over the login interface.
How do MCP servers handle authentication?
The MCP specification uses OAuth 2.1 for remote servers. The MCP server acts as a resource server, and an authorization server, which can be Ory Hydra, Keycloak, ZITADEL, Logto or a hosted provider, issues tokens after the user consents. Dynamic client registration lets AI clients register themselves without manual setup.