# Keyless auth

> Run Anthropic and OpenAI models with no stored key, through GitHub OIDC and the provider's workload identity federation.

Anthropic and OpenAI models can run without a stored key. Each run exchanges the GitHub OIDC token it already has for a short-lived provider token, through the provider's workload identity federation.

- The IDs Pullfrog stores identify a rule at the provider and authorize nothing on their own.
- Keyless auth is tried before any subscription or API key.
- If the provider refuses the exchange when a run starts, the run moves on to the [next credential](https://pullfrog.com/docs/subscriptions#credential-order) and logs why.
- If the provider can't be reached, the run stays on keyless auth and retries when the agent first calls the provider. An outage never moves a run onto a credential billed differently.

## Anthropic

1. In the Claude Console, open [Workload identity](https://platform.claude.com/settings/workload-identity-federation), click **Connect workload**, choose **GitHub Actions**, and fill in the rule:

    | Field | Value |
    | --- | --- |
    | GitHub organization | your account |
    | **Advanced match options** → Subject pattern | `repo:*` |
    | **Advanced match options** → Additional claim conditions | `repository_owner_id` = your account's numeric GitHub ID, as the rule's only claim |

    The Pullfrog console's setup dialog shows your account's numeric ID. Matching on it rather than on the subject matters because GitHub writes the subject two ways: `repo:acme/app:…`, or with IDs, `repo:acme@123/app@456:…`, which newer repositories use. The wizard's default subject pattern matches only the first. The ID also keeps the rule from following your account's name if it's renamed.

    Under **Enable in workspaces**, leave **All workspaces** unchecked and pick one workspace: its limits apply to the runs. Keep the default OAuth scope and token lifetime, then create the service account the runs act as.

2. In the Pullfrog console, expand **Keyless (OIDC)** in the **Providers** section, click **Set up** on **Anthropic**, and paste the rule's federation rule ID, your organization ID and the service account ID. If the rule is enabled in more than one workspace, add the workspace ID for the runs under **Rule covers several workspaces**.

This rule lets any workflow in the account's repositories get a token, as any workflow in a repository with Pullfrog installed can already receive the keys you store in Pullfrog. To [narrow it](https://platform.claude.com/docs/en/manage-claude/wif-providers/github-actions#restrict-which-workflows-can-authenticate), add a claim: `repository_id` for one repository, or `event_name` = `workflow_dispatch` for only the runs Pullfrog starts, which keeps out runs of your own workflows on other events.

A refused exchange returns only `Authentication failed`. The reason is in the Console's [authentication history](https://platform.claude.com/settings/workload-identity-federation?tab=history), which names the claim that didn't match.

## OpenAI

1. Follow [OpenAI's GitHub Actions guide](https://developers.openai.com/api/docs/guides/workload-identity-federation/github-actions) to add an identity provider with the issuer `https://token.actions.githubusercontent.com` and the audience `https://api.openai.com/v1`, then a service account mapping. OpenAI matches claims exactly, so map on `repository_owner` set to your account, or on `repository` for a single repository.
2. In the Pullfrog console, click **Set up** on **OpenAI** under **Keyless (OIDC)** and paste the identity provider ID and the service account ID. If the identity provider uses another audience, set it under **Identity provider uses another audience**.

## Workflow variables

The IDs can live in `pullfrog.yml` like any key. They aren't secrets, so repository or organization variables work:

**Anthropic**, `.github/workflows/pullfrog.yml`:

```yaml
env:
  ANTHROPIC_FEDERATION_RULE_ID: ${{ vars.ANTHROPIC_FEDERATION_RULE_ID }}
  ANTHROPIC_ORGANIZATION_ID: ${{ vars.ANTHROPIC_ORGANIZATION_ID }}
  ANTHROPIC_SERVICE_ACCOUNT_ID: ${{ vars.ANTHROPIC_SERVICE_ACCOUNT_ID }}
  # optional: the workspace, when the rule covers several
  ANTHROPIC_WORKSPACE_ID: ${{ vars.ANTHROPIC_WORKSPACE_ID }}
```

**OpenAI**, `.github/workflows/pullfrog.yml`:

```yaml
env:
  OPENAI_IDENTITY_PROVIDER_ID: ${{ vars.OPENAI_IDENTITY_PROVIDER_ID }}
  OPENAI_SERVICE_ACCOUNT_ID: ${{ vars.OPENAI_SERVICE_ACCOUNT_ID }}
  # optional: the audience, when the identity provider uses another
  OPENAI_WIF_AUDIENCE: ${{ vars.OPENAI_WIF_AUDIENCE }}
```

The workflow needs `id-token: write`, which the generated `pullfrog.yml` already grants.

## Fallback

A run that can't use keyless auth logs why and falls back to the next credential. With none, it fails with that reason.

- The provider refused the exchange.
- A required variable is missing.
- A [gateway](https://pullfrog.com/docs/gateways) is set for the same provider. The two can't be combined, and the gateway wins.
