Solution · Headless CI

# Your agent runs on every pull request. *Pay less for each run.*

Add two env lines to your GitHub Actions workflow. Same agent, same prompt, same model: Claude Code headless on Sonnet 5.5 cost 24% to 34% less per run on 4 CI jobs.

[Get started free](https://console.contextmode.ai/login) [Read the docs](https://contextmode.ai/docs/ci)

CI job

CI-failure fix Issue triage and labels Release notes @claude fix (issue to PR)

Direct **$0.0442** Through Context Mode **$0.0281**

[Cost per run, Sonnet 5.5 *33.9% lower* 95% range 25.1 to 43.6% · 6 of 6 tasks cheaper · $16 saved per 1,000 runs](https://github.com/mksglu/cm-ci-lab/blob/main/docs/ci-night-1101-r2.md)

Tests pass 7 of 7 in both. [Workflow](https://github.com/mksglu/cm-ci-lab/blob/main/.github/workflows/triage.yml) · [Tasks](https://github.com/mksglu/cm-ci-lab/blob/main/reproduce/tasks/triage.json)

Direct **$0.0262** Through Context Mode **$0.0183**

[Cost per run, Sonnet 5.5 *29.6% lower* 95% range 21.1 to 38.8% · 6 of 6 tasks cheaper · $8 saved per 1,000 runs](https://github.com/mksglu/cm-ci-lab/blob/main/docs/ci-night-1101-r2.md)

Label F1 pass 5 of 7 direct, 4 of 7 with Context Mode. [Workflow](https://github.com/mksglu/cm-ci-lab/blob/main/.github/workflows/labels.yml) · [Tasks](https://github.com/mksglu/cm-ci-lab/blob/main/reproduce/tasks/labels.json)

Direct **$0.1333** Through Context Mode **$0.0987**

[Cost per run, Sonnet 5.5 *25.7% lower* 95% range 7.2 to 42.7% · 4 of 5 tasks cheaper · $35 saved per 1,000 runs](https://github.com/mksglu/cm-ci-lab/blob/main/docs/ci-night-1101-r2.md)

Written notes, no pass mark. [Workflow](https://github.com/mksglu/cm-ci-lab/blob/main/.github/workflows/release.yml) · [Tasks](https://github.com/mksglu/cm-ci-lab/blob/main/reproduce/tasks/release.json)

Direct **$0.0902** Through Context Mode **$0.0736**

[Cost per run, Sonnet 5.5 *23.7% lower* 95% range 11.4 to 35.7% · 6 of 6 tasks cheaper · $17 saved per 1,000 runs](https://github.com/mksglu/cm-ci-lab/blob/main/docs/ci-night-1101-r2.md)

Tests pass 5 of 7 in both. [Workflow](https://github.com/mksglu/cm-ci-lab/blob/main/.github/workflows/mention.yml) · [Tasks](https://github.com/mksglu/cm-ci-lab/blob/main/reproduce/tasks/mention.json)

The problem

## Every run sends the same prompt. *You pay for it each time.*

**The same prefix**

Each run writes the same tool list and system text to the cache again.

**Long tool output**

Test logs and diffs go to the model in full, on every turn.

**Many runs**

A job on every pull request and issue repeats that cost each time.

How it works

## Keep your agent and your workflow. *Change the base URL.*

1. 01 **Install your agent as usual** The official Claude Code action, or the native installer for `claude -p`.
2. 02 **Add the env lines** `npx @context-mode/cli ci init` writes them: the gateway base URL and your CI key as a header.
3. 03 **Each run sends less** The stable part of the prompt goes first, so the next run reads it from cache. Repeated output goes once.

Proof

## The same task, run twice. *Cost per run.*

| CI job | Context Mode | Direct | Lower | 95% range | Saved per 1,000 runs |
| --- | --- | --- | --- | --- | --- |
| CI-failure fix | $0.0281 | $0.0442 | 33.9% | 25.1 to 43.6% | $16 |
| Issue triage and labels | $0.0183 | $0.0262 | 29.6% | 21.1 to 38.8% | $8 |
| Release notes | $0.0987 | $0.1333 | 25.7% | 7.2 to 42.7% | $35 |
| @claude fix (issue to PR) | $0.0736 | $0.0902 | 23.7% | 11.4 to 35.7% | $17 |

Claude Code headless (`claude -p`), Sonnet 5.5, 2026-11-01, the live gateway. Each task ran direct and through Context Mode, back to back. Warm runs, cost per run at list price. Lower: 1 minus the geometric mean of the per-task cost ratios, so it can differ from the two mean costs. A row is published only when its whole 95% range is above 0.

Proof: [the round](https://github.com/mksglu/cm-ci-lab/blob/main/docs/ci-night-1101-r2.md) · [raw results](https://contextmode.ai/benchmarks/ci/results-r2.json) · [the plan, written first](https://github.com/mksglu/cm-ci-lab/blob/main/docs/plan-ci-1031.md) · [run it in your own repo](https://github.com/mksglu/cm-ci-lab/generate) · [Method and sources →](https://contextmode.ai/docs/benchmarks)

Products used

## What this *uses.*

**[Headless CI docs](https://contextmode.ai/docs/ci)**

The CI key, the workflow and what each header does.

**[Context Saving](https://contextmode.ai/context-saving)**

Long tool output is shortened before the model reads it.

**[Benchmarks](https://contextmode.ai/docs/benchmarks)**

Every paired run, with its evidence file.

**[Plans](https://contextmode.ai/pricing)**

Your own Anthropic account pays the model.

Codex, OpenCode and Pi run through the same gateway in CI: [set them up](https://contextmode.ai/docs/ci#other-agents).

## Keep your agent in CI. *Pay for less of what it sends.*

*npx @context-mode/cli ci init* writes the workflow. 1,000 requests free, no card.

[Get started free →](https://console.contextmode.ai/login) [Set it up →](https://contextmode.ai/docs/ci)
