1. Install the GitHub App
claude
/install-github-app
The command walks through installing the app on the repository, storing the API key as a repository secret and opening a pull request that adds the workflow file. You can also do all three by hand.
2. The workflow
name: Claude
on:
issue_comment: { types: [created] }
pull_request_review_comment: { types: [created] }
issues: { types: [opened, assigned] }
jobs:
claude:
if: contains(github.event.comment.body, '@claude') || github.event_name == 'issues'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 1 }
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
env:
ANTHROPIC_BASE_URL: https://aiprimetech.io
With the env line, every run in CI goes through the gateway: your repository secret is a gateway key, and the usage lands on your gateway balance or unlimited plan. Remove the env line to bill an Anthropic account instead.
3. Using it
- Comment
@claude fix the failing test in auth.pyon an issue — it opens a pull request. - Comment
@claudeon a pull request review thread — it responds and pushes changes to that branch. - Assign an issue to the app to have it implemented without a comment.
- Schedule it: a cron-triggered workflow with a fixed prompt (dependency audit, changelog draft).
Costs in CI
Each trigger is a full agent run: checkout, read the relevant files, plan, edit, test, push. Expect tens of thousands of tokens per run on a real repository. Teams that wire @claude into every PR are precisely the users for whom a flat-rate plan beats per-token billing — see the pricing guide.
Permissions and safety
- Give the job only the permissions the task needs;
contents: writeis required to push. - Restrict triggers to trusted contributors on public repositories — anyone who can comment can otherwise spend your tokens.
- Use
allowed_toolsin the action inputs to fence what the agent may run.
Frequently asked questions
Is the Claude Code GitHub Action free?
The Action is open source and free; the runs cost tokens on whichever key the workflow uses.
Can the GitHub Action use a non-Anthropic endpoint?
Yes. Set ANTHROPIC_BASE_URL in the step's env and provide the matching key as the secret.
Does @claude work in private repositories?
Yes, once the GitHub App is installed on the repository and the workflow file is present.
Run Claude Code on the gateway
Same models, two environment variables, credits at 7.69× face value — or a flat-rate unlimited plan.
Get an API key See unlimited plansAI Prime Tech is an independent API gateway and is not affiliated with, endorsed by, or sponsored by Anthropic. “Claude” and “Claude Code” are trademarks of Anthropic. Claude Code features described here follow Anthropic’s public documentation at the time of writing and change frequently; prices and model lists on this page are read from this gateway’s live settings.