# Claude subscription

> Run Anthropic models on your paid Claude plan instead of paying for API tokens.

Run Pullfrog on the Claude plan you already pay for, with no Anthropic API bill on top. One command stores the token, and every run on an Anthropic model uses it: Claude Fable, Claude Opus, Claude Sonnet and Claude Haiku.

## Setup

Run this inside a clone of the repository. The CLI uses the [GitHub CLI](https://cli.github.com) to sign you in, so run `gh auth login` first if you have not.

```bash
npx pullfrog auth claude
```

The CLI:

1. Opens a Claude sign-in in your browser. Sign in with the account on the paid plan and approve it.
2. Receives the token `claude setup-token` would print: inference-only, valid for a year, starting with `sk-ant-oat`. Claude Code does not need to be installed.
3. Saves it to Pullfrog's encrypted store. Pullfrog refuses a token that Anthropic rejects.

The next run on an Anthropic model uses the subscription.

- **A different account.** A browser signs in as the account it already holds, and the CLI shows which one that was. To connect another, sign out of Claude in that browser or open the sign-in link in a private window.
- **More accounts.** Run the command again to add another account or replace one. Each connection is labelled with the last six characters of its token.
- **Fallback.** With several connections, or an `ANTHROPIC_API_KEY` beside them, Pullfrog [moves to the next credential](https://pullfrog.com/docs/subscriptions#multiple-subscriptions-and-fallback) when one is rejected or out of quota.

## Remote machines

The sign-in finishes on `localhost`, so the browser must be on the machine that runs the CLI. Over SSH, or on Linux with no display, the CLI asks for a token instead.

Run `claude setup-token` from [Claude Code](https://code.claude.com/docs) on any machine with a browser, and paste the token it prints. Pass `--paste-token` to choose this yourself:

```bash
npx pullfrog auth claude --paste-token
```

## Scope

On an organization repository, the CLI asks where to store the token:

| Option | Scope | Who can save it |
| --- | --- | --- |
| **`<owner>` organization** | Every repository in the organization | Organization owner |
| **`<owner>/<repo>` only** | This repository | Repository admin |

A personal account has only the account scope, so the CLI does not ask. To skip the prompt or run outside a checkout, pass the scope as a flag:

```bash
npx pullfrog auth claude --org my-org          # organization scope
npx pullfrog auth claude --repo my-org/my-repo # one repository
```

## Credential refresh

The token is static and lasts a year, so nothing rotates between runs. Run `npx pullfrog auth claude` again when the token expires or you revoke it, and pick the old connection to replace.

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| The CLI waits after you approve in a browser on another machine | The sign-in returns to `localhost` on the machine that ran it. Cancel, and run `npx pullfrog auth claude --paste-token`. |
| `claude: command not found` while using `--paste-token` | Install [Claude Code](https://code.claude.com/docs) on the machine with the browser, then run `claude setup-token` there. |
| Run comment: "Your Claude subscription was rejected by its provider" | The token expired or was revoked. Run `npx pullfrog auth claude` and replace the old connection. |
| Run comment: "Your Claude subscription has hit its usage limit" | The plan's usage window is spent. Pullfrog re-runs a stopped review after the reset. Re-trigger anything else then, or add an `ANTHROPIC_API_KEY` so runs continue on the API key until then. |
