Show HN: Un-LOCC – Reduce LLM API costs by compressing text into images

Share This Post

I 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.

Key results:
– Gemini 2.0 Flash Lite: 2.8:1 compression at 93.65% accuracy
– Qwen 2.5-VL-72B: 2.2:1 compression at 94.44% accuracy
– Optimal settings: 864x864px, 12px Atkinson Hyperlegible font (for most models)

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


Comments URL: https://news.ycombinator.com/item?id=45820573

Points: 1

# Comments: 0

Source: github.com

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Claude AI APIs Can Be Abused for Data Exfiltration

Article URL: https://www.securityweek.com/claude-ai-apis-can-be-abused-for-data-exfiltration/ Comments URL: https://news.ycombinator.com/item?id=45821970 Points: 1 # Comments: 0 Source: www.securityweek.com

Do You Want To Boost Your Business?

drop us a line and keep in touch

We are here to help

One of our technicians will be with you shortly.