Workload federation
Exchange the OIDC token of a CI pipeline, a scheduled job or a backend service for a short-lived Orq.ai API key. Orq.ai trusts the workload’s issuer.
Provider federation
Let Orq.ai sign the token that OpenAI, Anthropic, Azure, Vertex AI or AWS Bedrock trusts, instead of storing a provider key.
Workload federation
Use cases
A workload is any process that calls Orq.ai with no person driving it, authenticating with an identity its own platform already issues. It is not an Orq.ai API key, and it is not a person signed in to the dashboard. A CI/CD job, a scheduled batch job, a backend service, a long-running application, or a deploy pipeline all qualify.An issuer whose keys are not reachable from the public internet, such as an in-cluster Kubernetes issuer, needs its keys pasted as Inline keys.
- Run evaluations from CI. A GitHub Actions workflow on one repository’s
mainbranch, bound torepository_idandref. - Sync Prompts from a pipeline. A GitLab CI pipeline bound to
project_idandref. - Call the AI Gateway from a service. A backend service behind Keycloak, Okta, Auth0, or Microsoft Entra ID, bound to its
azporappid. - Reach the production Deployment only from a protected environment. A pipeline bound to
repository_idandenvironment. - Export usage on a schedule. A
Read onlyrule that cannot create or change anything.
How it works
The only values the two sides have to agree on are public: the issuer URL and the audience. The subject token itself stays the credential and is sent only to the exchange endpoint.Prerequisites
Workload federation is available on every plan.- Configuring SSO first is not required.
- Workspace admin rights to manage issuers and federation rules.
- An identity provider that issues OIDC JWTs signed with asymmetric keys.
Workload federation is tested with GitHub Actions (including GitHub Enterprise Server) and Keycloak. Other providers such as GitLab CI, Okta, Auth0, and Microsoft Entra ID work when their tokens meet the requirements under Exchange a token.
Settings overview
Go to Settings > Workload federation. The page has three tabs:
An issuer is registered once and reused by any number of rules. An issuer URL can be registered only once per workspace.
Connect a workload
Click Connect workload. The dialog walks through three steps.1
Issuer
Pick the issuer the workload’s tokens come from:
- Connect a new provider: choose a provider to register it. A provider that is already registered offers Use existing instead.
- Use a registered issuer: pick any active issuer from the list.
2
Federation rule
Name the rule, copy the audience, set the key lifetime, and add the claim rules.
3
Access
Choose the project and permissions every minted key gets.
To change a rule later, open it from the Rules tab.
An issuer and audience pair belongs to the first workspace that uses it, and stays reserved while its rule is disabled or archived. Another workspace cannot use the same pair. Keep the generated audience to avoid conflicts.
Register an issuer
A provider picked under Connect a new provider opens the issuer form. Register issuer on the Inbound tab opens the same form without creating a rule. Edit an issuer from its menu.JWKS source
An issuer signs its tokens with a private key and publishes the matching public keys as a JSON Web Key Set (JWKS, RFC 7517): a JSON document whosekeys array holds one entry per key, each with the kid the token’s header names. Orq.ai downloads that document, finds the key the token names, and verifies the signature with it, so an issuer can rotate keys without a configuration change on either side.
Provider types
Disable the rules that use an issuer before changing its issuer URL or JWKS source, or before archiving it. An archived issuer cannot authenticate workloads. Restore it from the Issuers tab to reuse it.
Authentication events
The Authentication events tab lists every token exchange with its time, event, outcome, and the token subject or the denial reason. Filter by issuer or rule to narrow the list. See Troubleshooting for what each reason means.Claim rules
Rules decide which tokens are accepted. The issuer and audience only prove that the token came from the right provider; the rules narrow it down to a specific repository, branch, environment, user, or application. A claim rule is a list of conditions. A token is accepted when every condition of any single claim rule matches. Claim rules are combined with OR, conditions within a claim rule with AND. Each condition names a claim and lists its allowed values:- A value without
*must match the claim exactly. - A value containing
*is a glob anchored at both ends.*matches any characters except:, sorepo:acme/*:ref:refs/heads/maincannot be widened by a token whosesubcontains extra:segments. - A missing claim, or a claim that is not a string, fails the condition.
Which claims to use
Every OIDC provider puts different claims in its tokens. The ones that identify a workload or a person:
To see the exact claims and values a provider sends, decode one of its tokens before writing rules:
A live subject token is the credential itself, so decode it locally. An already-expired token is safe to paste into an online decoder such as jwt.io, and nothing needs decoding on the Orq.ai side: the exchange endpoint verifies the signature itself.
Common rules
- To allow alternatives, add a rule per alternative. To accept two repositories, create two rules, each binding its own
repository_id; a token from either repository matches one of them and is accepted. - To allow several values in one condition, list them.
refwithrefs/heads/mainandrefs/heads/releaseaccepts a token from either branch.
GitHub Actions rules
GitHub Actions tokens have two additional requirements. Bind a numeric ID. Every rule must bindrepository_id or repository_owner_id to a value without *. Repository and organization names can be renamed or transferred; the numeric IDs cannot. To find them:
- Open
https://api.github.com/repos/<owner>/<repo>for a public repository, or rungh api repos/<owner>/<repo> --jq .id. The organization ID is.owner.idin the same response. - Inside a workflow,
${{ github.repository_id }}and${{ github.repository_owner_id }}print the exact values the token carries.
push,workflow_dispatch,schedule,release,create,deployment,deployment_status.
pull_request from a fork or a merge queue, is rejected unless every rule has an event_name condition with exact values. A value containing * does not count.
To accept pull request workflows on purpose, add an
event_name condition to each rule and list every accepted event, for example push and pull_request. A rule with only event_name = pull_request rejects tokens from pushes.Set up GitHub Actions step by step
This walkthrough lets themain branch of the acme/evals repository call the AI Gateway.
1
Find the repository ID
Find the repository’s numeric ID using any of these:
- Browser (public repositories): open
https://api.github.com/repos/acme/evalsand copy the top-level"id"value. - GitHub CLI (public or private):
gh api repos/acme/evals --jq .id - From a workflow run: add a step with
echo "${{ github.repository_id }}". Usegithub.repository_owner_idfor the organization ID.
812345678. Replace acme/evals with the target repository.2
Register the issuer
In Orq.ai, go to Settings > Workload federation and click Connect workload. Under Connect a new provider, choose GitHub Actions. Keep the prefilled issuer URL and register it, or click Use existing if GitHub Actions is already registered.
3
Fill in the rule
4
Add the audience variable
In the GitHub repository, go to Settings > Secrets and variables > Actions > Variables and add a repository variable
ORQ_AUDIENCE with the copied audience. The audience is not a secret, so a variable is enough.5
Add the workflow
Save this as
.github/workflows/call-orq.yml:6
Push to main
The job exchanges its GitHub token for an Orq.ai API key and calls the AI Gateway. The exchange appears under Authentication events, and in Settings > Audit Logs as a Token Issued event with the token subject as the actor.
ORQ_API_KEY, so every later step uses it exactly as it would a stored API key.
- The CLI reads
ORQ_API_KEYdirectly.ORQ_NO_INPUT=1makes it fail instead of prompting, so a misconfigured job errors out rather than hanging. - The SDKs read the same variable. The step can just as well be a script using the Node SDK (
@orq-ai/node) or the Python SDK (orq-ai-sdk). id-token: writeis required. Without it, GitHub does not issue an OIDC token to the job.
https://my.orq.ai in the exchange request with your host, and set ORQ_SERVER for the CLI.
If the exchange step fails with invalid_target, see Troubleshooting.
Exchange a token
The exchange endpoint implements OAuth 2.0 Token Exchange (RFC 8693).
No Orq.ai credential is sent. The subject token is the credential.
A successful response returns the key:
expires_in is the lifetime configured on the federation rule, independent of the subject token’s own expiry.
The subject token must:
- Be signed by one of the registered issuer’s keys, with
issequal to its issuer URL. - Contain the rule’s audience in
aud. - Have been issued (
iat) within the last 10 minutes. - Be valid, from
iattoexp, no longer than the issuer’s Maximum incoming token lifetime. - Carry a
jticlaim when the issuer enforces single-use tokens. Each such token can be exchanged once.
Errors
Use the key
The minted key is a standard Orq.ai API key.- Send it as
Authorization: Bearer <key>to the platform API, the AI Gateway, and an MCP Gateway. - Scope: the granted permissions and the pinned project only.
- Lifetime: it stops working when it expires.
- Audit: each grant is recorded as a Token Issued event, with the rule, the token subject, the key ID, and its expiry.
Keycloak
Orq.ai reads the audience from the ID token, not the access token.-
In Keycloak, open the client the workload uses, then make the ID token carry the audience:
- Simplest: create the federation rule with the client ID as its audience, because Keycloak already puts the client ID in the ID token’s
aud. - Explicit: add an Audience mapper to the client with Included Custom Audience set to the rule’s audience and Add to ID token turned on.
- Simplest: create the federation rule with the client ID as its audience, because Keycloak already puts the client ID in the ID token’s
-
Register a Custom OIDC issuer with issuer URL
https://<keycloak-host>/realms/<realm>, and connect a rule with a claim rule that limits who may exchange, for exampleazp=<client-id>for one application oremail=jane@example.comfor one user. -
Request tokens with
scope=openidso Keycloak returns an ID token, then exchange it:
Other OIDC providers
Register the provider as an issuer, then request an ID token with the rule’s audience inaud and send it to the exchange endpoint. Add a claim rule on a claim such as preferred_username, email, or sub to limit which principals may exchange tokens.
Troubleshooting
Every token rejection returns the sameinvalid_target error. Open the Authentication events tab and look for a denied exchange on the rule. The reason names what to fix:
If no denied entry appears, Orq.ai could not link the token to a rule, could not verify it, or the per-rule denial budget was exhausted. Check that:
- The token’s
issexactly matches the issuer’s Issuer URL, including the scheme and any trailing slash or its absence. - The token’s
audcontains the rule’s audience, and the same audience is sent in theaudienceparameter. - The token is signed with one of the issuer’s keys. With OIDC discovery or Explicit URL, the keys must be reachable from the public internet; with Inline keys, the pasted set must include the current key.
- The rule is enabled and the issuer is not archived.
Security
- Token rejections return the same generic error, so a caller cannot discover which issuers or audiences are configured.
- With Enforce single-use tokens on, each subject token can be exchanged once and replays are rejected.
- Granted exchanges, and denials of correctly signed tokens meant for a rule, are recorded in the workspace audit log.
- Keys minted from a rule created in the dashboard are pinned to its project, and no minted key can hold workspace administration permissions.
- Issuer discovery and key fetches refuse redirects.
Limits
Manage issuers and rules from the dashboard as a workspace admin.
The rule’s audience must appear in the token’s
aud. If the identity provider cannot add a custom value, use a value it already sends, such as the client ID, as long as no other rule uses the same issuer and audience.
An identity provider on a private network needs Inline keys. With the other key sources, Orq.ai fetches discovery and keys over the public internet.
Provider federation
Here Orq.ai acts as the identity provider: an OpenAI, Anthropic, Azure, Vertex AI or AWS Bedrock integration runs keyless.How it works
The credential is cached per integration and shared by every gateway request that uses it, and refreshed before it expires. When a refresh fails, the cached credential keeps serving until it expires, then requests fail with the provider’s reason. It lives only in the cache and expires on its own; the integration stores no provider secret.Prerequisites
- Permission to add or update an integration in the workspace, the same permission that adds an API key.
- A provider rule that trusts the Orq.ai issuer and matches the integration’s subject exactly.
- The provider IDs that provider’s console issues, which the dialog asks for.
Register Orq.ai at the provider
Choose the provider under AI Gateway > BYOK, select Configure, and set Authentication to Workload identity federation. The choice belongs to the integration: another integration for the same provider can keep an API key. Setup workload identity federation in the dialog shows the values to register at the provider:
Every dialog starts with a required Name, a label for the integration. Each tab lists the rest of its fields, with the labels the dialog shows and whether the field is required.
- OpenAI
- Anthropic
- Azure
- Vertex AI
- AWS Bedrock
- In the OpenAI organization settings, create a workload identity provider with the issuer URL and expected audience.
- Create a mapping that matches
subto the subject, and attach the service account the integration should use.
Outbound connections
An outbound connection lets a system outside the model providers trust Orq.ai instead of a stored secret. The connection defines how Orq.ai presents its signed token to that system. MCP Servers and OpenAI-compatible models use outbound connections to authenticate to their upstream.Create a connection
On the Outbound tab, select New connection.
Token request fields cannot override the fields a mode sets, such as
grant_type.