Workload identity federation is available to organizations on request. Contact your OpenRouter account team to enable Settings → Workload identity for your organization.
How it works
- Your identity provider signs a JWT for the workload (a service account, a CI job, a Kubernetes pod).
- The workload posts that JWT to
POST https://openrouter.ai/api/v1/oauth/token. - OpenRouter verifies the signature against your issuer’s published keys, finds the federation policy that names the token’s
subandaud, and mints an OpenRouter access token that acts as the API key the policy targets. - The workload calls
https://openrouter.ai/api/v1/...withAuthorization: Bearer <access_token>until the token expires, then exchanges again.
Set up trust
Everything is configured by an organization admin under Settings → Workload identity.1. Add an issuer
An issuer is an identity provider your organization trusts.2. Add a policy
A policy says which tokens from an issuer may exchange, and which API key they act as.
Each policy has an id shown under its name. Your workload sends that id as
federation_policy_id with every exchange, which binds the exchange to your organization even if another organization trusts the same issuer, subject, and audience. Policies can be paused with the Enabled switch.
Under Token must match, choose Add claim check to add either of these optional conditions:
All added checks must pass, in addition to issuer, subject, audience, signature, and expiry validation. Matching is case-sensitive; missing or incorrectly typed claims fail the exchange. Each check can be added once and removed independently. Policies without additional checks keep their existing behavior.
These conditions validate the incoming identity token. They do not change the
inference scope or Bearer token type of the issued OpenRouter access token, and sending scope=inference in the exchange request does not satisfy a subject-token check.
Exchange a token
Token exchange
Response
Inference with an access token
application/x-www-form-urlencoded and must stay under 32 KB; subject_token itself is capped at 16 KB. federation_policy_id is required and names the policy to evaluate. requested_token_type (must be urn:ietf:params:oauth:token-type:access_token) and scope (must be inference) are accepted and optional; audience and resource are accepted and ignored.
Requirements on the subject token
- Signed with
ES256orRS256by a key published at the issuer’s JWKS. - Carries
iss,sub,aud, andexp, and is not expired. issequals the issuer URL of the named policy, andsubplus oneaudvalue equal that policy’s subject and audience.- Satisfies every additional claim check configured on the policy.
Errors
Errors follow RFC 6749 §5.2:Verifying OpenRouter access tokens
Access tokens are JWTs (typ: at+jwt) signed by OpenRouter with ES256. The public keys are published at https://openrouter.ai/api/v1/oauth/jwks. The sub of an access token is the sub of the exchanged JWT, and federation_policy_id and federation_issuer_id name the policy and issuer that authorized it, for auditing on your side. OpenRouter does not read them when authorizing a request.