Workload identity federation lets your application use its existing OpenID Connect (OIDC) identity to call Serverless Inference without storing a long-lived Forge API key. Your application exchanges a signed JSON Web Token (JWT) for an expiring federated access token and sends that access token with its inference requests.
Forge admins configure trust for the application’s identity, and developers update the application to exchange its JWT.
To authenticate with an API key, see Authentication.
Organization and team admins complete this one-time setup in multi-tenant Forge. To send inference requests, your organization needs access to Serverless Inference. To create a federated team service account, your organization needs an Enterprise plan.
Register the JWT issuer
As a Forge organization admin, register the application’s existing issuer.
- In the upper-right corner, click the account selector.
- Click Settings.
- In the sidebar, click Authentication.
- Under JWT Issuers, click Add JWT Issuer.
- For Issuer URL, enter the issuer URL. The URL must exactly match the
iss claim in the application’s JWT.
- Click Add issuer.
Forge reads the issuer’s publicly accessible OIDC discovery document at ISSUER_URL/.well-known/openid-configuration, where ISSUER_URL is the issuer URL you entered. It uses the public keys from the discovery process to verify JWT signatures.
Create a federated service account
As a team admin, create the service account in the team that owns your inference project.
- In Forge, open that team’s Service Accounts tab.
- Click New Team Service Account.
- Enter a Name.
- For Authentication Method, select Federated identity.
- For JWT Issuer, select the issuer registered by your organization admin.
- For Subject, enter the exact
sub claim from a JWT issued to the application.
- Click Create service account.
Forge uses the registered issuer and subject to identify the service account during token exchange.
Authenticate from your application
Use Bash with curl and jq to exchange the JWT. Keep the same shell open for the chat completion example.
Exchange a workload token
Get a signed, unexpired JWT from the registered issuer. Its sub claim must match the configured subject. Its single aud value must match the exact name of the Forge organization that contains your project. Set OIDC_TOKEN_FILE to the absolute path of the file containing the JWT.
On success, exchange_workload_token() saves the access token in INFERENCE_BEARER_TOKEN and its lifetime in seconds in INFERENCE_EXPIRES_IN. If the exchange fails, resolve the error before sending an inference request.
Send a chat completion request
For this example, choose an existing project with Team visibility that the service account can write to. Set INFERENCE_PROJECT to its team/project identifier by replacing TEAM_NAME and PROJECT_NAME with the team and project names.
Both examples send the identifier in the OpenAI-Project header and use the exchanged access token as the bearer credential.
In the same Bash session, install the OpenAI Python package and export the token.Run the Python example from that session.
Both examples print the assistant’s reply. For the response format, see Chat completions.
Renew the access token
Reuse the access token across requests. Schedule another exchange before INFERENCE_EXPIRES_IN seconds elapse. Under the default Token renewal setting, supply a fresh JWT for each exchange. For the Python example, export the new token and create a new client. Keep both tokens out of logs.
Troubleshoot authentication
If the exchange fails, check that Forge can reach the issuer’s discovery document and public keys. Verify these JWT values:
- Expiration
- Issuer
- Subject
- Audience
Under the default issuer policy, a jti_known error means that Forge already exchanged the JWT. Get a fresh JWT and retry.
If the exchange succeeds and the inference request fails authorization, check that the request uses the exchanged access token and the intended OpenAI-Project value. Confirm that the service account can write to that project. Last modified on December 3, 2026