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.

CI job
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. 01Install your agent as usual

    The official Claude Code action, or the native installer for claude -p.

  2. 02Add the env lines

    npx @context-mode/cli ci init writes them: the gateway base URL and your CI key as a header.

  3. 03Each 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 jobContext ModeDirectLower95% rangeSaved per 1,000 runs
CI-failure fix$0.0281$0.044233.9%25.1 to 43.6%$16
Issue triage and labels$0.0183$0.026229.6%21.1 to 38.8%$8
Release notes$0.0987$0.133325.7%7.2 to 42.7%$35
@claude fix (issue to PR)$0.0736$0.090223.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 · raw results · the plan, written first · run it in your own repo · Method and sources →

Products used

What this uses.

Headless CI docs

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

Context Saving

Long tool output is shortened before the model reads it.

Benchmarks

Every paired run, with its evidence file.

Plans

Your own Anthropic account pays the model.

Codex, OpenCode and Pi run through the same gateway in CI: set them up.

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

Your coding agent costs less and remembers your project.

Start free: 1,000 requests, every feature, no card. After you sign in, the console gives you one command to connect your coding agent.

Read the docs