Skip to main content
Federation runs in two directions. A machine calls Orq.ai, or Orq.ai calls a model provider:

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.
The Settings page calls the first direction Workload federation; the integration dialog calls the second Workload identity federation. In the workload direction, what is federated is the identity of a workload (a process that runs without a person), not the identity of the workspace. For sign-in by people, see Single Sign-On. The model integrations that accept the tokens in the second direction are listed under Providers and on each provider page.

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.
If the process would otherwise need an Orq.ai credential stored and rotated, it is a candidate for federation. If a person signs in, use Single Sign-On. Each case below needs a registered issuer and one federation rule on it. The rule holds the claim rules that narrow who may exchange, and the permissions the job uses.
  • Run evaluations from CI. A GitHub Actions workflow on one repository’s main branch, bound to repository_id and ref.
  • Sync Prompts from a pipeline. A GitLab CI pipeline bound to project_id and ref.
  • Call the AI Gateway from a service. A backend service behind Keycloak, Okta, Auth0, or Microsoft Entra ID, bound to its azp or appid.
  • Reach the production Deployment only from a protected environment. A pipeline bound to repository_id and environment.
  • Export usage on a schedule. A Read only rule that cannot create or change anything.
Set up GitHub Actions step by step walks the first case end to end, and every exchange is listed under Authentication events.

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.
See Register an issuer for the issuer fields.
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.
Saving any change to a rule revokes every key it has already minted. Archiving a rule stops new exchanges and revokes its keys. Workloads obtain a new key on their next exchange.
An archived rule can be restored from the Rules tab. It comes back disabled, so review it before enabling it.

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 whose keys 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 :, so repo:acme/*:ref:refs/heads/main cannot be widened by a token whose sub contains extra : segments.
  • A missing claim, or a claim that is not a string, fails the condition.
The number of claim rules, conditions and values a rule accepts is listed under Limits.
A rule that is too broad hands out keys to everything that provider signs tokens for. Start narrow and widen only when needed.

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.
Claim names are case-sensitive, and a rule on a claim the provider does not send never matches.

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. ref with refs/heads/main and refs/heads/release accepts a token from either branch.

GitHub Actions rules

GitHub Actions tokens have two additional requirements. Bind a numeric ID. Every rule must bind repository_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 run gh api repos/<owner>/<repo> --jq .id. The organization ID is .owner.id in the same response.
  • Inside a workflow, ${{ github.repository_id }} and ${{ github.repository_owner_id }} print the exact values the token carries.
Restrict the events. These events are accepted:
  • push, workflow_dispatch, schedule, release, create, deployment, deployment_status.
Any other event, such as 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 the main 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/evals and 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 }}". Use github.repository_owner_id for the organization ID.
Example result: 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.
The exchange step exports the minted key as ORQ_API_KEY, so every later step uses it exactly as it would a stored API key.
  • The CLI reads ORQ_API_KEY directly. ORQ_NO_INPUT=1 makes 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: write is required. Without it, GitHub does not issue an OIDC token to the job.
On a self-hosted deployment, replace 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 iss equal to its issuer URL.
  • Contain the rule’s audience in aud.
  • Have been issued (iat) within the last 10 minutes.
  • Be valid, from iat to exp, no longer than the issuer’s Maximum incoming token lifetime.
  • Carry a jti claim 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.
  1. 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.
  2. 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 example azp = <client-id> for one application or email = jane@example.com for one user.
  3. Request tokens with scope=openid so 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 in aud 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 same invalid_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 iss exactly matches the issuer’s Issuer URL, including the scheme and any trailing slash or its absence.
  • The token’s aud contains the rule’s audience, and the same audience is sent in the audience parameter.
  • 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:
The issuer is shared by every Orq.ai workspace. A provider rule that trusts the issuer without matching sub exactly would accept tokens signed for other workspaces. Always match sub to the subject shown in the dialog.
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.
  1. In the OpenAI organization settings, create a workload identity provider with the issuer URL and expected audience.
  2. Create a mapping that matches sub to the subject, and attach the service account the integration should use.
The dialog asks for:
Every token Orq.ai signs for a provider is recorded under Settings > Audit Logs. A refused exchange fails with an authentication error that names the provider and the integration, and the provider’s own reason when its token endpoint returns one. These four belong to this direction; the workload direction has its own set under Troubleshooting:

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.

Trust Orq.ai

The dialog lists the values to register at the receiving system:
Match sub exactly. The issuer is shared by every Orq.ai workspace.

Test a connection

Select Test connection from the connection’s menu. Orq.ai signs a token and, for every mode except Direct bearer, exchanges it at the token endpoint. A failed test shows the status and reason the endpoint returned. A connection that MCP Servers or models use cannot be deleted. Delete lists them instead; switch their authentication first.