Show HN: Un-LOCC Reduce LLM API costs by compressing text into images
github.comI built a Python wrapper for the OpenAI SDK that compresses text into images before sending to vision models. Basically for large contexts, images can be more token-efficient than raw text.
The approach builds on DeepSeek's OCR compression research. Through 90+ experiments using an "Optical Needle in a Haystack" evaluation framework, I systematically optimized compression parameters across fonts, sizes, and resolutions.
The wrapper is a drop-in replacement for the OpenAI client - just add "compressed": True to messages containing bulk content. I recommend keeping instructions as plain text and only compressing documents, chat history, or codebases.
Links: Wrapper library: https://github.com/MaxDevv/Un-LOCC-Wrapper, Research & benchmarks: https://github.com/MaxDevv/Un-LOCC