Skip to main content
Workload identity federation lets a workload that already holds a JWT from your identity provider call OpenRouter without an OpenRouter API key in its environment. The workload exchanges its JWT for a short-lived OpenRouter access token (RFC 8693 token exchange) and sends that token as the bearer on inference requests.
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

  1. Your identity provider signs a JWT for the workload (a service account, a CI job, a Kubernetes pod).
  2. The workload posts that JWT to POST https://openrouter.ai/api/v1/oauth/token.
  3. OpenRouter verifies the signature against your issuer’s published keys, finds the federation policy that names the token’s sub and aud, and mints an OpenRouter access token that acts as the API key the policy targets.
  4. The workload calls https://openrouter.ai/api/v1/... with Authorization: Bearer <access_token> until the token expires, then exchanges again.
Access tokens live for 15 minutes at most, and never longer than the JWT that was exchanged for them. Usage is attributed to the target API key exactly as if that key had been used directly.

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.

Exchange a token

Token exchange
Response
Then call the API with the access token as the bearer:
Inference with an access token
The request body is 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 ES256 or RS256 by a key published at the issuer’s JWKS.
  • Carries iss, sub, aud, and exp, and is not expired.
  • iss equals the issuer URL of the named policy, and sub plus one aud value equal that policy’s subject and audience.

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.

Revocation

Deleting or pausing a policy, deleting an issuer, or losing the workload identity entitlement stops new exchanges immediately. Access tokens already issued remain valid until they expire, which is at most 15 minutes — none of those changes revokes an outstanding token. To cut off inference within that window, disable or delete the API key the policy targets: key state is checked on every request.