Call models with enterprise identity
A business system carries a user token issued by the enterprise identity source and calls models directly. Usage is metered by person and department; department quotas still apply.
Call models with enterprise identity
A business system (for example an in-bank office, customer-service, or approval system) can skip applying for an API key and instead call models carrying a token the enterprise identity source (OIDC) issued for the current user. The gateway finishes token verification and authorization locally. Every call is recorded under a specific person and department. Department quotas and personal quotas still apply.
| Comparison | API key | Enterprise-identity token |
|---|---|---|
| Who issues the credential | An administrator creates it under Model Groups → API key management | The enterprise identity source issues it for the currently signed-in user |
| Metering owner | The key | A specific person, department, and workspace |
| Department quota, personal quota | Not applicable | Apply |
| Credential rotation | An administrator rotates by hand | After expiry the business system fetches a new token from the identity source |
| Models that can be called | Models in the model group bound to the key | Models in every model group available to that user in the chosen workspace |
1. How it works
- The business system obtains a JWT (ID Token, or a JWT-format Access Token) from the enterprise identity source for the current user. The token's audience (
aud) is the business system's own client ID. - The business system calls the gateway directly and carries that token in the
Authorizationheader. The call URL and body are identical to using an API key. - The gateway verifies the token with the identity-source signing public key stored locally, finds the matching platform user by
subin the token, then judges whether that user can use the requested model in the workspace this call belongs to. - After the token expires, the business system fetches a new one from the identity source. The whole process does not need any admin-console API.
Everything the gateway needs to verify the token (issuer, audience allowlist, person-to-workspace relations, signing public keys) is stored locally on the gateway node. Signing public keys are fetched by the gateway directly from the identity source and stored locally, so even if the control plane is unavailable for a long time, calls by existing users are not affected; see section 6.
2. Prerequisites
Completed by a unit administrator in the admin console (detailed steps are in the Identity sources and sign-in security topic):
- Connect an OIDC identity source: on the Single sign-on page choose IAM, type OpenID Connect, fill in the identity-source address (Issuer), client ID, and client secret, save, and finish a test sign-in.
- Enable business-system calls: in the Business-system calls block on the same page, turn on Allow business systems to call models with an identity-source token, and fill in Business-system client IDs (at least one). The audience of the user token the business system obtains must be one of the IDs registered here.
- The person already exists on the platform: the caller must be an enabled user of this unit, and already associated with that identity source — the user has signed in once through that identity source, or association was completed when directory sync pushed them. A disabled user cannot call.
- Workspace and model available: the caller belongs to at least one workspace, and the model group that holds the requested model has been distributed to that user or that workspace.
On save, the platform immediately reads the signing public key once from the identity source and checks that the identity-source address is reachable. If the read fails, save does not succeed and the page shows the reason.
Notes:
- Only a unit OIDC identity source can enable business-system calls. OAuth2 (generic) identity sources and platform-level identity sources do not provide this.
- The same issuer can be used for business-system calls by only one unit. When another unit already uses it, save fails with "this identity source is already used by another unit for business-system calls".
- The gateway only accepts tokens signed with these asymmetric algorithms: RS256, RS384, RS512, PS256, ES256, ES384, EdDSA. Tokens using HS256 or similar symmetric algorithms, or unsigned tokens, are rejected.
3. Call URL
After the identity-source configuration is saved, the page shows Business-system call URL, which is this platform's public access URL. Model-call APIs sit under /api/v1/agent-gateway/ on that URL, the same as when using an API key:
| Protocol | API |
|---|---|
| OpenAI-compatible | POST /api/v1/agent-gateway/openai/v1/chat/completions, POST /api/v1/agent-gateway/openai/v1/responses, POST /api/v1/agent-gateway/openai/v1/embeddings |
| Anthropic-compatible | POST /api/v1/agent-gateway/anthropic/v1/messages |
| Gemini-compatible | POST /api/v1/agent-gateway/gemini/v1beta/models/<model-name>:generateContent |
| Model list | GET /api/v1/agent-gateway/openai/v1/models (Anthropic and Gemini have matching list APIs) |
The token may sit in Authorization: Bearer, x-api-key, or x-goog-api-key per each protocol's habit. The gateway recognizes it as an enterprise-identity token by the token format.
4. Request example
curl https://zenova.example.com/api/v1/agent-gateway/openai/v1/chat/completions \
-H "Authorization: Bearer $IDP_ID_TOKEN" \
-H "X-Zenova-Workspace: 4f1c2b7e-9a3d-4c55-8e0f-2a6b1d9c7e31" \
-H "Content-Type: application/json" \
-d '{
"model": "your-gateway-model",
"messages": [{"role": "user", "content": "Summarize the key points of this expense claim."}]
}'Authorization: the token the identity source issued for the current user.X-Zenova-Workspace: the workspace ID (UUID) this call belongs to.model: an available model name. Call the model-list API first to see models available to the current user in that workspace.
4.1 Specify a workspace
Every enterprise-identity call must belong to a specific workspace:
| Situation | Result |
|---|---|
Carries X-Zenova-Workspace, and the user is a member of that workspace | Called in that workspace |
Carries X-Zenova-Workspace, but the user is not a member of that workspace | 403, workspace_not_member |
| No such header, and the user belongs to exactly one workspace | That workspace is used automatically |
| No such header, and the user belongs to several workspaces or to none | 400, IDP_WORKSPACE_REQUIRED |
A tenant administrator calling with an enterprise-identity token must also specify a workspace. Business systems should always carry this header.
4.2 Token requirements
| Claim | Requirement |
|---|---|
iss | Exactly matches Issuer in the identity-source configuration |
aud | Contains at least one registered business-system client ID. When it contains several audiences, azp must also be a registered ID |
exp | Must be present and not expired |
nbf, iat | Not later than now (60-second clock skew allowed) |
sub | Matches that user's subject ID in this identity source |
Header kid | Found among the signing public keys the identity source publishes |
After the identity source rotates signing public keys, when the gateway sees a new kid it fetches the latest keys directly from the identity source (at most once per 60 seconds per node).
5. Metering, quotas, and call records
- Caller in the call record shows as Business system (identity-source token), with the person and their department.
- Usage is rolled up by caller, department, function group, and workspace, and can be viewed by department on the usage and cost page.
- Department quotas, function-group quotas, and personal quotas apply the same as when that user uses the platform directly. When a quota is exceeded, the call is rejected per the quota settings.
- Routing rules, guardrails, and traffic protection apply to enterprise-identity calls as usual.
6. Behavior when the control plane is unavailable
| Scenario | Behavior |
|---|---|
| Control plane down (any duration); an existing user calls | Call proceeds |
| Gateway node restarts while the control plane is down | Call proceeds: the node starts from locally stored configuration and signing public keys |
| The identity source rotates signing public keys while the control plane is down | Call proceeds: the gateway fetches the new keys directly from the identity source |
| A newly joined user while the control plane is down | Cannot call; available after the control plane recovers and the node configuration updates |
| A disabled or departed user while the control plane is down | Can still call until the node configuration updates, same as API-key revocation taking effect |
| Identity source down | Already-issued, unexpired tokens remain usable; the business system cannot obtain a new token |
7. Troubleshooting errors
Errors are returned in the error format of the protocol used (OpenAI, Anthropic, Gemini). The error code is in the code field of the error object.
| Status | Error code | Meaning | Remedy |
|---|---|---|---|
| 401 | IDP_TOKEN_INVALID | The token failed verification: bad signature, the issuer has not enabled business-system calls, audience not in the allowlist, token expired, or the user does not exist or is disabled | Confirm in order: identity-source configuration has business-system calls enabled; token aud is a registered client ID; the token is not expired; the caller has signed in once through that identity source and the account is enabled. For security the response does not distinguish the exact cause |
| 401 | IDP_TOKEN_ALGORITHM_REJECTED | The token used an algorithm that is not accepted (symmetric or unsigned) | In the identity source, issue tokens with an asymmetric algorithm listed above, such as RS256 or ES256 |
| 400 | IDP_WORKSPACE_REQUIRED | The user belongs to several workspaces or to none, and no workspace was specified | Fill in the workspace ID in header X-Zenova-Workspace. When the user belongs to no workspace, have an administrator add them to a workspace |
| 400 | invalid_request_error | The value of X-Zenova-Workspace is not a valid workspace ID | Fill in the workspace UUID |
| 403 | workspace_not_member | The user is not a member of the specified workspace | Switch workspace, or have an administrator add the member |
| 404 | model_not_found | The model does not exist, or is not available to that user in this workspace | Call the model-list API to see available models; have an administrator distribute the model group that includes that model to the user or workspace |
| 403 / 429 | Quota or rate-limit error codes | Department or personal quota exhausted, or traffic protection was hit | Check the reject source in the call record and handle it per quotas and routing rules |
An administrator can filter enterprise-identity calls in call records by person, and confirm caller, model, status, and duration.
Identity sources and sign-in security
Connect an enterprise OIDC identity source, configure platform-level SSO, require two-factor authentication and password policy, schedule directory sync, recover platform accounts and root, and handle authenticator codes that differ from server time
A2A call linkage and billing by caller
An external A2A agent carries a platform-issued call credential into model calls. The platform uses it to tie the agent's internal model calls to a specific A2A call and bill them to the caller.