Skip to content

Commit 746c000

Browse files
authored
Merge pull request #160 from ModelMirrorAI/ci/agentic-workflows-anthropic-api-key
ci: authenticate agentic workflows via Anthropic API key
2 parents f620123 + 4d19e3c commit 746c000

4 files changed

Lines changed: 41 additions & 27 deletions

File tree

.github/workflows/run-dev.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,21 @@ jobs:
9191
ISSUE_TITLE: ${{ github.event.issue.title }}
9292
ISSUE_BODY: ${{ github.event.issue.body }}
9393
with:
94-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
94+
# Auth is the Anthropic API key (pay-per-token): automated pipeline
95+
# inference is API-metered by design (see docs/budget.md). For a
96+
# local/interactive fallback, swap this for
97+
# `claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`.
98+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
9599
github_token: ${{ steps.app-token.outputs.token }}
100+
# The API key's default prompt-cache TTL is only 5 minutes, which would
101+
# expire across a long dev run's tool-use turns; pin the 1-hour TTL so the
102+
# stable prefix (AGENTS.md + prompt) keeps its cache-read discount.
103+
settings: |
104+
{
105+
"env": {
106+
"ENABLE_PROMPT_CACHING_1H": "1"
107+
}
108+
}
96109
prompt: |
97110
Read .github/prompts/dev.md and AGENTS.md, then complete the `run:dev`
98111
development task described in the issue (number in ISSUE_NUMBER, title in

.github/workflows/run-evaluate.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,18 @@ jobs:
177177
EVALUATOR_ID: ${{ matrix.evaluator_id }}
178178
RUN_ID: ${{ matrix.run_id }}
179179
with:
180-
# Auth is the Claude Max subscription (OAuth) today. To move to the
181-
# Anthropic API later, replace this line with
182-
# `anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}`; the cache
183-
# settings below already cover that switch.
184-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
180+
# Auth is the Anthropic API key (pay-per-token): automated pipeline
181+
# inference is API-metered by design (see docs/budget.md), and per
182+
# Anthropic policy the Max subscription OAuth token is for interactive
183+
# Claude Code / claude.ai, not CI. For a local/interactive fallback,
184+
# swap this for `claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`.
185+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
185186
github_token: ${{ steps.agent-token.outputs.token }}
186187
# Prompt caching is automatic: the stable prefix (AGENTS.md + the
187188
# prompt template + schema) is cached across the run's tool-use turns.
188-
# OAuth requests the 1-hour cache TTL for free; setting it explicitly
189-
# keeps that TTL (and the cache-read discount priced in
190-
# fedcourtsai.pricing) once auth moves to an API key — whose default
191-
# would otherwise fall to 5 minutes and expire the cache mid-run.
189+
# The API key's default cache TTL is only 5 minutes, which would expire
190+
# mid-run, so ENABLE_PROMPT_CACHING_1H below pins the 1-hour TTL (and the
191+
# cache-read discount priced in fedcourtsai.pricing).
192192
settings: |
193193
{
194194
"env": {

.github/workflows/run-predict.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,18 @@ jobs:
176176
RUN_ID: ${{ matrix.run_id }}
177177
COURTLISTENER_API_TOKEN: ${{ secrets.COURTLISTENER_API_TOKEN }}
178178
with:
179-
# Auth is the Claude Max subscription (OAuth) today. To move to the
180-
# Anthropic API later, replace this line with
181-
# `anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}`; the cache
182-
# settings below already cover that switch.
183-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
179+
# Auth is the Anthropic API key (pay-per-token): automated pipeline
180+
# inference is API-metered by design (see docs/budget.md), and per
181+
# Anthropic policy the Max subscription OAuth token is for interactive
182+
# Claude Code / claude.ai, not CI. For a local/interactive fallback,
183+
# swap this for `claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`.
184+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
184185
github_token: ${{ steps.agent-token.outputs.token }}
185186
# Prompt caching is automatic: the stable prefix (AGENTS.md + the
186187
# prompt template + schema) is cached across the run's tool-use turns.
187-
# OAuth requests the 1-hour cache TTL for free; setting it explicitly
188-
# keeps that TTL (and the cache-read discount priced in
189-
# fedcourtsai.pricing) once auth moves to an API key — whose default
190-
# would otherwise fall to 5 minutes and expire the cache mid-run.
188+
# The API key's default cache TTL is only 5 minutes, which would expire
189+
# mid-run, so ENABLE_PROMPT_CACHING_1H below pins the 1-hour TTL (and the
190+
# cache-read discount priced in fedcourtsai.pricing).
191191
settings: |
192192
{
193193
"env": {

.github/workflows/run-reconcile.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,17 @@ jobs:
190190
EVENT_IDS: ${{ matrix.events }}
191191
RUN_ID: ${{ matrix.run_id }}
192192
with:
193-
# Auth is the Claude Max subscription (OAuth) today. To move to the
194-
# Anthropic API later, replace this line with
195-
# `anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}`; the cache
196-
# settings below already cover that switch.
197-
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
193+
# Auth is the Anthropic API key (pay-per-token): automated pipeline
194+
# inference is API-metered by design (see docs/budget.md), and per
195+
# Anthropic policy the Max subscription OAuth token is for interactive
196+
# Claude Code / claude.ai, not CI. For a local/interactive fallback,
197+
# swap this for `claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}`.
198+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
198199
github_token: ${{ steps.agent-token.outputs.token }}
199200
# Prompt caching is automatic: the stable prefix (AGENTS.md + the prompt
200-
# template + schema) is cached across the run's tool-use turns. OAuth
201-
# requests the 1-hour cache TTL for free; setting it explicitly keeps that
202-
# TTL (and the cache-read discount) once auth moves to an API key.
201+
# template + schema) is cached across the run's tool-use turns. The API
202+
# key's default cache TTL is only 5 minutes, so ENABLE_PROMPT_CACHING_1H
203+
# below pins the 1-hour TTL (and the cache-read discount).
203204
settings: |
204205
{
205206
"env": {

0 commit comments

Comments
 (0)