> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aireserve.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub Actions (CI)

> Run Claude Code or any SDK inside GitHub Actions through the AI Reserve gateway, with the spend reported separately as CI.

<Card title="Connect GitHub Actions with a guided setup →" icon="zap" href="https://portal.aireserve.com/connect/github-actions" horizontal>
  The guided connect page mints a CI-tagged key, hands you the secret command
  and workflow snippets, and confirms the moment your first pipeline request
  arrives.
</Card>

Everything below is the manual equivalent.

## Why a CI key

Keys tagged as **CI keys** get their own treatment end to end:

* Every request a pipeline makes is stamped as CI spend — shown separately from
  interactive usage in the **Spend by Origin** card on the analytics dashboard,
  no matter which tool the pipeline runs (Claude Code, SDK scripts, eval jobs).
* The key is auto-classified as Engineering, so no one has to answer
  classification questions for workflow traffic.

Get one by checking **"This key will be used by CI"** when creating a key, or
by using the guided connect page above. An admin can also tag an *existing*
key as CI from its key details — past usage is retro-labeled, so there's no
need to rotate a secret that's already deployed.

## 1. Store the key as an Actions secret

The key value lives only in your repository's (or organization's) Actions
secrets:

```bash theme={"dark"}
gh secret set AIRESERVE_API_KEY
# org-wide instead: gh secret set AIRESERVE_API_KEY --org <org> --visibility all
```

Or in the GitHub UI: **Settings → Secrets and variables → Actions → New
repository secret**, named `AIRESERVE_API_KEY`.

## 2. Wire it into the workflow

### Claude Code / claude-code-action

Claude Code reads the gateway from two env vars — the base URL is the host
root, **no `/v1`**:

```yaml theme={"dark"}
jobs:
  claude:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: anthropics/claude-code-action@v1
        with:
          prompt: "Review this pull request"
        env:
          ANTHROPIC_BASE_URL: https://api.aireserve.com   # host root — NO /v1
          ANTHROPIC_AUTH_TOKEN: ${{ secrets.AIRESERVE_API_KEY }}
```

### SDKs and scripts

Point any OpenAI-compatible SDK at the gateway's `/v1` surface:

```yaml theme={"dark"}
env:
  OPENAI_BASE_URL: https://api.aireserve.com/v1
  OPENAI_API_KEY: ${{ secrets.AIRESERVE_API_KEY }}
```

Anthropic SDK equivalent:

```yaml theme={"dark"}
env:
  ANTHROPIC_BASE_URL: https://api.aireserve.com   # host root — NO /v1
  ANTHROPIC_AUTH_TOKEN: ${{ secrets.AIRESERVE_API_KEY }}
```

## 3. Verify

Trigger the workflow. The first metered request flips the key's *last used*
timestamp (visible on the connect page and in your profile's API keys), and
the run's spend appears in the **Spend by Origin** card on the analytics
dashboard as CI.
