Foveance¶
Cut your LLM token bill by 60%+ — without changing your code or your answers.
When you chat with an AI agent for a while, the conversation history keeps piling up. You pay for every old message on every new turn, and past a point the model actually gets worse because the important facts are buried under clutter. Foveance keeps the parts of the history that still matter, trims the parts that don't, and hands the model a shorter context — same answers, a fraction of the tokens. Nothing is deleted forever, and you don't change a line of your app.
In real tests it kept full accuracy while using 60–64% fewer tokens, and correctly recalled a buried fact that the full, uncompressed history got wrong.
Get started in 30 seconds¶
You use a coding agent (Claude Code, Codex, aider, …)¶
pip install foveance
foveance wrap claude # or: foveance wrap -- codex "fix the tests"
It runs your tool exactly as before, just cheaper, and prints how much you saved. Your API key is untouched, nothing is stored.
You write Python¶
pip install foveance
from foveance import shrink
smaller = shrink(messages, budget=2000) # your OpenAI-style messages list
# ...send `smaller` to your model instead of `messages`. Same answers, fewer tokens.
Just try it (no API key, no GPU)¶
pip install foveance
foveance demo
Documentation¶
- Usage guide — the proxy,
foveance wrap, per-tool recipes, and configuration. - Architecture — how the store, predictor, allocator, and controller fit together.
- Theory — the trajectory rate-distortion framework and the five theorems.
- Baselines — the policy arms and how they compare.
- Limitations — the honest failure modes and when the cheap heuristic suffices.
- Novelty & positioning — what is and isn't claimed as new (prior-art table).
Links¶
- Source: github.com/aimaghsoodi/foveance
- PyPI: pypi.org/project/foveance (
pip install foveance) - npm: foveance-proxy (
npx foveance-proxy) - Benchmark data: Hugging Face dataset
Apache-2.0 licensed.