CreditLens
Cut your GitHub Copilot (Claude) credit consumption — and see exactly how much you save, in real time.
CreditLens compresses the parts of your Copilot prompts that are safe to compress, without touching Copilot's cache, so your Claude requests cost fewer credits. It also meters Copilot's real billed cost per call (not an estimate) and proves the savings on a live dashboard: credits with the compressor on vs. off, side by side.
Everything runs locally on your machine. Nothing is sent anywhere except your normal Copilot traffic to GitHub, unchanged in destination.
What it does
- Cache-aware prompt compression. Copilot heavily caches your prompt prefix (system prompt, tools, context) — that part is already cheap. CreditLens never modifies cached content; it only compresses the new, uncached parts of each request, so it can never break Copilot's cache.
- Two levers, both optional and toggleable:
- Imaging — renders large blocks of prose into a compact image (a vision model bills a big image at a flat, low token rate). Code and tool-call structure are left untouched.
- Caveman — appends a terse-output directive so Claude answers concisely (output tokens are the most expensive kind).
- Real credit metering. Reads Copilot's own billed cost (
total_nano_aiu) from each response — exact, not a guess — and shows credits spent and saved.
- Proof, measured. A dashboard panel compares real credits/call compressor on vs. off, with a plain verdict (
X% cheaper / X% more) and small-sample warnings. If a setting ever costs more on your workload, it tells you — honestly.
Requirements
- VS Code 1.85+ with GitHub Copilot (using a Claude model — e.g. Sonnet / Opus).
- Python 3.10+ installed and on your PATH. CreditLens auto-installs its Python dependencies (Pillow + mitmproxy) on first run.
- On macOS, if you don't have a recent Python:
brew install python.
- Windows, macOS, and Linux are all supported. The certificate-trust step differs per OS — the
Show Certificate-Trust Command gives you the right one.
| OS |
Status |
Notes |
| Windows |
✅ Supported |
Certificate trust installs to your user store — no admin needed. |
| macOS |
✅ Beta |
Certificate trust uses the System keychain and requires your password (sudo). If you don't have Python 3.10+, run brew install python. |
| Linux |
✅ Beta |
Certificate trust shown for Debian/Ubuntu; other distributions trust CAs differently. |
The Show Certificate-Trust Command action always gives the correct command for your OS. Beta = fully implemented and expected to work, but less widely tested than Windows — feedback welcome.
Setup (first run — about 2 minutes)
Install CreditLens from the Marketplace and reload VS Code.
On first activation it locates Python, installs its dependencies (one-time, may take a minute), and starts two local background services: a sidecar (dashboard + renderer) and a proxy (the compressor).
Trust the local certificate (one-time). Compression works by routing Copilot through a local proxy, which needs a locally-generated certificate to be trusted.
- Run
CreditLens: Show Certificate-Trust Command from the Command Palette (Ctrl/Cmd+Shift+P). It copies the correct command for your OS:
- Windows (PowerShell, no admin):
Import-Certificate -FilePath "$env:USERPROFILE\.mitmproxy\mitmproxy-ca-cert.cer" -CertStoreLocation Cert:\CurrentUser\Root
- macOS (Terminal, enter your password):
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain "$HOME/.mitmproxy/mitmproxy-ca-cert.pem"
- Linux (Debian/Ubuntu):
sudo cp "$HOME/.mitmproxy/mitmproxy-ca-cert.pem" /usr/local/share/ca-certificates/mitmproxy.crt && sudo update-ca-certificates
- Paste it into your terminal and run it.
Route Copilot through CreditLens.
- Run
CreditLens: Route Copilot Through Proxy and confirm.
- Reload the window so Copilot picks up the change.
Use Copilot Claude normally. Compression is on by default (cache-aware). Your Copilot chat and agent behave exactly as before — just cheaper.
Watch it work. Click the CreditLens item in the status bar to open the dashboard: real credits, the on-vs-off proof, and the compression levers.
To turn compression off entirely, run CreditLens: Stop Routing Through Proxy.
The dashboard
Open it from the status bar or CreditLens: Open Dashboard:
- Credits & tokens — real billed credits, input/output, and cache read/write.
- Compression levers — toggle Imaging, Caveman, Include-Code, Include-Tool-Call-Prose. Changes apply immediately and persist.
- Proof — average real credits/call, compressor on vs. off, with a verdict. This is Copilot's own billing, not an estimate.
- Real-time token flow and per-model breakdown.
The status bar shows the live total and the current verdict at a glance.
Commands
| Command |
What it does |
CreditLens: Open Dashboard |
Open the full dashboard in your browser |
CreditLens: Show Panel |
In-editor summary panel |
CreditLens: Route Copilot Through Proxy |
Start compressing (sets http.proxy) |
CreditLens: Stop Routing Through Proxy |
Stop compressing |
CreditLens: Show Certificate-Trust Command |
Copies the one-time CA-trust command |
CreditLens: Start / Restart Services |
Restart the sidecar + proxy |
CreditLens: Toggle — image large prose |
Imaging lever |
CreditLens: Toggle — terse output (caveman) |
Caveman lever |
CreditLens: Toggle — also compress code |
Image code too (off by default; see below) |
CreditLens: Toggle — also compress tool-call prose |
Image prose beside tool calls |
CreditLens: Reset Stats |
Clear recorded stats |
Settings
| Setting |
Default |
Meaning |
creditlens.hubUrl |
http://127.0.0.1:7878 |
Local sidecar (dashboard + config + renderer) |
creditlens.proxyUrl |
http://127.0.0.1:8080 |
Local compression proxy |
creditlens.pythonPath |
(auto) |
Path to Python 3.10+ if auto-detect fails |
creditlens.autoStartServices |
true |
Start the sidecar + proxy on activation |
Compression toggles (imaging, caveman, include-code, include-tool-calls, density, min-words) live in the sidecar so they're shared across all VS Code windows; change them from the dashboard or the toggle commands.
How compression stays safe
- Cache-aware by design. CreditLens reads Copilot's
cache_control markers and only ever rewrites content after the last cache breakpoint — your cached system prompt, tools, and context are never touched, so caching keeps working.
- Code is not imaged by default. A single OCR misread can corrupt code, so imaging is limited to prose unless you explicitly opt in with Include code.
- Tool-call structure is preserved. The
tool_use blocks that drive Copilot's agent loop are never turned into images; only the prose beside them can be (opt-in).
Privacy & security (plain English)
Troubleshooting
- Status bar says "offline" → run
CreditLens: Start / Restart Services. If it persists, check the CreditLens output channel.
- "No Python found" → install Python 3.10+ and ensure it's on PATH, or set
creditlens.pythonPath.
- Copilot errors right after enabling the proxy → the certificate isn't trusted yet. Run the trust command (step 2) and reload the window.
- Dashboard shows no data → three things to check, in order:
- Fully restart VS Code (quit and reopen — not just "Reload Window"). Copilot only picks up proxy routing on a fresh start.
- Confirm
"http.proxySupport": "override" in your settings. "on" is not enough — only override routes extension traffic (Copilot) through the proxy.
- Make sure you're using a Claude model in native Copilot Chat. Other AI extensions that answer locally or via their own backend produce no Copilot traffic to measure.
- Copilot works but nothing is captured → almost always
http.proxySupport set to on instead of override, or VS Code wasn't fully restarted.
- Want to compare fairly → toggle a lever, run a few turns, and read the Proof panel's verdict. Small samples are flagged; run several turns each way.
Notes
- CreditLens estimates and measures credits, not answer quality. The only lever with a quality trade-off is Include code (image OCR); it's off by default.
- Savings depend on your workload. On cache-heavy agent sessions the biggest costs are already cached and cheap, so gains come mainly from trimming output (Caveman) and compressing large uncached prose. The dashboard tells you the truth for your usage.
License: MIT.
| |