main
md 58 lines 2.48 KB
Rendered Raw
1 # Copilot CLI Caching Investigation
2
3 ## Status: No Explicit Cache Support Available
4
5 **Date:** 2026-05-21
6 **Author:** Amy & Fry (SquadScope Squad)
7
8 ## Current Status
9
10 ### Copilot CLI (Primary Path)
11
12 - Copilot CLI in CI mode does **NOT** support explicit prompt caching
13 - No flags or configuration options exist to enable cache reuse between runs
14 - Each invocation sends the full prompt context to the model
15 - GitHub has not announced any roadmap for prompt caching in the CLI
16
17 ### GitHub Models API (Fallback Path)
18
19 - The GitHub Models API also does **NOT** expose cache control headers or parameters
20 - Token usage is billed per-request with no discount for repeated prefixes
21 - No mechanism to pin or reuse cached prompt segments
22
23 ### Anthropic API (Direct Access)
24
25 - Anthropic's API **does** support prompt caching via `cache_control` blocks
26 - Cached input tokens are billed at $0.30/1M instead of $3.00/1M (for Claude Sonnet 4)
27 - Cache has a 5-minute TTL with automatic extension on cache hits
28 - Requires direct API access (not available through Copilot CLI or GitHub Models)
29
30 ## Cost Impact Analysis
31
32 | Scenario | Input Token Cost | Savings |
33 |----------|-----------------|---------|
34 | No caching (current) | $3.00/1M tokens | — |
35 | With Anthropic caching | $0.30/1M tokens (cached) | ~77% reduction |
36 | Typical weekly run (~80K tokens) | $0.24 → $0.056 | ~$0.18/run saved |
37
38 For our current usage (~3 runs/week), potential monthly savings: ~$2.16
39
40 ## Recommendation
41
42 1. **Short-term:** Continue using Copilot CLI as primary path. The convenience and integration benefits outweigh the caching cost savings at our current volume.
43
44 2. **Medium-term:** Monitor GitHub's announcements for:
45 - Prompt caching support in Copilot CLI
46 - Cache-aware billing in GitHub Models API
47 - Any new `--cache` or `--session` flags
48
49 3. **Long-term / High-volume:** If SquadScope scales to daily runs or multi-org deployments, consider switching to direct Anthropic API access to leverage prompt caching. This becomes worthwhile when:
50 - Monthly token volume exceeds 1M input tokens
51 - The same system prompt is reused across multiple runs within 5 minutes
52 - Cost savings justify the added complexity of API key management
53
54 ## References
55
56 - [Anthropic Prompt Caching Docs](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching)
57 - [GitHub Copilot CLI Documentation](https://docs.github.com/en/copilot/using-github-copilot/using-github-copilot-in-the-command-line)
58 - [GitHub Models API](https://docs.github.com/en/github-models)